Bug 798033 - Headers should generally not do "using namespace" at file scope. r=jib, r=jmathies, r=rjesup, r=ekr, r=ncameron, r=blassey

This commit is contained in:
snigdha 2014-04-01 08:29:25 -04:00
parent 7c4c979e43
commit 11404d6af2
42 changed files with 201 additions and 188 deletions

View File

@ -1882,7 +1882,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;
}

View File

@ -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)

View File

@ -541,7 +541,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,
@ -612,7 +612,7 @@ public:
return (mFunc != nullptr);
}
private:
private:
NPP mInstance;
PluginThreadCallback mFunc;
void *mUserData;
@ -1064,10 +1064,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");
@ -2250,10 +2250,10 @@ _getvalue(NPP npp, NPNVariable variable, void *result)
uint32_t* bits = reinterpret_cast<uint32_t*>(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;

View File

@ -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();
}
}
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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<gfxASurface> DeprecatedGetAsSurface();
virtual TemporaryRef<gfx::SourceSurface> 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;
};

View File

@ -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;
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -9,8 +9,6 @@
#include <string>
using namespace std;
namespace CSF
{
class AudioControl;

View File

@ -113,7 +113,7 @@ public:
void Init()
{
nsCOMPtr<nsIObserverService> observerService =
mozilla::services::GetObserverService();
services::GetObserverService();
if (!observerService)
return;
@ -131,7 +131,7 @@ public:
virtual ~PeerConnectionCtxShutdown()
{
nsCOMPtr<nsIObserverService> observerService =
mozilla::services::GetObserverService();
services::GetObserverService();
if (observerService)
observerService->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);
}
@ -143,7 +143,7 @@ public:
sipcc::PeerConnectionCtx::Destroy();
nsCOMPtr<nsIObserverService> observerService =
mozilla::services::GetObserverService();
services::GetObserverService();
if (!observerService)
return NS_ERROR_FAILURE;
@ -162,11 +162,12 @@ public:
NS_IMPL_ISUPPORTS1(PeerConnectionCtxShutdown, nsIObserver);
}
using namespace mozilla;
namespace sipcc {
PeerConnectionCtx* PeerConnectionCtx::gInstance;
nsIThread* PeerConnectionCtx::gMainThread;
StaticRefPtr<mozilla::PeerConnectionCtxShutdown> PeerConnectionCtx::gPeerConnectionCtxShutdown;
StaticRefPtr<PeerConnectionCtxShutdown> 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
@ -293,7 +294,7 @@ nsresult PeerConnectionCtx::Initialize() {
mDevice = mCCM->getActiveDevice();
mCCM->addCCObserver(this);
NS_ENSURE_TRUE(mDevice.get(), NS_ERROR_FAILURE);
ChangeSipccState(mozilla::dom::PCImplSipccState::Starting);
ChangeSipccState(dom::PCImplSipccState::Starting);
// Now that everything is set up, we let the CCApp thread
// know that it's okay to start processing messages.
@ -328,7 +329,7 @@ void PeerConnectionCtx::onDeviceEvent(ccapi_device_event_e aDeviceEvent,
cc_service_state_t state = aInfo->getServiceState();
// We are keeping this in a local var to avoid a data race
// with ChangeSipccState in the debug message and compound if below
mozilla::dom::PCImplSipccState currentSipccState = mSipccState;
dom::PCImplSipccState currentSipccState = mSipccState;
switch (aDeviceEvent) {
case CCAPI_DEVICE_EV_STATE:
@ -337,9 +338,9 @@ void PeerConnectionCtx::onDeviceEvent(ccapi_device_event_e aDeviceEvent,
if (CC_STATE_INS == state) {
// SIPCC is up
if (mozilla::dom::PCImplSipccState::Starting == currentSipccState ||
mozilla::dom::PCImplSipccState::Idle == currentSipccState) {
ChangeSipccState(mozilla::dom::PCImplSipccState::Started);
if (dom::PCImplSipccState::Starting == currentSipccState ||
dom::PCImplSipccState::Idle == currentSipccState) {
ChangeSipccState(dom::PCImplSipccState::Started);
} else {
CSFLogError(logTag, "%s PeerConnection already started", __FUNCTION__);
}

View File

@ -43,8 +43,6 @@ protected:
namespace sipcc {
using namespace mozilla;
class OnCallEventArgs {
public:
OnCallEventArgs(ccapi_call_event_e aCallEvent, CSF::CC_CallInfoPtr aInfo)
@ -111,7 +109,7 @@ class PeerConnectionCtx : public CSF::CC_Observer {
static PeerConnectionCtx *gInstance;
public:
static nsIThread *gMainThread;
static StaticRefPtr<mozilla::PeerConnectionCtxShutdown> gPeerConnectionCtxShutdown;
static mozilla::StaticRefPtr<mozilla::PeerConnectionCtxShutdown> gPeerConnectionCtxShutdown;
};
} // namespace sipcc

View File

@ -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;

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -2822,7 +2822,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
}

View File

@ -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

View File

@ -668,7 +668,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

View File

@ -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;
}

View File

@ -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

View File

@ -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)

View File

@ -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,14 +480,13 @@ AndroidBridge::GetScreenDepth()
const int DEFAULT_DEPTH = 16;
if (HasEnv()) {
sDepth = GeckoAppShell::GetScreenDepthWrapper();
sDepth = mozilla::widget::android::GeckoAppShell::GetScreenDepthWrapper();
}
if (!sDepth)
return DEFAULT_DEPTH;
return sDepth;
}
void
AndroidBridge::Vibrate(const nsTArray<uint32_t>& aPattern)
{
@ -507,7 +510,7 @@ AndroidBridge::Vibrate(const nsTArray<uint32_t>& aPattern)
ALOG_BRIDGE(" invalid vibration duration < 0");
return;
}
GeckoAppShell::Vibrate1(d);
mozilla::widget::android::GeckoAppShell::Vibrate1(d);
return;
}
@ -533,7 +536,7 @@ AndroidBridge::Vibrate(const nsTArray<uint32_t>& 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 +551,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 +587,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 +620,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 +922,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 +952,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 +974,7 @@ AndroidBridge::HandleGeckoMessage(const nsAString &aMessage)
JNIEnv *env = GetJNIEnv();
AutoLocalJNIFrame jniFrame(env, 1);
GeckoAppShell::HandleGeckoMessageWrapper(aMessage);
mozilla::widget::android::GeckoAppShell::HandleGeckoMessageWrapper(aMessage);
}
nsresult
@ -1027,7 +1032,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 +1044,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 +1056,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 +1084,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 +1098,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 +1148,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 an integer, a boolean, and an integer.
jdoubleArray arr = GeckoAppShell::GetCurrentNetworkInformationWrapper();
jdoubleArray arr = mozilla::widget::android::GeckoAppShell::GetCurrentNetworkInformationWrapper();
if (!arr || env->GetArrayLength(arr) != 3) {
return;
}
@ -1329,7 +1334,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;
@ -1380,7 +1385,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;
@ -1391,7 +1396,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;
@ -1403,7 +1408,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;
@ -1434,7 +1439,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;
@ -1542,7 +1547,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;
@ -1569,10 +1574,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;
@ -1605,7 +1611,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"
@ -1620,7 +1627,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;
@ -1638,7 +1646,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;
@ -1836,7 +1845,7 @@ AndroidBridge::IsContentDocumentDisplayed()
bool
AndroidBridge::ProgressiveUpdateCallback(bool aHasPendingNewThebesContent, const LayerRect& aDisplayPort, float aDisplayResolution, bool aDrawingCritical, ParentLayerRect& aCompositionBounds, CSSToParentLayerScale& aZoom)
{
GeckoLayerClient *client = mLayerClient;
mozilla::widget::android::GeckoLayerClient *client = mLayerClient;
if (!client) {
ALOG_BRIDGE("Exceptional Exit: %s", __PRETTY_FUNCTION__);
return false;
@ -1866,11 +1875,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;
}
@ -1897,7 +1906,7 @@ AndroidBridge::HandleDoubleTap(const CSSPoint& aPoint,
int32_t aModifiers,
const mozilla::layers::ScrollableLayerGuid& aGuid)
{
nsCString data = nsPrintfCString("{ \"x\": %f, \"y\": %f }", aPoint.x, aPoint.y);
nsCString data = nsPrintfCString("{ \"x\": %d, \"y\": %d }", aPoint.x, aPoint.y);
nsAppShell::gAppShell->PostEvent(AndroidGeckoEvent::MakeBroadcastEvent(
NS_LITERAL_CSTRING("Gesture:DoubleTap"), data));
}
@ -1908,7 +1917,7 @@ AndroidBridge::HandleSingleTap(const CSSPoint& aPoint,
const mozilla::layers::ScrollableLayerGuid& aGuid)
{
// TODO Send the modifier data to Gecko for use in mouse events.
nsCString data = nsPrintfCString("{ \"x\": %f, \"y\": %f }", aPoint.x, aPoint.y);
nsCString data = nsPrintfCString("{ \"x\": %d, \"y\": %d }", aPoint.x, aPoint.y);
nsAppShell::gAppShell->PostEvent(AndroidGeckoEvent::MakeBroadcastEvent(
NS_LITERAL_CSTRING("Gesture:SingleTap"), data));
}
@ -1918,7 +1927,7 @@ AndroidBridge::HandleLongTap(const CSSPoint& aPoint,
int32_t aModifiers,
const mozilla::layers::ScrollableLayerGuid& aGuid)
{
nsCString data = nsPrintfCString("{ \"x\": %f, \"y\": %f }", aPoint.x, aPoint.y);
nsCString data = nsPrintfCString("{ \"x\": %d, \"y\": %d }", aPoint.x, aPoint.y);
nsAppShell::gAppShell->PostEvent(AndroidGeckoEvent::MakeBroadcastEvent(
NS_LITERAL_CSTRING("Gesture:LongPress"), data));
}

View File

@ -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");
}
@ -202,10 +200,10 @@ public:
void ContentDocumentChanged();
bool IsContentDocumentDisplayed();
bool ProgressiveUpdateCallback(bool aHasPendingNewThebesContent, const LayerRect& aDisplayPort, float aDisplayResolution, bool aDrawingCritical, ParentLayerRect& aCompositionBounds, CSSToParentLayerScale& aZoom);
bool ProgressiveUpdateCallback(bool aHasPendingNewThebesContent, const LayerRect& aDisplayPort, float aDisplayResolution, bool aDrawingCritical, mozilla::ParentLayerRect& aCompositionBounds, mozilla::CSSToParentLayerScale& 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<DelayedTask*> 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,

View File

@ -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" */

View File

@ -82,20 +82,20 @@ public:
nsCOMPtr<nsIBrowserTab> 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;
@ -599,7 +599,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());

View File

@ -43,8 +43,7 @@ nsClipboard::SetData(nsITransferable *aTransferable,
nsAutoString buffer;
supportsString->GetData(buffer);
Clipboard::SetClipboardText(buffer);
mozilla::widget::android::Clipboard::SetClipboardText(buffer);
return NS_OK;
}
@ -85,8 +84,8 @@ nsClipboard::EmptyClipboard(int32_t aWhichClipboard)
{
if (aWhichClipboard != kGlobalClipboard)
return NS_ERROR_NOT_IMPLEMENTED;
Clipboard::ClearText();
mozilla::widget::android::Clipboard::ClearText();
return NS_OK;
}
@ -98,7 +97,7 @@ nsClipboard::HasDataMatchingFlavors(const char **aFlavorList,
*aHasText = false;
if (aWhichClipboard != kGlobalClipboard)
return NS_ERROR_NOT_IMPLEMENTED;
*aHasText = Clipboard::HasText();
*aHasText = mozilla::widget::android::Clipboard::HasText();
return NS_OK;
}

View File

@ -22,6 +22,6 @@ nsIMEPicker::~nsIMEPicker()
/* void show (); */
NS_IMETHODIMP nsIMEPicker::Show()
{
GeckoAppShell::ShowInputMethodPicker();
mozilla::widget::android::GeckoAppShell::ShowInputMethodPicker();
return NS_OK;
}

View File

@ -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);
}

View File

@ -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)

