From dde15b4b7a20d87de1a4f43ddbfc4342c2368eaa Mon Sep 17 00:00:00 2001 From: snigdha Date: Wed, 5 Mar 2014 08:47:45 -0500 Subject: [PATCH] Bug 798033 - Headers should generally not do "using namespace" at file scope. r=jib, r=jmathies, r=rjesup, r=ekr, r=ncameron, r=blassey --- dom/ipc/ContentParent.cpp | 2 +- dom/plugins/base/android/ANPSystem.cpp | 2 +- dom/plugins/base/nsNPAPIPlugin.cpp | 12 +- dom/plugins/base/nsNPAPIPluginInstance.cpp | 6 +- dom/plugins/base/nsPluginInstanceOwner.cpp | 2 +- .../android/AndroidLocationProvider.cpp | 6 +- dom/system/android/nsHapticFeedback.cpp | 2 +- gfx/layers/d3d10/ImageLayerD3D10.h | 6 +- gfx/thebes/nsSurfaceTexture.cpp | 6 +- hal/android/AndroidHal.cpp | 18 +-- hal/android/AndroidSensor.cpp | 4 +- ipc/glue/MessagePump.cpp | 2 +- .../signaling/src/media/CSFMediaProvider.h | 2 - .../src/peerconnection/PeerConnectionCtx.cpp | 10 +- .../src/peerconnection/PeerConnectionCtx.h | 4 +- media/webrtc/signaling/test/FakePCObserver.h | 3 +- .../components/build/nsAndroidHistory.cpp | 6 +- .../components/build/nsShellService.cpp | 5 +- netwerk/base/src/Tickler.cpp | 2 +- netwerk/protocol/device/CameraStreamImpl.cpp | 2 +- .../android/nsAndroidNetworkLinkService.cpp | 6 +- toolkit/components/alerts/nsAlertsService.cpp | 8 +- .../downloads/nsDownloadManager.cpp | 2 +- tools/profiler/TableTicker.cpp | 7 +- tools/profiler/platform.cpp | 2 +- .../android/nsAndroidHandlerApp.cpp | 7 +- .../android/nsExternalSharingAppService.cpp | 3 +- .../exthandler/android/nsMIMEInfoAndroid.cpp | 8 +- widget/android/AndroidBridge.cpp | 123 ++++++++++++------ widget/android/AndroidBridge.h | 14 +- widget/android/AndroidJNI.cpp | 1 + widget/android/nsAppShell.cpp | 14 +- widget/android/nsClipboard.cpp | 23 +++- widget/android/nsIMEPicker.cpp | 2 +- widget/android/nsLookAndFeel.cpp | 2 +- widget/android/nsScreenManagerAndroid.cpp | 2 +- widget/android/nsWindow.cpp | 40 +++--- .../winrt/ToastNotificationHandler.cpp | 33 ++--- .../windows/winrt/ToastNotificationHandler.h | 8 +- widget/windows/winrt/UIABridgePrivate.h | 8 +- xpcom/base/nsSystemInfo.cpp | 2 +- xpcom/io/nsLocalFileUnix.cpp | 3 +- 42 files changed, 241 insertions(+), 179 deletions(-) diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index cc2232b1d7e..670db033507 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -1861,7 +1861,7 @@ ContentParent::RecvGetShowPasswordSetting(bool* showPassword) #ifdef MOZ_WIDGET_ANDROID NS_ASSERTION(AndroidBridge::Bridge() != nullptr, "AndroidBridge is not available"); - *showPassword = GeckoAppShell::GetShowPasswordSetting(); + *showPassword = mozilla::widget::android::GeckoAppShell::GetShowPasswordSetting(); #endif return true; } diff --git a/dom/plugins/base/android/ANPSystem.cpp b/dom/plugins/base/android/ANPSystem.cpp index 7d9c17b7f61..77450f6e0d3 100644 --- a/dom/plugins/base/android/ANPSystem.cpp +++ b/dom/plugins/base/android/ANPSystem.cpp @@ -63,7 +63,7 @@ jclass anp_system_loadJavaClass(NPP instance, const char* classNameStr) lib->GetLibraryPath(libNameUtf8); NS_ConvertUTF8toUTF16 libName(libNameUtf8); - return GeckoAppShell::LoadPluginClass(className, libName); + return mozilla::widget::android::GeckoAppShell::LoadPluginClass(className, libName); } void anp_system_setPowerState(NPP instance, ANPPowerState powerState) diff --git a/dom/plugins/base/nsNPAPIPlugin.cpp b/dom/plugins/base/nsNPAPIPlugin.cpp index 99cebe75046..0e706e6b4e4 100644 --- a/dom/plugins/base/nsNPAPIPlugin.cpp +++ b/dom/plugins/base/nsNPAPIPlugin.cpp @@ -540,7 +540,7 @@ MakeNewNPAPIStreamInternal(NPP npp, const char *relativeURL, const char *target, // Set aCallNotify here to false. If pluginHost->GetURL or PostURL fail, // the listener's destructor will do the notification while we are about to // return a failure code. - // Call SetCallNotify(true) below after we are sure we cannot return a failure + // Call SetCallNotify(true) below after we are sure we cannot return a failure // code. if (!target) { inst->NewStreamListener(relativeURL, notifyData, @@ -611,7 +611,7 @@ public: return (mFunc != nullptr); } -private: +private: NPP mInstance; PluginThreadCallback mFunc; void *mUserData; @@ -1063,10 +1063,10 @@ _destroystream(NPP npp, NPStream *pstream, NPError reason) // This type of stream (NPStream) was created via NPN_NewStream. The plugin holds // the reference until it is to be deleted here. Deleting the wrapper will // release the wrapped nsIOutputStream. - // + // // The NPStream the plugin references should always be a sub-object of it's own // 'ndata', which is our nsNPAPIStramWrapper. See bug 548441. - NS_ASSERTION((char*)streamWrapper <= (char*)pstream && + NS_ASSERTION((char*)streamWrapper <= (char*)pstream && ((char*)pstream) + sizeof(*pstream) <= ((char*)streamWrapper) + sizeof(*streamWrapper), "pstream is not a subobject of wrapper"); @@ -2247,10 +2247,10 @@ _getvalue(NPP npp, NPNVariable variable, void *result) uint32_t* bits = reinterpret_cast(result); *bits = kBitmap_ANPDrawingModel && kSurface_ANPDrawingModel; return NPERR_NO_ERROR; - } + } case kJavaContext_ANPGetValue: { - jobject ret = GeckoAppShell::GetContext(); + jobject ret = mozilla::widget::android::GeckoAppShell::GetContext(); if (!ret) return NPERR_GENERIC_ERROR; diff --git a/dom/plugins/base/nsNPAPIPluginInstance.cpp b/dom/plugins/base/nsNPAPIPluginInstance.cpp index 44ca1a9a8a8..e43b7f9ea47 100644 --- a/dom/plugins/base/nsNPAPIPluginInstance.cpp +++ b/dom/plugins/base/nsNPAPIPluginInstance.cpp @@ -870,7 +870,7 @@ void nsNPAPIPluginInstance::NotifyFullScreen(bool aFullScreen) SendLifecycleEvent(this, mFullScreen ? kEnterFullScreen_ANPLifecycleAction : kExitFullScreen_ANPLifecycleAction); if (mFullScreen && mFullScreenOrientation != dom::eScreenOrientation_None) { - GeckoAppShell::LockScreenOrientation(mFullScreenOrientation); + mozilla::widget::android::GeckoAppShell::LockScreenOrientation(mFullScreenOrientation); } } @@ -927,11 +927,11 @@ void nsNPAPIPluginInstance::SetFullScreenOrientation(uint32_t orientation) // We're already fullscreen so immediately apply the orientation change if (mFullScreenOrientation != dom::eScreenOrientation_None) { - GeckoAppShell::LockScreenOrientation(mFullScreenOrientation); + mozilla::widget::android::GeckoAppShell::LockScreenOrientation(mFullScreenOrientation); } else if (oldOrientation != dom::eScreenOrientation_None) { // We applied an orientation when we entered fullscreen, but // we don't want it anymore - GeckoAppShell::UnlockScreenOrientation(); + mozilla::widget::android::GeckoAppShell::UnlockScreenOrientation(); } } } diff --git a/dom/plugins/base/nsPluginInstanceOwner.cpp b/dom/plugins/base/nsPluginInstanceOwner.cpp index 2c401a503d3..e7a460f147e 100644 --- a/dom/plugins/base/nsPluginInstanceOwner.cpp +++ b/dom/plugins/base/nsPluginInstanceOwner.cpp @@ -1465,7 +1465,7 @@ void nsPluginInstanceOwner::RemovePluginView() if (!mInstance || !mJavaView) return; - GeckoAppShell::RemovePluginView((jobject)mJavaView, mFullScreen); + mozilla::widget::android::GeckoAppShell::RemovePluginView((jobject)mJavaView, mFullScreen); AndroidBridge::GetJNIEnv()->DeleteGlobalRef((jobject)mJavaView); mJavaView = nullptr; diff --git a/dom/system/android/AndroidLocationProvider.cpp b/dom/system/android/AndroidLocationProvider.cpp index e26204fb144..5fab3c175b3 100644 --- a/dom/system/android/AndroidLocationProvider.cpp +++ b/dom/system/android/AndroidLocationProvider.cpp @@ -26,7 +26,7 @@ AndroidLocationProvider::~AndroidLocationProvider() NS_IMETHODIMP AndroidLocationProvider::Startup() { - GeckoAppShell::EnableLocation(true); + mozilla::widget::android::GeckoAppShell::EnableLocation(true); return NS_OK; } @@ -42,13 +42,13 @@ AndroidLocationProvider::Watch(nsIGeolocationUpdate* aCallback) NS_IMETHODIMP AndroidLocationProvider::Shutdown() { - GeckoAppShell::EnableLocation(false); + mozilla::widget::android::GeckoAppShell::EnableLocation(false); return NS_OK; } NS_IMETHODIMP AndroidLocationProvider::SetHighAccuracy(bool enable) { - GeckoAppShell::EnableLocationHighAccuracy(enable); + mozilla::widget::android::GeckoAppShell::EnableLocationHighAccuracy(enable); return NS_OK; } diff --git a/dom/system/android/nsHapticFeedback.cpp b/dom/system/android/nsHapticFeedback.cpp index 4e0bba6aa22..8b9fbf07b1d 100644 --- a/dom/system/android/nsHapticFeedback.cpp +++ b/dom/system/android/nsHapticFeedback.cpp @@ -14,6 +14,6 @@ NS_IMPL_ISUPPORTS1(nsHapticFeedback, nsIHapticFeedback) NS_IMETHODIMP nsHapticFeedback::PerformSimpleAction(int32_t aType) { - GeckoAppShell::PerformHapticFeedback(aType == LongPress); + mozilla::widget::android::GeckoAppShell::PerformHapticFeedback(aType == LongPress); return NS_OK; } diff --git a/gfx/layers/d3d10/ImageLayerD3D10.h b/gfx/layers/d3d10/ImageLayerD3D10.h index d6281949ab0..e362dff2129 100644 --- a/gfx/layers/d3d10/ImageLayerD3D10.h +++ b/gfx/layers/d3d10/ImageLayerD3D10.h @@ -11,8 +11,6 @@ #include "ImageContainer.h" #include "yuv_convert.h" -using namespace mozilla::gfx; - namespace mozilla { namespace layers { @@ -63,11 +61,11 @@ public: already_AddRefed DeprecatedGetAsSurface(); virtual TemporaryRef GetAsSourceSurface() MOZ_OVERRIDE; - IntSize GetSize() { return mSize; } + mozilla::gfx::IntSize GetSize() { return mSize; } TextureD3D10BackendData *GetD3D10TextureBackendData(ID3D10Device *aDevice); - IntSize mSize; + mozilla::gfx::IntSize mSize; RemoteImageData::Format mFormat; HANDLE mHandle; }; diff --git a/gfx/thebes/nsSurfaceTexture.cpp b/gfx/thebes/nsSurfaceTexture.cpp index 45771c1ca3c..55ee0143064 100644 --- a/gfx/thebes/nsSurfaceTexture.cpp +++ b/gfx/thebes/nsSurfaceTexture.cpp @@ -194,7 +194,7 @@ nsSurfaceTexture::~nsSurfaceTexture() JNIEnv* env = GetJNIForThread(); if (mSurfaceTexture) { - GeckoAppShell::UnregisterSurfaceTextureFrameListener(mSurfaceTexture); + mozilla::widget::android::GeckoAppShell::UnregisterSurfaceTextureFrameListener(mSurfaceTexture); env->DeleteGlobalRef(mSurfaceTexture); mSurfaceTexture = nullptr; @@ -223,9 +223,9 @@ void nsSurfaceTexture::SetFrameAvailableCallback(nsIRunnable* aRunnable) { if (aRunnable) - GeckoAppShell::RegisterSurfaceTextureFrameListener(mSurfaceTexture, mID); + mozilla::widget::android::GeckoAppShell::RegisterSurfaceTextureFrameListener(mSurfaceTexture, mID); else - GeckoAppShell::UnregisterSurfaceTextureFrameListener(mSurfaceTexture); + mozilla::widget::android::GeckoAppShell::UnregisterSurfaceTextureFrameListener(mSurfaceTexture); mFrameAvailableCallback = aRunnable; } diff --git a/hal/android/AndroidHal.cpp b/hal/android/AndroidHal.cpp index e97ff5b718b..df0eebdebe8 100644 --- a/hal/android/AndroidHal.cpp +++ b/hal/android/AndroidHal.cpp @@ -55,19 +55,19 @@ CancelVibrate(const WindowIdentifier &) { // Ignore WindowIdentifier parameter. - GeckoAppShell::CancelVibrate(); + mozilla::widget::android::GeckoAppShell::CancelVibrate(); } void EnableBatteryNotifications() { - GeckoAppShell::EnableBatteryNotifications(); + mozilla::widget::android::GeckoAppShell::EnableBatteryNotifications(); } void DisableBatteryNotifications() { - GeckoAppShell::DisableBatteryNotifications(); + mozilla::widget::android::GeckoAppShell::DisableBatteryNotifications(); } void @@ -79,13 +79,13 @@ GetCurrentBatteryInformation(hal::BatteryInformation* aBatteryInfo) void EnableNetworkNotifications() { - GeckoAppShell::EnableNetworkNotifications(); + mozilla::widget::android::GeckoAppShell::EnableNetworkNotifications(); } void DisableNetworkNotifications() { - GeckoAppShell::DisableNetworkNotifications(); + mozilla::widget::android::GeckoAppShell::DisableNetworkNotifications(); } void @@ -97,13 +97,13 @@ GetCurrentNetworkInformation(hal::NetworkInformation* aNetworkInfo) void EnableScreenConfigurationNotifications() { - GeckoAppShell::EnableScreenOrientationNotifications(); + mozilla::widget::android::GeckoAppShell::EnableScreenOrientationNotifications(); } void DisableScreenConfigurationNotifications() { - GeckoAppShell::DisableScreenOrientationNotifications(); + mozilla::widget::android::GeckoAppShell::DisableScreenOrientationNotifications(); } void @@ -149,7 +149,7 @@ LockScreenOrientation(const ScreenOrientation& aOrientation) case eScreenOrientation_LandscapeSecondary: case eScreenOrientation_LandscapePrimary | eScreenOrientation_LandscapeSecondary: case eScreenOrientation_Default: - GeckoAppShell::LockScreenOrientation(aOrientation); + mozilla::widget::android::GeckoAppShell::LockScreenOrientation(aOrientation); return true; default: return false; @@ -159,7 +159,7 @@ LockScreenOrientation(const ScreenOrientation& aOrientation) void UnlockScreenOrientation() { - GeckoAppShell::UnlockScreenOrientation(); + mozilla::widget::android::GeckoAppShell::UnlockScreenOrientation(); } } // hal_impl diff --git a/hal/android/AndroidSensor.cpp b/hal/android/AndroidSensor.cpp index 3c88027a58e..357137f608f 100644 --- a/hal/android/AndroidSensor.cpp +++ b/hal/android/AndroidSensor.cpp @@ -13,12 +13,12 @@ namespace hal_impl { void EnableSensorNotifications(SensorType aSensor) { - GeckoAppShell::EnableSensor(aSensor); + mozilla::widget::android::GeckoAppShell::EnableSensor(aSensor); } void DisableSensorNotifications(SensorType aSensor) { - GeckoAppShell::DisableSensor(aSensor); + mozilla::widget::android::GeckoAppShell::DisableSensor(aSensor); } } // hal_impl diff --git a/ipc/glue/MessagePump.cpp b/ipc/glue/MessagePump.cpp index 5a492246047..89ff8c28351 100644 --- a/ipc/glue/MessagePump.cpp +++ b/ipc/glue/MessagePump.cpp @@ -106,7 +106,7 @@ MessagePump::Run(MessagePump::Delegate* aDelegate) // get here if the normal Gecko event loop has been awoken above. // Bug 750713 if (MOZ_LIKELY(AndroidBridge::HasEnv())) { - did_work |= GeckoAppShell::PumpMessageLoop(); + did_work |= mozilla::widget::android::GeckoAppShell::PumpMessageLoop(); } #endif diff --git a/media/webrtc/signaling/src/media/CSFMediaProvider.h b/media/webrtc/signaling/src/media/CSFMediaProvider.h index 2be41456171..d61f8c067ec 100644 --- a/media/webrtc/signaling/src/media/CSFMediaProvider.h +++ b/media/webrtc/signaling/src/media/CSFMediaProvider.h @@ -9,8 +9,6 @@ #include -using namespace std; - namespace CSF { class AudioControl; diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp b/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp index a31887f2819..5c2bbda1efb 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.cpp @@ -166,7 +166,7 @@ namespace sipcc { PeerConnectionCtx* PeerConnectionCtx::gInstance; nsIThread* PeerConnectionCtx::gMainThread; -StaticRefPtr PeerConnectionCtx::gPeerConnectionCtxShutdown; +mozilla::StaticRefPtr PeerConnectionCtx::gPeerConnectionCtxShutdown; // Since we have a pointer to main-thread, help make it safe for lower-level // SIPCC threads to use SyncRunnable without deadlocking, by exposing main's @@ -174,7 +174,7 @@ StaticRefPtr PeerConnectionCtx::gPeerConnect static void thread_ended_dispatcher(thread_ended_funct func, thread_monitor_id_t id) { - nsresult rv = PeerConnectionCtx::gMainThread->Dispatch(WrapRunnableNM(func, id), + nsresult rv = PeerConnectionCtx::gMainThread->Dispatch(mozilla::WrapRunnableNM(func, id), NS_DISPATCH_NORMAL); if (NS_FAILED(rv)) { CSFLogError( logTag, "%s(): Could not dispatch to main thread", __FUNCTION__); @@ -222,7 +222,7 @@ nsresult PeerConnectionCtx::InitializeGlobal(nsIThread *mainThread, gInstance = ctx; if (!sipcc::PeerConnectionCtx::gPeerConnectionCtxShutdown) { - sipcc::PeerConnectionCtx::gPeerConnectionCtxShutdown = new PeerConnectionCtxShutdown(); + sipcc::PeerConnectionCtx::gPeerConnectionCtxShutdown = new mozilla::PeerConnectionCtxShutdown(); sipcc::PeerConnectionCtx::gPeerConnectionCtxShutdown->Init(); } } @@ -304,7 +304,7 @@ nsresult PeerConnectionCtx::Initialize() { mConnectionCounter = 0; #ifdef MOZILLA_INTERNAL_API - Telemetry::GetHistogramById(Telemetry::WEBRTC_CALL_COUNT)->Add(0); + mozilla::Telemetry::GetHistogramById(mozilla::Telemetry::WEBRTC_CALL_COUNT)->Add(0); #endif return NS_OK; @@ -369,7 +369,7 @@ void PeerConnectionCtx::onCallEvent(ccapi_call_event_e aCallEvent, nsAutoPtr pcDuped(new std::string(aCall->getPeerConnection())); // DISPATCH_NORMAL with duped string - nsresult rv = gMainThread->Dispatch(WrapRunnableNM(&onCallEvent_m, pcDuped, + nsresult rv = gMainThread->Dispatch(mozilla::WrapRunnableNM(&onCallEvent_m, pcDuped, aCallEvent, aInfo), NS_DISPATCH_NORMAL); if (NS_FAILED(rv)) { diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.h b/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.h index 2418d88e646..5f365f5241a 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.h +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionCtx.h @@ -39,8 +39,6 @@ protected: namespace sipcc { -using namespace mozilla; - class OnCallEventArgs { public: OnCallEventArgs(ccapi_call_event_e aCallEvent, CSF::CC_CallInfoPtr aInfo) @@ -106,7 +104,7 @@ class PeerConnectionCtx : public CSF::CC_Observer { static PeerConnectionCtx *gInstance; public: static nsIThread *gMainThread; - static StaticRefPtr gPeerConnectionCtxShutdown; + static mozilla::StaticRefPtr gPeerConnectionCtxShutdown; }; } // namespace sipcc diff --git a/media/webrtc/signaling/test/FakePCObserver.h b/media/webrtc/signaling/test/FakePCObserver.h index ddb42734168..a14f056ab93 100644 --- a/media/webrtc/signaling/test/FakePCObserver.h +++ b/media/webrtc/signaling/test/FakePCObserver.h @@ -31,7 +31,6 @@ class nsIDOMWindow; class nsIDOMDataChannel; namespace test { -using namespace mozilla::dom; class AFakePCObserver : public nsSupportsWeakReference { @@ -81,7 +80,7 @@ public: virtual NS_IMETHODIMP NotifyConnection(ER&) = 0; virtual NS_IMETHODIMP NotifyClosedConnection(ER&) = 0; virtual NS_IMETHODIMP NotifyDataChannel(nsIDOMDataChannel *channel, ER&) = 0; - virtual NS_IMETHODIMP OnStateChange(PCObserverStateType state_type, ER&, + virtual NS_IMETHODIMP OnStateChange(mozilla::dom::PCObserverStateType state_type, ER&, void* = nullptr) = 0; virtual NS_IMETHODIMP OnAddStream(nsIDOMMediaStream *stream, ER&) = 0; virtual NS_IMETHODIMP OnRemoveStream(ER&) = 0; diff --git a/mobile/android/components/build/nsAndroidHistory.cpp b/mobile/android/components/build/nsAndroidHistory.cpp index 7a563bde271..db49ef53b91 100644 --- a/mobile/android/components/build/nsAndroidHistory.cpp +++ b/mobile/android/components/build/nsAndroidHistory.cpp @@ -63,7 +63,7 @@ nsAndroidHistory::RegisterVisitedCallback(nsIURI *aURI, Link *aContent) list->AppendElement(aContent); if (AndroidBridge::HasEnv()) { - GeckoAppShell::CheckURIVisited(uriString); + mozilla::widget::android::GeckoAppShell::CheckURIVisited(uriString); } return NS_OK; @@ -180,7 +180,7 @@ nsAndroidHistory::VisitURI(nsIURI *aURI, nsIURI *aLastVisitedURI, uint32_t aFlag rv = aURI->GetSpec(uri); if (NS_FAILED(rv)) return rv; NS_ConvertUTF8toUTF16 uriString(uri); - GeckoAppShell::MarkURIVisited(uriString); + mozilla::widget::android::GeckoAppShell::MarkURIVisited(uriString); } AppendToRecentlyVisitedURIs(aURI); @@ -215,7 +215,7 @@ nsAndroidHistory::SetURITitle(nsIURI *aURI, const nsAString& aTitle) nsresult rv = aURI->GetSpec(uri); if (NS_FAILED(rv)) return rv; NS_ConvertUTF8toUTF16 uriString(uri); - GeckoAppShell::SetURITitle(uriString, aTitle); + mozilla::widget::android::GeckoAppShell::SetURITitle(uriString, aTitle); } return NS_OK; } diff --git a/mobile/android/components/build/nsShellService.cpp b/mobile/android/components/build/nsShellService.cpp index 0c9d915c817..df24e9bdd6c 100644 --- a/mobile/android/components/build/nsShellService.cpp +++ b/mobile/android/components/build/nsShellService.cpp @@ -19,11 +19,12 @@ nsShellService::SwitchTask() } NS_IMETHODIMP -nsShellService::CreateShortcut(const nsAString& aTitle, const nsAString& aURI, const nsAString& aIconData, const nsAString& aIntent) +nsShellService::CreateShortcut(const nsAString& aTitle, const nsAString& aURI, + const nsAString& aIconData, const nsAString& aIntent) { if (!aTitle.Length() || !aURI.Length() || !aIconData.Length()) return NS_ERROR_FAILURE; - GeckoAppShell::CreateShortcut(aTitle, aURI, aIconData, aIntent); + mozilla::widget::android::GeckoAppShell::CreateShortcut(aTitle, aURI, aIconData, aIntent); return NS_OK; } diff --git a/netwerk/base/src/Tickler.cpp b/netwerk/base/src/Tickler.cpp index d9099a318d9..6ee66029c6e 100644 --- a/netwerk/base/src/Tickler.cpp +++ b/netwerk/base/src/Tickler.cpp @@ -81,7 +81,7 @@ Tickler::Init() MOZ_ASSERT(!mFD); if (AndroidBridge::HasEnv()) { - GeckoAppShell::EnableNetworkNotifications(); + mozilla::widget::android::GeckoAppShell::EnableNetworkNotifications(); } mFD = PR_OpenUDPSocket(PR_AF_INET); diff --git a/netwerk/protocol/device/CameraStreamImpl.cpp b/netwerk/protocol/device/CameraStreamImpl.cpp index 2d51be4f182..c7807a39bc2 100644 --- a/netwerk/protocol/device/CameraStreamImpl.cpp +++ b/netwerk/protocol/device/CameraStreamImpl.cpp @@ -90,7 +90,7 @@ bool CameraStreamImpl::Init(const nsCString& contentType, const uint32_t& camera } void CameraStreamImpl::Close() { - GeckoAppShell::CloseCamera(); + mozilla::widget::android::GeckoAppShell::CloseCamera(); mCallback = nullptr; } diff --git a/netwerk/system/android/nsAndroidNetworkLinkService.cpp b/netwerk/system/android/nsAndroidNetworkLinkService.cpp index 2365d081094..97629673a94 100644 --- a/netwerk/system/android/nsAndroidNetworkLinkService.cpp +++ b/netwerk/system/android/nsAndroidNetworkLinkService.cpp @@ -33,7 +33,7 @@ nsAndroidNetworkLinkService::GetIsLinkUp(bool *aIsUp) return NS_OK; } - *aIsUp = GeckoAppShell::IsNetworkLinkUp(); + *aIsUp = mozilla::widget::android::GeckoAppShell::IsNetworkLinkUp(); return NS_OK; } @@ -42,7 +42,7 @@ nsAndroidNetworkLinkService::GetLinkStatusKnown(bool *aIsKnown) { NS_ENSURE_TRUE(mozilla::AndroidBridge::Bridge(), NS_ERROR_NOT_IMPLEMENTED); - *aIsKnown = GeckoAppShell::IsNetworkLinkKnown(); + *aIsKnown = mozilla::widget::android::GeckoAppShell::IsNetworkLinkKnown(); return NS_OK; } @@ -58,6 +58,6 @@ nsAndroidNetworkLinkService::GetLinkType(uint32_t *aLinkType) return NS_OK; } - *aLinkType = GeckoAppShell::NetworkLinkType(); + *aLinkType = mozilla::widget::android::GeckoAppShell::NetworkLinkType(); return NS_OK; } diff --git a/toolkit/components/alerts/nsAlertsService.cpp b/toolkit/components/alerts/nsAlertsService.cpp index 6ca303d3970..b8868ec2d9f 100644 --- a/toolkit/components/alerts/nsAlertsService.cpp +++ b/toolkit/components/alerts/nsAlertsService.cpp @@ -128,7 +128,7 @@ NS_IMETHODIMP nsAlertsService::CloseAlert(const nsAString& aAlertName, } #ifdef MOZ_WIDGET_ANDROID - GeckoAppShell::CloseNotification(aAlertName); + mozilla::widget::android::GeckoAppShell::CloseNotification(aAlertName); return NS_OK; #else @@ -149,7 +149,9 @@ NS_IMETHODIMP nsAlertsService::OnProgress(const nsAString & aAlertName, const nsAString & aAlertText) { #ifdef MOZ_WIDGET_ANDROID - GeckoAppShell::AlertsProgressListener_OnProgress(aAlertName, aProgress, aProgressMax, aAlertText); + mozilla::widget::android::GeckoAppShell::AlertsProgressListener_OnProgress(aAlertName, + aProgress, aProgressMax, + aAlertText); return NS_OK; #else return NS_ERROR_NOT_IMPLEMENTED; @@ -159,7 +161,7 @@ NS_IMETHODIMP nsAlertsService::OnProgress(const nsAString & aAlertName, NS_IMETHODIMP nsAlertsService::OnCancel(const nsAString & aAlertName) { #ifdef MOZ_WIDGET_ANDROID - GeckoAppShell::CloseNotification(aAlertName); + mozilla::widget::android::GeckoAppShell::CloseNotification(aAlertName); return NS_OK; #else return NS_ERROR_NOT_IMPLEMENTED; diff --git a/toolkit/components/downloads/nsDownloadManager.cpp b/toolkit/components/downloads/nsDownloadManager.cpp index 0d964bd3418..6e1a9a907a8 100644 --- a/toolkit/components/downloads/nsDownloadManager.cpp +++ b/toolkit/components/downloads/nsDownloadManager.cpp @@ -2806,7 +2806,7 @@ nsDownload::SetState(DownloadState aState) if (mimeInfo) mimeInfo->GetMIMEType(contentType); - GeckoAppShell::ScanMedia(path, NS_ConvertUTF8toUTF16(contentType)); + mozilla::widget::android::GeckoAppShell::ScanMedia(path, NS_ConvertUTF8toUTF16(contentType)); #endif } diff --git a/tools/profiler/TableTicker.cpp b/tools/profiler/TableTicker.cpp index 2f497c8766b..5b63efa3b85 100644 --- a/tools/profiler/TableTicker.cpp +++ b/tools/profiler/TableTicker.cpp @@ -230,7 +230,8 @@ typename Builder::Object BuildJavaThreadJSObject(Builder& b) b.DefineProperty(sample, "frames", frames); b.ArrayPush(samples, sample); - double sampleTime = GeckoJavaSampler::GetSampleTimeJavaProfiling(0, sampleId); + double sampleTime = + mozilla::widget::android::GeckoJavaSampler::GetSampleTimeJavaProfiling(0, sampleId); b.DefineProperty(sample, "time", sampleTime); } typename Builder::RootedObject frame(b.context(), b.CreateObject()); @@ -282,12 +283,12 @@ void TableTicker::BuildJSObject(Builder& b, typename Builder::ObjectHandle profi #if defined(SPS_OS_android) && !defined(MOZ_WIDGET_GONK) if (ProfileJava()) { - GeckoJavaSampler::PauseJavaProfiling(); + mozilla::widget::android::GeckoJavaSampler::PauseJavaProfiling(); typename Builder::RootedObject javaThread(b.context(), BuildJavaThreadJSObject(b)); b.ArrayPush(threads, javaThread); - GeckoJavaSampler::UnpauseJavaProfiling(); + mozilla::widget::android::GeckoJavaSampler::UnpauseJavaProfiling(); } #endif diff --git a/tools/profiler/platform.cpp b/tools/profiler/platform.cpp index 4bebc15b65b..ecff4ae3e19 100644 --- a/tools/profiler/platform.cpp +++ b/tools/profiler/platform.cpp @@ -684,7 +684,7 @@ void mozilla_sampler_start(int aProfileEntries, double aInterval, if (javaInterval < 10) { aInterval = 10; } - GeckoJavaSampler::StartJavaProfiling(javaInterval, 1000); + mozilla::widget::android::GeckoJavaSampler::StartJavaProfiling(javaInterval, 1000); } #endif diff --git a/uriloader/exthandler/android/nsAndroidHandlerApp.cpp b/uriloader/exthandler/android/nsAndroidHandlerApp.cpp index 007378e5f89..c8f6063cc4e 100644 --- a/uriloader/exthandler/android/nsAndroidHandlerApp.cpp +++ b/uriloader/exthandler/android/nsAndroidHandlerApp.cpp @@ -69,14 +69,15 @@ nsAndroidHandlerApp::LaunchWithURI(nsIURI *aURI, nsIInterfaceRequestor *aWindowC { nsCString uriSpec; aURI->GetSpec(uriSpec); - return GeckoAppShell::OpenUriExternal(NS_ConvertUTF8toUTF16(uriSpec), NS_ConvertUTF8toUTF16(mMimeType), mPackageName, mClassName, mAction) ? + return mozilla::widget::android::GeckoAppShell::OpenUriExternal + (NS_ConvertUTF8toUTF16(uriSpec), NS_ConvertUTF8toUTF16(mMimeType), mPackageName, mClassName, mAction) ? NS_OK : NS_ERROR_FAILURE; } NS_IMETHODIMP nsAndroidHandlerApp::Share(const nsAString & data, const nsAString & title) { - return GeckoAppShell::OpenUriExternal(data, NS_ConvertUTF8toUTF16(mMimeType), mPackageName, - mClassName, mAction) ? NS_OK : NS_ERROR_FAILURE; + return mozilla::widget::android::GeckoAppShell::OpenUriExternal(data, NS_ConvertUTF8toUTF16(mMimeType), + mPackageName, mClassName, mAction) ? NS_OK : NS_ERROR_FAILURE; } diff --git a/uriloader/exthandler/android/nsExternalSharingAppService.cpp b/uriloader/exthandler/android/nsExternalSharingAppService.cpp index 058f810414c..f78c6ce7345 100644 --- a/uriloader/exthandler/android/nsExternalSharingAppService.cpp +++ b/uriloader/exthandler/android/nsExternalSharingAppService.cpp @@ -31,7 +31,8 @@ nsExternalSharingAppService::ShareWithDefault(const nsAString & data, { NS_NAMED_LITERAL_STRING(sendAction, "android.intent.action.SEND"); const nsString emptyString = EmptyString(); - return GeckoAppShell::OpenUriExternal(data, mime, emptyString,emptyString, sendAction, title) ? NS_OK : NS_ERROR_FAILURE; + return mozilla::widget::android::GeckoAppShell::OpenUriExternal(data, + mime, emptyString,emptyString, sendAction, title) ? NS_OK : NS_ERROR_FAILURE; } NS_IMETHODIMP diff --git a/uriloader/exthandler/android/nsMIMEInfoAndroid.cpp b/uriloader/exthandler/android/nsMIMEInfoAndroid.cpp index d0d2127a921..713cf7d6395 100644 --- a/uriloader/exthandler/android/nsMIMEInfoAndroid.cpp +++ b/uriloader/exthandler/android/nsMIMEInfoAndroid.cpp @@ -30,7 +30,9 @@ nsMIMEInfoAndroid::LoadUriInternal(nsIURI * aURI) nsCString uriScheme; aURI->GetScheme(uriScheme); - return GeckoAppShell::OpenUriExternal(NS_ConvertUTF8toUTF16(uriSpec), (mType.Equals(uriScheme) || mType.Equals(uriSpec)) ? EmptyString() : NS_ConvertUTF8toUTF16(mType)) ? NS_OK : NS_ERROR_FAILURE; + return mozilla::widget::android::GeckoAppShell::OpenUriExternal(NS_ConvertUTF8toUTF16(uriSpec), + (mType.Equals(uriScheme) || mType.Equals(uriSpec)) ? + EmptyString() : NS_ConvertUTF8toUTF16(mType)) ? NS_OK : NS_ERROR_FAILURE; } @@ -48,7 +50,7 @@ nsMIMEInfoAndroid::GetMimeInfoForMimeType(const nsACString& aMimeType, } nsIHandlerApp* systemDefault = nullptr; - bridge->GetHandlersForMimeType(NS_ConvertUTF8toUTF16(aMimeType), + bridge->GetHandlersForMimeType(NS_ConvertUTF8toUTF16(aMimeType), info->mHandlerApps, &systemDefault); if (systemDefault) @@ -107,7 +109,7 @@ nsMIMEInfoAndroid::GetMimeInfoForURL(const nsACString &aURL, } nsIHandlerApp* systemDefault = nullptr; - bridge->GetHandlersForURL(NS_ConvertUTF8toUTF16(aURL), + bridge->GetHandlersForURL(NS_ConvertUTF8toUTF16(aURL), mimeinfo->mHandlerApps, &systemDefault); if (systemDefault) diff --git a/widget/android/AndroidBridge.cpp b/widget/android/AndroidBridge.cpp index 17a40665032..3ea6cb02a5a 100644 --- a/widget/android/AndroidBridge.cpp +++ b/widget/android/AndroidBridge.cpp @@ -342,7 +342,8 @@ AndroidBridge::GetHandlersForMimeType(const nsAString& aMimeType, JNIEnv *env = GetJNIEnv(); AutoLocalJNIFrame jniFrame(env, 1); - jobjectArray arr = GeckoAppShell::GetHandlersForMimeTypeWrapper(aMimeType, aAction); + jobjectArray arr = + mozilla::widget::android::GeckoAppShell::GetHandlersForMimeTypeWrapper(aMimeType, aAction); if (!arr) return false; @@ -368,7 +369,7 @@ AndroidBridge::GetHandlersForURL(const nsAString& aURL, JNIEnv *env = GetJNIEnv(); AutoLocalJNIFrame jniFrame(env, 1); - jobjectArray arr = GeckoAppShell::GetHandlersForURLWrapper(aURL, aAction); + jobjectArray arr = mozilla::widget::android::GeckoAppShell::GetHandlersForURLWrapper(aURL, aAction); if (!arr) return false; @@ -390,7 +391,8 @@ AndroidBridge::GetMimeTypeFromExtensions(const nsACString& aFileExt, nsCString& JNIEnv *env = GetJNIEnv(); AutoLocalJNIFrame jniFrame(env, 1); - jstring jstrType = GeckoAppShell::GetMimeTypeFromExtensionsWrapper(NS_ConvertUTF8toUTF16(aFileExt)); + jstring jstrType = mozilla::widget::android::GeckoAppShell::GetMimeTypeFromExtensionsWrapper + (NS_ConvertUTF8toUTF16(aFileExt)); if (!jstrType) { return; } @@ -406,7 +408,8 @@ AndroidBridge::GetExtensionFromMimeType(const nsACString& aMimeType, nsACString& JNIEnv *env = GetJNIEnv(); AutoLocalJNIFrame jniFrame(env, 1); - jstring jstrExt = GeckoAppShell::GetExtensionFromMimeTypeWrapper(NS_ConvertUTF8toUTF16(aMimeType)); + jstring jstrExt = mozilla::widget::android::GeckoAppShell::GetExtensionFromMimeTypeWrapper + (NS_ConvertUTF8toUTF16(aMimeType)); if (!jstrExt) { return; } @@ -444,7 +447,8 @@ AndroidBridge::ShowAlertNotification(const nsAString& aImageUrl, nsAppShell::gAppShell->PostEvent(AndroidGeckoEvent::MakeAddObserver(aAlertName, aAlertListener)); } - GeckoAppShell::ShowAlertNotificationWrapper(aImageUrl, aAlertTitle, aAlertText, aAlertCookie, aAlertName); + mozilla::widget::android::GeckoAppShell::ShowAlertNotificationWrapper + (aImageUrl, aAlertTitle, aAlertText, aAlertCookie, aAlertName); } int @@ -456,7 +460,7 @@ AndroidBridge::GetDPI() const int DEFAULT_DPI = 160; - sDPI = GeckoAppShell::GetDpiWrapper(); + sDPI = mozilla::widget::android::GeckoAppShell::GetDpiWrapper(); if (!sDPI) { return DEFAULT_DPI; } @@ -476,7 +480,7 @@ AndroidBridge::GetScreenDepth() const int DEFAULT_DEPTH = 16; if (HasEnv()) { - sDepth = GeckoAppShell::GetScreenDepthWrapper(); + sDepth = mozilla::widget::android::GeckoAppShell::GetScreenDepthWrapper(); } if (!sDepth) return DEFAULT_DEPTH; @@ -484,6 +488,41 @@ AndroidBridge::GetScreenDepth() return sDepth; } +void +AndroidBridge::ShowFilePickerForExtensions(nsAString& aFilePath, const nsAString& aExtensions) +{ + JNIEnv *env = GetJNIEnv(); + + AutoLocalJNIFrame jniFrame(env, 1); + jstring jstr = mozilla::widget::android::GeckoAppShell::ShowFilePickerForExtensionsWrapper(aExtensions); + if (jstr == nullptr) { + return; + } + + aFilePath.Assign(nsJNIString(jstr, env)); +} + +void +AndroidBridge::ShowFilePickerForMimeType(nsAString& aFilePath, const nsAString& aMimeType) +{ + JNIEnv *env = GetJNIEnv(); + + AutoLocalJNIFrame jniFrame(env, 1); + jstring jstr = mozilla::widget::android::GeckoAppShell::ShowFilePickerForMimeTypeWrapper(aMimeType); + if (jstr == nullptr) { + return; + } + + aFilePath.Assign(nsJNIString(jstr, env)); +} + +void +AndroidBridge::ShowFilePickerAsync(const nsAString& aMimeType, nsFilePickerCallback* callback) +{ + callback->AddRef(); + mozilla::widget::android::GeckoAppShell::ShowFilePickerAsyncWrapper(aMimeType, (int64_t) callback); +} + void AndroidBridge::Vibrate(const nsTArray& aPattern) { @@ -507,7 +546,7 @@ AndroidBridge::Vibrate(const nsTArray& aPattern) ALOG_BRIDGE(" invalid vibration duration < 0"); return; } - GeckoAppShell::Vibrate1(d); + mozilla::widget::android::GeckoAppShell::Vibrate1(d); return; } @@ -533,7 +572,7 @@ AndroidBridge::Vibrate(const nsTArray& aPattern) } env->ReleaseLongArrayElements(array, elts, 0); - GeckoAppShell::VibrateA(array, -1/*don't repeat*/); + mozilla::widget::android::GeckoAppShell::VibrateA(array, -1/*don't repeat*/); } void @@ -548,7 +587,7 @@ AndroidBridge::GetSystemColors(AndroidSystemColors *aColors) AutoLocalJNIFrame jniFrame(env, 1); - jintArray arr = GeckoAppShell::GetSystemColoursWrapper(); + jintArray arr = mozilla::widget::android::GeckoAppShell::GetSystemColoursWrapper(); if (!arr) return; @@ -584,7 +623,8 @@ AndroidBridge::GetIconForExtension(const nsACString& aFileExt, uint32_t aIconSiz AutoLocalJNIFrame jniFrame(env, 1); - jbyteArray arr = GeckoAppShell::GetIconForExtensionWrapper(NS_ConvertUTF8toUTF16(aFileExt), aIconSize); + jbyteArray arr = mozilla::widget::android::GeckoAppShell::GetIconForExtensionWrapper + (NS_ConvertUTF8toUTF16(aFileExt), aIconSize); NS_ASSERTION(arr != nullptr, "AndroidBridge::GetIconForExtension: Returned pixels array is null!"); if (!arr) @@ -616,7 +656,7 @@ AndroidBridge::SetLayerClient(JNIEnv* env, jobject jobj) mLayerClient = nullptr; } - mLayerClient = GeckoLayerClient::Wrap(jobj); + mLayerClient = mozilla::widget::android::GeckoLayerClient::Wrap(jobj); if (resetting) { // since we are re-linking the new java objects to Gecko, we need to get @@ -918,7 +958,8 @@ AndroidBridge::InitCamera(const nsCString& contentType, uint32_t camera, uint32_ JNIEnv *env = GetJNIEnv(); AutoLocalJNIFrame jniFrame(env, 1); - jintArray arr = GeckoAppShell::InitCameraWrapper(NS_ConvertUTF8toUTF16(contentType), (int32_t) camera, (int32_t) width, (int32_t) height); + jintArray arr = mozilla::widget::android::GeckoAppShell::InitCameraWrapper + (NS_ConvertUTF8toUTF16(contentType), (int32_t) camera, (int32_t) width, (int32_t) height); if (!arr) return false; @@ -947,7 +988,7 @@ AndroidBridge::GetCurrentBatteryInformation(hal::BatteryInformation* aBatteryInf // To prevent calling too many methods through JNI, the Java method returns // an array of double even if we actually want a double and a boolean. - jdoubleArray arr = GeckoAppShell::GetCurrentBatteryInformationWrapper(); + jdoubleArray arr = mozilla::widget::android::GeckoAppShell::GetCurrentBatteryInformationWrapper(); if (!arr || env->GetArrayLength(arr) != 3) { return; } @@ -969,7 +1010,7 @@ AndroidBridge::HandleGeckoMessage(const nsAString &aMessage) JNIEnv *env = GetJNIEnv(); AutoLocalJNIFrame jniFrame(env, 1); - GeckoAppShell::HandleGeckoMessageWrapper(aMessage); + jstring returnMessage = mozilla::widget::android::GeckoAppShell::HandleGeckoMessageWrapper(aMessage); } nsresult @@ -1027,7 +1068,7 @@ AndroidBridge::SendMessage(const nsAString& aNumber, if (!QueueSmsRequest(aRequest, &requestId)) return; - GeckoAppShell::SendMessageWrapper(aNumber, aMessage, requestId); + mozilla::widget::android::GeckoAppShell::SendMessageWrapper(aNumber, aMessage, requestId); } void @@ -1039,7 +1080,7 @@ AndroidBridge::GetMessage(int32_t aMessageId, nsIMobileMessageCallback* aRequest if (!QueueSmsRequest(aRequest, &requestId)) return; - GeckoAppShell::GetMessageWrapper(aMessageId, requestId); + mozilla::widget::android::GeckoAppShell::GetMessageWrapper(aMessageId, requestId); } void @@ -1051,7 +1092,7 @@ AndroidBridge::DeleteMessage(int32_t aMessageId, nsIMobileMessageCallback* aRequ if (!QueueSmsRequest(aRequest, &requestId)) return; - GeckoAppShell::DeleteMessageWrapper(aMessageId, requestId); + mozilla::widget::android::GeckoAppShell::DeleteMessageWrapper(aMessageId, requestId); } void @@ -1079,8 +1120,8 @@ AndroidBridge::CreateMessageList(const dom::mobilemessage::SmsFilterData& aFilte env->DeleteLocalRef(elem); } - GeckoAppShell::CreateMessageListWrapper(aFilter.startDate(), aFilter.endDate(), - numbers, aFilter.numbers().Length(), + mozilla::widget::android::GeckoAppShell::CreateMessageListWrapper(aFilter.startDate(), + aFilter.endDate(), numbers, aFilter.numbers().Length(), aFilter.delivery(), aReverse, requestId); } @@ -1093,7 +1134,7 @@ AndroidBridge::GetNextMessageInList(int32_t aListId, nsIMobileMessageCallback* a if (!QueueSmsRequest(aRequest, &requestId)) return; - GeckoAppShell::GetNextMessageInListWrapper(aListId, requestId); + mozilla::widget::android::GeckoAppShell::GetNextMessageInListWrapper(aListId, requestId); } bool @@ -1143,7 +1184,7 @@ AndroidBridge::GetCurrentNetworkInformation(hal::NetworkInformation* aNetworkInf // To prevent calling too many methods through JNI, the Java method returns // an array of double even if we actually want a double, two booleans, and an integer. - jdoubleArray arr = GeckoAppShell::GetCurrentNetworkInformationWrapper(); + jdoubleArray arr = mozilla::widget::android::GeckoAppShell::GetCurrentNetworkInformationWrapper(); if (!arr || env->GetArrayLength(arr) != 4) { return; } @@ -1330,7 +1371,7 @@ AndroidBridge::GetGlobalContextRef() { AutoLocalJNIFrame jniFrame(env, 4); - jobject context = GeckoAppShell::GetContext(); + jobject context = mozilla::widget::android::GeckoAppShell::GetContext(); if (!context) { ALOG_BRIDGE("%s: Could not GetContext()", __FUNCTION__); return 0; @@ -1381,7 +1422,7 @@ AndroidBridge::UnlockWindow(void* window) void AndroidBridge::SetFirstPaintViewport(const LayerIntPoint& aOffset, const CSSToLayerScale& aZoom, const CSSRect& aCssPageRect) { - GeckoLayerClient *client = mLayerClient; + mozilla::widget::android::GeckoLayerClient *client = mLayerClient; if (!client) return; @@ -1392,7 +1433,7 @@ AndroidBridge::SetFirstPaintViewport(const LayerIntPoint& aOffset, const CSSToLa void AndroidBridge::SetPageRect(const CSSRect& aCssPageRect) { - GeckoLayerClient *client = mLayerClient; + mozilla::widget::android::GeckoLayerClient *client = mLayerClient; if (!client) return; @@ -1404,7 +1445,7 @@ AndroidBridge::SyncViewportInfo(const LayerIntRect& aDisplayPort, const CSSToLay bool aLayersUpdated, ScreenPoint& aScrollOffset, CSSToScreenScale& aScale, LayerMargin& aFixedLayerMargins, ScreenPoint& aOffset) { - GeckoLayerClient *client = mLayerClient; + mozilla::widget::android::GeckoLayerClient *client = mLayerClient; if (!client) { ALOG_BRIDGE("Exceptional Exit: %s", __PRETTY_FUNCTION__); return; @@ -1435,7 +1476,7 @@ void AndroidBridge::SyncFrameMetrics(const ScreenPoint& aScrollOffset, float aZo bool aLayersUpdated, const CSSRect& aDisplayPort, const CSSToLayerScale& aDisplayResolution, bool aIsFirstPaint, LayerMargin& aFixedLayerMargins, ScreenPoint& aOffset) { - GeckoLayerClient *client = mLayerClient; + mozilla::widget::android::GeckoLayerClient *client = mLayerClient; if (!client) { ALOG_BRIDGE("Exceptional Exit: %s", __PRETTY_FUNCTION__); return; @@ -1543,7 +1584,7 @@ AndroidBridge::GetScreenOrientation() { ALOG_BRIDGE("AndroidBridge::GetScreenOrientation"); - int16_t orientation = GeckoAppShell::GetScreenOrientationWrapper(); + int16_t orientation = mozilla::widget::android::GeckoAppShell::GetScreenOrientationWrapper(); if (!orientation) return dom::eScreenOrientation_None; @@ -1570,10 +1611,11 @@ AndroidBridge::GetProxyForURI(const nsACString & aSpec, JNIEnv* env = GetJNIEnv(); AutoLocalJNIFrame jniFrame(env, 1); - jstring jstrRet = GeckoAppShell::GetProxyForURIWrapper(NS_ConvertUTF8toUTF16(aSpec), - NS_ConvertUTF8toUTF16(aScheme), - NS_ConvertUTF8toUTF16(aHost), - aPort); + jstring jstrRet = + mozilla::widget::android::GeckoAppShell::GetProxyForURIWrapper(NS_ConvertUTF8toUTF16(aSpec), + NS_ConvertUTF8toUTF16(aScheme), + NS_ConvertUTF8toUTF16(aHost), + aPort); if (!jstrRet) return NS_ERROR_FAILURE; @@ -1606,7 +1648,8 @@ AndroidBridge::AddPluginView(jobject view, const LayoutDeviceRect& rect, bool is return; CSSRect cssRect = rect / win->GetDefaultScale(); - GeckoAppShell::AddPluginViewWrapper(view, cssRect.x, cssRect.y, cssRect.width, cssRect.height, isFullScreen); + mozilla::widget::android::GeckoAppShell::AddPluginViewWrapper(view, cssRect.x, cssRect.y, + cssRect.width, cssRect.height, isFullScreen); } extern "C" @@ -1621,7 +1664,8 @@ AndroidBridge::GetThreadNameJavaProfiling(uint32_t aThreadId, nsCString & aResul AutoLocalJNIFrame jniFrame(env, 1); - jstring jstrThreadName = GeckoJavaSampler::GetThreadNameJavaProfilingWrapper(aThreadId); + jstring jstrThreadName = + mozilla::widget::android::GeckoJavaSampler::GetThreadNameJavaProfilingWrapper(aThreadId); if (!jstrThreadName) return false; @@ -1639,7 +1683,8 @@ AndroidBridge::GetFrameNameJavaProfiling(uint32_t aThreadId, uint32_t aSampleId, AutoLocalJNIFrame jniFrame(env, 1); - jstring jstrSampleName = GeckoJavaSampler::GetFrameNameJavaProfilingWrapper(aThreadId, aSampleId, aFrameId); + jstring jstrSampleName = mozilla::widget::android::GeckoJavaSampler::GetFrameNameJavaProfilingWrapper + (aThreadId, aSampleId, aFrameId); if (!jstrSampleName) return false; @@ -1837,7 +1882,7 @@ AndroidBridge::IsContentDocumentDisplayed() bool AndroidBridge::ProgressiveUpdateCallback(bool aHasPendingNewThebesContent, const LayerRect& aDisplayPort, float aDisplayResolution, bool aDrawingCritical, ScreenRect& aCompositionBounds, CSSToScreenScale& aZoom) { - GeckoLayerClient *client = mLayerClient; + mozilla::widget::android::GeckoLayerClient *client = mLayerClient; if (!client) { ALOG_BRIDGE("Exceptional Exit: %s", __PRETTY_FUNCTION__); return false; @@ -1867,11 +1912,11 @@ AndroidBridge::ProgressiveUpdateCallback(bool aHasPendingNewThebesContent, const return ret; } -NativePanZoomController* +mozilla::widget::android::NativePanZoomController* AndroidBridge::SetNativePanZoomController(jobject obj) { - NativePanZoomController* old = mNativePanZoomController; - mNativePanZoomController = NativePanZoomController::Wrap(obj); + mozilla::widget::android::NativePanZoomController* old = mNativePanZoomController; + mNativePanZoomController = mozilla::widget::android::NativePanZoomController::Wrap(obj); return old; } diff --git a/widget/android/AndroidBridge.h b/widget/android/AndroidBridge.h index 216b0e0ee76..9cfa46d51a4 100644 --- a/widget/android/AndroidBridge.h +++ b/widget/android/AndroidBridge.h @@ -48,8 +48,6 @@ class Thread; typedef void* EGLSurface; -using namespace mozilla::widget::android; - namespace mozilla { namespace hal { @@ -181,7 +179,7 @@ public: jthrowable e = aEnv->ExceptionOccurred(); MOZ_ASSERT(e); aEnv->ExceptionClear(); - GeckoAppShell::HandleUncaughtException(nullptr, e); + mozilla::widget::android::GeckoAppShell::HandleUncaughtException(nullptr, e); // Should be dead by now... MOZ_CRASH("Failed to handle uncaught exception"); } @@ -205,7 +203,7 @@ public: bool ProgressiveUpdateCallback(bool aHasPendingNewThebesContent, const LayerRect& aDisplayPort, float aDisplayResolution, bool aDrawingCritical, ScreenRect& aCompositionBounds, CSSToScreenScale& aZoom); void SetLayerClient(JNIEnv* env, jobject jobj); - GeckoLayerClient* GetLayerClient() { return mLayerClient; } + mozilla::widget::android::GeckoLayerClient* GetLayerClient() { return mLayerClient; } bool GetHandlersForURL(const nsAString& aURL, nsIMutableArray* handlersArray = nullptr, @@ -356,7 +354,7 @@ protected: JNIEnv *mJNIEnv; pthread_t mThread; - GeckoLayerClient *mLayerClient; + mozilla::widget::android::GeckoLayerClient *mLayerClient; // the android.telephony.SmsMessage class jclass mAndroidSmsMessageClass; @@ -397,7 +395,7 @@ protected: jclass jLayerView; jfieldID jEGLSurfacePointerField; - GLController *mGLControllerObj; + mozilla::widget::android::GLController *mGLControllerObj; // some convinient types to have around jclass jStringClass; @@ -421,14 +419,14 @@ protected: void (* Region_set)(void* region, void* rect); private: - NativePanZoomController* mNativePanZoomController; + mozilla::widget::android::NativePanZoomController* mNativePanZoomController; // This will always be accessed from one thread (the APZC "controller" // thread, which is the Java UI thread), so we don't need to do locking // to touch it nsTArray mDelayedTaskQueue; public: - NativePanZoomController* SetNativePanZoomController(jobject obj); + mozilla::widget::android::NativePanZoomController* SetNativePanZoomController(jobject obj); // GeckoContentController methods void RequestContentRepaint(const mozilla::layers::FrameMetrics& aFrameMetrics) MOZ_OVERRIDE; void AcknowledgeScrollUpdate(const mozilla::layers::FrameMetrics::ViewID& aScrollId, diff --git a/widget/android/AndroidJNI.cpp b/widget/android/AndroidJNI.cpp index c92705785b3..9dd1805e561 100644 --- a/widget/android/AndroidJNI.cpp +++ b/widget/android/AndroidJNI.cpp @@ -47,6 +47,7 @@ using namespace mozilla; using namespace mozilla::dom; using namespace mozilla::dom::mobilemessage; using namespace mozilla::layers; +using namespace mozilla::widget::android; /* Forward declare all the JNI methods as extern "C" */ diff --git a/widget/android/nsAppShell.cpp b/widget/android/nsAppShell.cpp index 58fa05937f6..85786e754f3 100644 --- a/widget/android/nsAppShell.cpp +++ b/widget/android/nsAppShell.cpp @@ -82,20 +82,20 @@ public: nsCOMPtr tab; mBrowserApp->GetBrowserTab(mTabId, getter_AddRefs(tab)); if (!tab) { - ThumbnailHelper::SendThumbnail(buffer, mTabId, false); + mozilla::widget::android::ThumbnailHelper::SendThumbnail(buffer, mTabId, false); return NS_ERROR_FAILURE; } tab->GetWindow(getter_AddRefs(domWindow)); if (!domWindow) { - ThumbnailHelper::SendThumbnail(buffer, mTabId, false); + mozilla::widget::android::ThumbnailHelper::SendThumbnail(buffer, mTabId, false); return NS_ERROR_FAILURE; } NS_ASSERTION(mPoints.Length() == 1, "Thumbnail event does not have enough coordinates"); nsresult rv = AndroidBridge::Bridge()->CaptureThumbnail(domWindow, mPoints[0].x, mPoints[0].y, mTabId, buffer); - ThumbnailHelper::SendThumbnail(buffer, mTabId, NS_SUCCEEDED(rv)); + mozilla::widget::android::ThumbnailHelper::SendThumbnail(buffer, mTabId, NS_SUCCEEDED(rv)); return rv; } private: @@ -110,7 +110,7 @@ class WakeLockListener MOZ_FINAL : public nsIDOMMozWakeLockListener { NS_DECL_ISUPPORTS; nsresult Callback(const nsAString& topic, const nsAString& state) { - GeckoAppShell::NotifyWakeLockChanged(topic, state); + mozilla::widget::android::GeckoAppShell::NotifyWakeLockChanged(topic, state); return NS_OK; } }; @@ -268,7 +268,7 @@ nsAppShell::ProcessNextNativeEvent(bool mayWait) // in w3c spec case hal::SENSOR_ORIENTATION: values.AppendElement(360 -curEvent->X()); - values.AppendElement(-curEvent->Y()); + values.AppendElement(-curEvent->Y()); values.AppendElement(-curEvent->Z()); break; case hal::SENSOR_LINEAR_ACCELERATION: @@ -276,7 +276,7 @@ nsAppShell::ProcessNextNativeEvent(bool mayWait) case hal::SENSOR_GYROSCOPE: case hal::SENSOR_PROXIMITY: values.AppendElement(curEvent->X()); - values.AppendElement(curEvent->Y()); + values.AppendElement(curEvent->Y()); values.AppendElement(curEvent->Z()); break; @@ -600,7 +600,7 @@ nsAppShell::ProcessNextNativeEvent(bool mayWait) } if (curEvent->AckNeeded()) { - GeckoAppShell::AcknowledgeEvent(); + mozilla::widget::android::GeckoAppShell::AcknowledgeEvent(); } EVLOG("nsAppShell: -- done event %p %d", (void*)curEvent.get(), curEvent->Type()); diff --git a/widget/android/nsClipboard.cpp b/widget/android/nsClipboard.cpp index 617bfa743b6..e4f0685b8b5 100644 --- a/widget/android/nsClipboard.cpp +++ b/widget/android/nsClipboard.cpp @@ -43,8 +43,14 @@ nsClipboard::SetData(nsITransferable *aTransferable, nsAutoString buffer; supportsString->GetData(buffer); - Clipboard::SetClipboardText(buffer); - + if (XRE_GetProcessType() == GeckoProcessType_Default) { + mozilla::widget::android::Clipboard::SetClipboardText(buffer); + }else{ + bool isPrivateData = false; + aTransferable->GetIsPrivateData(&isPrivateData); + ContentChild::GetSingleton()->SendSetClipboardText(buffer, isPrivateData, + aWhichClipboard); + } return NS_OK; } @@ -85,8 +91,11 @@ nsClipboard::EmptyClipboard(int32_t aWhichClipboard) { if (aWhichClipboard != kGlobalClipboard) return NS_ERROR_NOT_IMPLEMENTED; - Clipboard::ClearText(); - + if (XRE_GetProcessType() == GeckoProcessType_Default) { + mozilla::widget::android::Clipboard::ClearText(); + } else { + ContentChild::GetSingleton()->SendEmptyClipboard(); + } return NS_OK; } @@ -98,7 +107,11 @@ nsClipboard::HasDataMatchingFlavors(const char **aFlavorList, *aHasText = false; if (aWhichClipboard != kGlobalClipboard) return NS_ERROR_NOT_IMPLEMENTED; - *aHasText = Clipboard::HasText(); + if (XRE_GetProcessType() == GeckoProcessType_Default) { + *aHasText = mozilla::widget::android::Clipboard::HasText(); + } else { + ContentChild::GetSingleton()->SendClipboardHasText(aHasText); + } return NS_OK; } diff --git a/widget/android/nsIMEPicker.cpp b/widget/android/nsIMEPicker.cpp index ac7f58f5d49..098bf331e93 100644 --- a/widget/android/nsIMEPicker.cpp +++ b/widget/android/nsIMEPicker.cpp @@ -22,6 +22,6 @@ nsIMEPicker::~nsIMEPicker() /* void show (); */ NS_IMETHODIMP nsIMEPicker::Show() { - GeckoAppShell::ShowInputMethodPicker(); + mozilla::widget::android::GeckoAppShell::ShowInputMethodPicker(); return NS_OK; } diff --git a/widget/android/nsLookAndFeel.cpp b/widget/android/nsLookAndFeel.cpp index 97ae10b0952..e226c3d9e22 100644 --- a/widget/android/nsLookAndFeel.cpp +++ b/widget/android/nsLookAndFeel.cpp @@ -470,7 +470,7 @@ nsLookAndFeel::GetEchoPasswordImpl() { if (!mInitializedShowPassword) { if (XRE_GetProcessType() == GeckoProcessType_Default) { - mShowPassword = GeckoAppShell::GetShowPasswordSetting(); + mShowPassword = mozilla::widget::android::GeckoAppShell::GetShowPasswordSetting(); } else { ContentChild::GetSingleton()->SendGetShowPasswordSetting(&mShowPassword); } diff --git a/widget/android/nsScreenManagerAndroid.cpp b/widget/android/nsScreenManagerAndroid.cpp index b892e5be8b6..cbc83eb2af2 100644 --- a/widget/android/nsScreenManagerAndroid.cpp +++ b/widget/android/nsScreenManagerAndroid.cpp @@ -59,7 +59,7 @@ nsScreenAndroid::GetColorDepth(int32_t *aColorDepth) void nsScreenAndroid::ApplyMinimumBrightness(uint32_t aBrightness) { - GeckoAppShell::SetKeepScreenOn(aBrightness == BRIGHTNESS_FULL); + mozilla::widget::android::GeckoAppShell::SetKeepScreenOn(aBrightness == BRIGHTNESS_FULL); } NS_IMPL_ISUPPORTS1(nsScreenManagerAndroid, nsIScreenManager) diff --git a/widget/android/nsWindow.cpp b/widget/android/nsWindow.cpp index 7df417049b1..05c35c8dd80 100644 --- a/widget/android/nsWindow.cpp +++ b/widget/android/nsWindow.cpp @@ -352,7 +352,7 @@ nsWindow::GetDefaultScaleInternal() return density; } - density = GeckoAppShell::GetDensity(); + density = mozilla::widget::android::GeckoAppShell::GetDensity(); if (!density) { density = 1.0; @@ -516,7 +516,7 @@ nsWindow::SetSizeMode(int32_t aMode) { switch (aMode) { case nsSizeMode_Minimized: - GeckoAppShell::MoveTaskToBack(); + mozilla::widget::android::GeckoAppShell::MoveTaskToBack(); break; case nsSizeMode_Fullscreen: MakeFullScreen(true); @@ -694,7 +694,7 @@ nsWindow::DispatchEvent(WidgetGUIEvent* aEvent) NS_IMETHODIMP nsWindow::MakeFullScreen(bool aFullScreen) { - GeckoAppShell::SetFullScreen(aFullScreen); + mozilla::widget::android::GeckoAppShell::SetFullScreen(aFullScreen); return NS_OK; } @@ -1195,7 +1195,7 @@ bool nsWindow::OnMultitouchEvent(AndroidGeckoEvent *ae) // if this event is a down event, that means it's the start of a new block, and the // previous block should not be default-prevented bool defaultPrevented = isDownEvent ? false : preventDefaultActions; - GeckoAppShell::NotifyDefaultPrevented(defaultPrevented); + mozilla::widget::android::GeckoAppShell::NotifyDefaultPrevented(defaultPrevented); sDefaultPreventedNotified = true; } @@ -1204,7 +1204,7 @@ bool nsWindow::OnMultitouchEvent(AndroidGeckoEvent *ae) // for the next event. if (isDownEvent) { if (preventDefaultActions) { - GeckoAppShell::NotifyDefaultPrevented(true); + mozilla::widget::android::GeckoAppShell::NotifyDefaultPrevented(true); sDefaultPreventedNotified = true; } else { sDefaultPreventedNotified = false; @@ -1840,10 +1840,10 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *ae) NotifyIMEOfTextChange(notification); FlushIMEChanges(); } - GeckoAppShell::NotifyIME(AndroidBridge::NOTIFY_IME_REPLY_EVENT); + mozilla::widget::android::GeckoAppShell::NotifyIME(AndroidBridge::NOTIFY_IME_REPLY_EVENT); return; } else if (ae->Action() == AndroidGeckoEvent::IME_UPDATE_CONTEXT) { - GeckoAppShell::NotifyIMEContext(mInputContext.mIMEState.mEnabled, + mozilla::widget::android::GeckoAppShell::NotifyIMEContext(mInputContext.mIMEState.mEnabled, mInputContext.mHTMLInputType, mInputContext.mHTMLInputInputmode, mInputContext.mActionHint); @@ -1854,7 +1854,7 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *ae) // Still reply to events, but don't do anything else if (ae->Action() == AndroidGeckoEvent::IME_SYNCHRONIZE || ae->Action() == AndroidGeckoEvent::IME_REPLACE_TEXT) { - GeckoAppShell::NotifyIME(AndroidBridge::NOTIFY_IME_REPLY_EVENT); + mozilla::widget::android::GeckoAppShell::NotifyIME(AndroidBridge::NOTIFY_IME_REPLY_EVENT); } return; } @@ -1867,7 +1867,7 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *ae) case AndroidGeckoEvent::IME_SYNCHRONIZE: { FlushIMEChanges(); - GeckoAppShell::NotifyIME(AndroidBridge::NOTIFY_IME_REPLY_EVENT); + mozilla::widget::android::GeckoAppShell::NotifyIME(AndroidBridge::NOTIFY_IME_REPLY_EVENT); } break; case AndroidGeckoEvent::IME_REPLACE_TEXT: @@ -1899,7 +1899,7 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *ae) } mIMEKeyEvents.Clear(); FlushIMEChanges(); - GeckoAppShell::NotifyIME(AndroidBridge::NOTIFY_IME_REPLY_EVENT); + mozilla::widget::android::GeckoAppShell::NotifyIME(AndroidBridge::NOTIFY_IME_REPLY_EVENT); break; } @@ -1927,7 +1927,7 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *ae) DispatchEvent(&event); } FlushIMEChanges(); - GeckoAppShell::NotifyIME(AndroidBridge::NOTIFY_IME_REPLY_EVENT); + mozilla::widget::android::GeckoAppShell::NotifyIME(AndroidBridge::NOTIFY_IME_REPLY_EVENT); } break; case AndroidGeckoEvent::IME_SET_SELECTION: @@ -2116,7 +2116,7 @@ nsWindow::NotifyIME(const IMENotification& aIMENotification) case REQUEST_TO_COMMIT_COMPOSITION: //ALOGIME("IME: REQUEST_TO_COMMIT_COMPOSITION: s=%d", aState); RemoveIMEComposition(); - GeckoAppShell::NotifyIME(REQUEST_TO_COMMIT_COMPOSITION); + mozilla::widget::android::GeckoAppShell::NotifyIME(REQUEST_TO_COMMIT_COMPOSITION); return NS_OK; case REQUEST_TO_CANCEL_COMPOSITION: ALOGIME("IME: REQUEST_TO_CANCEL_COMPOSITION"); @@ -2140,11 +2140,11 @@ nsWindow::NotifyIME(const IMENotification& aIMENotification) DispatchEvent(&compEvent); } - GeckoAppShell::NotifyIME(REQUEST_TO_CANCEL_COMPOSITION); + mozilla::widget::android::GeckoAppShell::NotifyIME(REQUEST_TO_CANCEL_COMPOSITION); return NS_OK; case NOTIFY_IME_OF_FOCUS: ALOGIME("IME: NOTIFY_IME_OF_FOCUS"); - GeckoAppShell::NotifyIME(NOTIFY_IME_OF_FOCUS); + mozilla::widget::android::GeckoAppShell::NotifyIME(NOTIFY_IME_OF_FOCUS); return NS_OK; case NOTIFY_IME_OF_BLUR: ALOGIME("IME: NOTIFY_IME_OF_BLUR"); @@ -2156,7 +2156,7 @@ nsWindow::NotifyIME(const IMENotification& aIMENotification) mIMEComposing = false; mIMEComposingText.Truncate(); - GeckoAppShell::NotifyIME(NOTIFY_IME_OF_BLUR); + mozilla::widget::android::GeckoAppShell::NotifyIME(NOTIFY_IME_OF_BLUR); return NS_OK; case NOTIFY_IME_OF_SELECTION_CHANGE: if (mIMEMaskSelectionUpdate) { @@ -2218,7 +2218,7 @@ nsWindow::SetInputContext(const InputContext& aContext, if (enabled == IMEState::ENABLED && aAction.UserMightRequestOpenVKB()) { // Don't reset keyboard when we should simply open the vkb - GeckoAppShell::NotifyIME(AndroidBridge::NOTIFY_IME_OPEN_VKB); + mozilla::widget::android::GeckoAppShell::NotifyIME(AndroidBridge::NOTIFY_IME_OPEN_VKB); return; } @@ -2274,7 +2274,7 @@ nsWindow::FlushIMEChanges() if (!event.mSucceeded) return; - GeckoAppShell::NotifyIMEChange(event.mReply.mString, + mozilla::widget::android::GeckoAppShell::NotifyIMEChange(event.mReply.mString, change.mStart, change.mOldEnd, change.mNewEnd); @@ -2289,7 +2289,7 @@ nsWindow::FlushIMEChanges() if (!event.mSucceeded) return; - GeckoAppShell::NotifyIMEChange(EmptyString(), + mozilla::widget::android::GeckoAppShell::NotifyIMEChange(EmptyString(), (int32_t) event.GetSelectionStart(), (int32_t) event.GetSelectionEnd(), -1); mIMESelectionChanged = false; @@ -2391,7 +2391,7 @@ nsWindow::DrawWindowUnderlay(LayerManagerComposite* aManager, nsIntRect aRect) AutoLocalJNIFrame jniFrame(env); - GeckoLayerClient* client = AndroidBridge::Bridge()->GetLayerClient(); + mozilla::widget::android::GeckoLayerClient* client = AndroidBridge::Bridge()->GetLayerClient(); if (!client || client->isNull()) { ALOG_BRIDGE("Exceptional Exit: %s", __PRETTY_FUNCTION__); return; @@ -2430,7 +2430,7 @@ nsWindow::DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect) NS_ABORT_IF_FALSE(!mLayerRendererFrame.isNull(), "Frame should have been created in DrawWindowUnderlay()!"); - GeckoLayerClient* client = AndroidBridge::Bridge()->GetLayerClient(); + mozilla::widget::android::GeckoLayerClient* client = AndroidBridge::Bridge()->GetLayerClient(); gl::GLContext* gl = static_cast(aManager->GetCompositor())->gl(); gl::ScopedGLState scopedScissorTestState(gl, LOCAL_GL_SCISSOR_TEST); diff --git a/widget/windows/winrt/ToastNotificationHandler.cpp b/widget/windows/winrt/ToastNotificationHandler.cpp index 8e4b0ec724f..0134efbd920 100644 --- a/widget/windows/winrt/ToastNotificationHandler.cpp +++ b/widget/windows/winrt/ToastNotificationHandler.cpp @@ -27,9 +27,10 @@ ToastNotificationHandler::DisplayNotification(HSTRING title, { mCookie = aCookie; - ComPtr toastXml = InitializeXmlForTemplate(ToastTemplateType::ToastTemplateType_ToastImageAndText03); - ComPtr toastTextElements, toastImageElements; - ComPtr titleTextNodeRoot, msgTextNodeRoot, imageNodeRoot, srcAttribute; + Microsoft::WRL::ComPtr toastXml = + InitializeXmlForTemplate(ToastTemplateType::ToastTemplateType_ToastImageAndText03); + Microsoft::WRL::ComPtr toastTextElements, toastImageElements; + Microsoft::WRL::ComPtr titleTextNodeRoot, msgTextNodeRoot, imageNodeRoot, srcAttribute; HSTRING textNodeStr, imageNodeStr, srcNodeStr; HSTRING_HEADER textHeader, imageHeader, srcHeader; @@ -43,7 +44,7 @@ ToastNotificationHandler::DisplayNotification(HSTRING title, AssertRetHRESULT(toastTextElements->Item(1, &msgTextNodeRoot), false); AssertRetHRESULT(toastImageElements->Item(0, &imageNodeRoot), false); - ComPtr attributes; + Microsoft::WRL::ComPtr attributes; AssertRetHRESULT(imageNodeRoot->get_Attributes(&attributes), false); AssertRetHRESULT(attributes->GetNamedItem(srcNodeStr, &srcAttribute), false); @@ -62,9 +63,10 @@ ToastNotificationHandler::DisplayTextNotification(HSTRING title, { mCookie = aCookie; - ComPtr toastXml = InitializeXmlForTemplate(ToastTemplateType::ToastTemplateType_ToastText03); - ComPtr toastTextElements; - ComPtr titleTextNodeRoot, msgTextNodeRoot; + Microsoft::WRL::ComPtr toastXml = + InitializeXmlForTemplate(ToastTemplateType::ToastTemplateType_ToastText03); + Microsoft::WRL::ComPtr toastTextElements; + Microsoft::WRL::ComPtr titleTextNodeRoot, msgTextNodeRoot; HSTRING textNodeStr; HSTRING_HEADER textHeader; @@ -80,9 +82,9 @@ ToastNotificationHandler::DisplayTextNotification(HSTRING title, return CreateWindowsNotificationFromXml(toastXml.Get(), aAppId); } -ComPtr +Microsoft::WRL::ComPtr ToastNotificationHandler::InitializeXmlForTemplate(ToastTemplateType templateType) { - ComPtr toastXml; + Microsoft::WRL::ComPtr toastXml; AssertRetHRESULT(GetActivationFactory(HStringReference(RuntimeClass_Windows_UI_Notifications_ToastNotificationManager).Get(), mToastNotificationManagerStatics.GetAddressOf()), nullptr); @@ -96,8 +98,8 @@ bool ToastNotificationHandler::CreateWindowsNotificationFromXml(IXmlDocument *toastXml, const nsAString& aAppId) { - ComPtr notification; - ComPtr factory; + Microsoft::WRL::ComPtr notification; + Microsoft::WRL::ComPtr factory; AssertRetHRESULT(GetActivationFactory(HStringReference(RuntimeClass_Windows_UI_Notifications_ToastNotification).Get(), factory.GetAddressOf()), false); AssertRetHRESULT(factory->CreateToastNotification(toastXml, ¬ification), @@ -110,7 +112,7 @@ ToastNotificationHandler::CreateWindowsNotificationFromXml(IXmlDocument *toastXm AssertRetHRESULT(notification->add_Dismissed(Callback(this, &ToastNotificationHandler::OnDismiss).Get(), &dismissedToken), false); - ComPtr notifier; + Microsoft::WRL::ComPtr notifier; if (aAppId.IsEmpty()) { AssertRetHRESULT(mToastNotificationManagerStatics->CreateToastNotifier( ¬ifier), false); @@ -126,9 +128,10 @@ ToastNotificationHandler::CreateWindowsNotificationFromXml(IXmlDocument *toastXm return true; } -void ToastNotificationHandler::SetNodeValueString(HSTRING inputString, ComPtr node, ComPtr xml) { - ComPtr inputText; - ComPtr inputTextNode, pAppendedChild; +void ToastNotificationHandler::SetNodeValueString(HSTRING inputString, + Microsoft::WRL::ComPtr node, Microsoft::WRL::ComPtr xml) { + Microsoft::WRL::ComPtr inputText; + Microsoft::WRL::ComPtr inputTextNode, pAppendedChild; AssertHRESULT(xml->CreateTextNode(inputString, &inputText)); AssertHRESULT(inputText.As(&inputTextNode)); diff --git a/widget/windows/winrt/ToastNotificationHandler.h b/widget/windows/winrt/ToastNotificationHandler.h index a0b8c729079..4935f8d4a06 100644 --- a/widget/windows/winrt/ToastNotificationHandler.h +++ b/widget/windows/winrt/ToastNotificationHandler.h @@ -10,7 +10,6 @@ #include "mozwrlbase.h" #include "nsString.h" -using namespace Microsoft::WRL; class ToastNotificationHandler { typedef ABI::Windows::UI::Notifications::IToastNotification IToastNotification; @@ -20,7 +19,8 @@ class ToastNotificationHandler { typedef ABI::Windows::Data::Xml::Dom::IXmlNode IXmlNode; typedef ABI::Windows::Data::Xml::Dom::IXmlDocument IXmlDocument; - void SetNodeValueString(HSTRING inputString, ComPtr node, ComPtr xml); + void SetNodeValueString(HSTRING inputString,Microsoft::WRL::ComPtr node, + Microsoft::WRL::ComPtr xml); public: ToastNotificationHandler() {}; ~ToastNotificationHandler() {}; @@ -36,9 +36,9 @@ class ToastNotificationHandler { private: nsString mCookie; - ComPtr mToastNotificationManagerStatics; + Microsoft::WRL::ComPtr mToastNotificationManagerStatics; bool CreateWindowsNotificationFromXml(IXmlDocument *toastXml, const nsAString& aAppId); - ComPtr InitializeXmlForTemplate(ToastTemplateType templateType); + Microsoft::WRL::ComPtr InitializeXmlForTemplate(ToastTemplateType templateType); }; diff --git a/widget/windows/winrt/UIABridgePrivate.h b/widget/windows/winrt/UIABridgePrivate.h index 7f2c02e0fc1..41256cbb616 100644 --- a/widget/windows/winrt/UIABridgePrivate.h +++ b/widget/windows/winrt/UIABridgePrivate.h @@ -24,11 +24,10 @@ namespace mozilla { namespace widget { namespace winrt { -using namespace Microsoft::WRL; - // represents the root window to UIA [uuid("D3EDD951-0715-4501-A8E5-25D97EF35D5A")] -class UIABridge : public RuntimeClass, +class UIABridge : public Microsoft::WRL::RuntimeClass, IUIABridge, IUIAElement, IRawElementProviderSimple, @@ -81,7 +80,8 @@ private: }; [uuid("4438135F-F624-43DE-A417-275CE7A1A0CD")] -class UIATextElement : public RuntimeClass, +class UIATextElement : public Microsoft::WRL::RuntimeClass, IUIAElement, IRawElementProviderSimple, IRawElementProviderFragment, diff --git a/xpcom/base/nsSystemInfo.cpp b/xpcom/base/nsSystemInfo.cpp index 5d8a0b6cfaf..fddb7ff1477 100644 --- a/xpcom/base/nsSystemInfo.cpp +++ b/xpcom/base/nsSystemInfo.cpp @@ -267,7 +267,7 @@ nsSystemInfo::Init() android_sdk_version = version; if (version >= 8 && mozilla::AndroidBridge::Bridge()->GetStaticStringField("android/os/Build", "HARDWARE", str)) SetPropertyAsAString(NS_LITERAL_STRING("hardware"), str); - bool isTablet = GeckoAppShell::IsTablet(); + bool isTablet = mozilla::widget::android::GeckoAppShell::IsTablet(); SetPropertyAsBool(NS_LITERAL_STRING("tablet"), isTablet); // NSPR "version" is the kernel version. For Android we want the Android version. // Rename SDK version to version and put the kernel version into kernel_version. diff --git a/xpcom/io/nsLocalFileUnix.cpp b/xpcom/io/nsLocalFileUnix.cpp index 70be6fa5d1f..5ec32ead287 100644 --- a/xpcom/io/nsLocalFileUnix.cpp +++ b/xpcom/io/nsLocalFileUnix.cpp @@ -1893,7 +1893,8 @@ nsLocalFile::Launch() rv = mimeService->GetTypeFromFile(this, type); nsAutoCString fileUri = NS_LITERAL_CSTRING("file://") + mPath; - return GeckoAppShell::OpenUriExternal(NS_ConvertUTF8toUTF16(fileUri), NS_ConvertUTF8toUTF16(type)) ? NS_OK : NS_ERROR_FAILURE; + return mozilla::widget::android::GeckoAppShell::OpenUriExternal(NS_ConvertUTF8toUTF16(fileUri), + NS_ConvertUTF8toUTF16(type)) ? NS_OK : NS_ERROR_FAILURE; #elif defined(MOZ_WIDGET_COCOA) CFURLRef url; if (NS_SUCCEEDED(GetCFURL(&url))) {