View File

@ -352,7 +352,7 @@ nsWindow::GetDefaultScaleInternal()
return density;
}
density = GeckoAppShell::GetDensity();
density = mozilla::widget::android::GeckoAppShell::GetDensity();
if (!density) {
density = 1.0;
@ -514,7 +514,7 @@ nsWindow::SetSizeMode(int32_t aMode)
{
switch (aMode) {
case nsSizeMode_Minimized:
GeckoAppShell::MoveTaskToBack();
mozilla::widget::android::GeckoAppShell::MoveTaskToBack();
break;
case nsSizeMode_Fullscreen:
MakeFullScreen(true);
@ -692,7 +692,7 @@ nsWindow::DispatchEvent(WidgetGUIEvent* aEvent)
NS_IMETHODIMP
nsWindow::MakeFullScreen(bool aFullScreen)
{
GeckoAppShell::SetFullScreen(aFullScreen);
mozilla::widget::android::GeckoAppShell::SetFullScreen(aFullScreen);
return NS_OK;
}
@ -1193,7 +1193,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;
}
@ -1202,7 +1202,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;
@ -1838,10 +1838,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);
@ -1852,7 +1852,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;
}
@ -1865,7 +1865,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:
@ -1897,7 +1897,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;
}
@ -1925,7 +1925,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:
@ -2114,7 +2114,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");
@ -2138,11 +2138,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");
@ -2154,7 +2154,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) {
@ -2216,7 +2216,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;
}
@ -2272,7 +2272,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);
@ -2287,7 +2287,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;
@ -2389,7 +2389,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;
@ -2428,7 +2428,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<CompositorOGL*>(aManager->GetCompositor())->gl();
gl::ScopedGLState scopedScissorTestState(gl, LOCAL_GL_SCISSOR_TEST);

View File

@ -27,9 +27,10 @@ ToastNotificationHandler::DisplayNotification(HSTRING title,
{
mCookie = aCookie;
ComPtr<IXmlDocument> toastXml = InitializeXmlForTemplate(ToastTemplateType::ToastTemplateType_ToastImageAndText03);
ComPtr<IXmlNodeList> toastTextElements, toastImageElements;
ComPtr<IXmlNode> titleTextNodeRoot, msgTextNodeRoot, imageNodeRoot, srcAttribute;
Microsoft::WRL::ComPtr<IXmlDocument> toastXml =
InitializeXmlForTemplate(ToastTemplateType::ToastTemplateType_ToastImageAndText03);
Microsoft::WRL::ComPtr<IXmlNodeList> toastTextElements, toastImageElements;
Microsoft::WRL::ComPtr<IXmlNode> 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<IXmlNamedNodeMap> attributes;
Microsoft::WRL::ComPtr<IXmlNamedNodeMap> attributes;
AssertRetHRESULT(imageNodeRoot->get_Attributes(&attributes), false);
AssertRetHRESULT(attributes->GetNamedItem(srcNodeStr, &srcAttribute), false);
@ -62,9 +63,10 @@ ToastNotificationHandler::DisplayTextNotification(HSTRING title,
{
mCookie = aCookie;
ComPtr<IXmlDocument> toastXml = InitializeXmlForTemplate(ToastTemplateType::ToastTemplateType_ToastText03);
ComPtr<IXmlNodeList> toastTextElements;
ComPtr<IXmlNode> titleTextNodeRoot, msgTextNodeRoot;
Microsoft::WRL::ComPtr<IXmlDocument> toastXml =
InitializeXmlForTemplate(ToastTemplateType::ToastTemplateType_ToastText03);
Microsoft::WRL::ComPtr<IXmlNodeList> toastTextElements;
Microsoft::WRL::ComPtr<IXmlNode> titleTextNodeRoot, msgTextNodeRoot;
HSTRING textNodeStr;
HSTRING_HEADER textHeader;
@ -80,9 +82,9 @@ ToastNotificationHandler::DisplayTextNotification(HSTRING title,
return CreateWindowsNotificationFromXml(toastXml.Get(), aAppId);
}
ComPtr<IXmlDocument>
Microsoft::WRL::ComPtr<IXmlDocument>
ToastNotificationHandler::InitializeXmlForTemplate(ToastTemplateType templateType) {
ComPtr<IXmlDocument> toastXml;
Microsoft::WRL::ComPtr<IXmlDocument> 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<IToastNotification> notification;
ComPtr<IToastNotificationFactory> factory;
Microsoft::WRL::ComPtr<IToastNotification> notification;
Microsoft::WRL::ComPtr<IToastNotificationFactory> factory;
AssertRetHRESULT(GetActivationFactory(HStringReference(RuntimeClass_Windows_UI_Notifications_ToastNotification).Get(),
factory.GetAddressOf()), false);
AssertRetHRESULT(factory->CreateToastNotification(toastXml, &notification),
@ -110,7 +112,7 @@ ToastNotificationHandler::CreateWindowsNotificationFromXml(IXmlDocument *toastXm
AssertRetHRESULT(notification->add_Dismissed(Callback<ToastDismissHandler>(this,
&ToastNotificationHandler::OnDismiss).Get(), &dismissedToken), false);
ComPtr<IToastNotifier> notifier;
Microsoft::WRL::ComPtr<IToastNotifier> notifier;
if (aAppId.IsEmpty()) {
AssertRetHRESULT(mToastNotificationManagerStatics->CreateToastNotifier(
&notifier), false);
@ -126,9 +128,10 @@ ToastNotificationHandler::CreateWindowsNotificationFromXml(IXmlDocument *toastXm
return true;
}
void ToastNotificationHandler::SetNodeValueString(HSTRING inputString, ComPtr<IXmlNode> node, ComPtr<IXmlDocument> xml) {
ComPtr<IXmlText> inputText;
ComPtr<IXmlNode> inputTextNode, pAppendedChild;
void ToastNotificationHandler::SetNodeValueString(HSTRING inputString,
Microsoft::WRL::ComPtr<IXmlNode> node, Microsoft::WRL::ComPtr<IXmlDocument> xml) {
Microsoft::WRL::ComPtr<IXmlText> inputText;
Microsoft::WRL::ComPtr<IXmlNode> inputTextNode, pAppendedChild;
AssertHRESULT(xml->CreateTextNode(inputString, &inputText));
AssertHRESULT(inputText.As(&inputTextNode));

View File

@ -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<IXmlNode> node, ComPtr<IXmlDocument> xml);
void SetNodeValueString(HSTRING inputString,Microsoft::WRL::ComPtr<IXmlNode> node,
Microsoft::WRL::ComPtr<IXmlDocument> xml);
public:
ToastNotificationHandler() {};
~ToastNotificationHandler() {};
@ -36,9 +36,9 @@ class ToastNotificationHandler {
private:
nsString mCookie;
ComPtr<IToastNotificationManagerStatics> mToastNotificationManagerStatics;
Microsoft::WRL::ComPtr<IToastNotificationManagerStatics> mToastNotificationManagerStatics;
bool CreateWindowsNotificationFromXml(IXmlDocument *toastXml,
const nsAString& aAppId);
ComPtr<IXmlDocument> InitializeXmlForTemplate(ToastTemplateType templateType);
Microsoft::WRL::ComPtr<IXmlDocument> InitializeXmlForTemplate(ToastTemplateType templateType);
};

View File

@ -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<RuntimeClassFlags<RuntimeClassType::WinRtClassicComMix>,
class UIABridge : public Microsoft::WRL::RuntimeClass<Microsoft::WRL::RuntimeClassFlags
<Microsoft::WRL::RuntimeClassType::WinRtClassicComMix>,
IUIABridge,
IUIAElement,
IRawElementProviderSimple,
@ -81,7 +80,8 @@ private:
};
[uuid("4438135F-F624-43DE-A417-275CE7A1A0CD")]
class UIATextElement : public RuntimeClass<RuntimeClassFlags<RuntimeClassType::WinRtClassicComMix>,
class UIATextElement : public Microsoft::WRL::RuntimeClass<Microsoft::WRL::RuntimeClassFlags
<Microsoft::WRL::RuntimeClassType::WinRtClassicComMix>,
IUIAElement,
IRawElementProviderSimple,
IRawElementProviderFragment,

View File

@ -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.

View File

@ -1898,7 +1898,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))) {