зеркало из https://github.com/mozilla/gecko-dev.git
Bug 913985: Part 6 - Remove redundant AndroidBridge::Bridge() checks. r=kats; DONTBUILD
This commit is contained in:
Родитель
939077cb0b
Коммит
418cc1b25e
|
@ -1559,8 +1559,8 @@ ContentParent::RecvGetShowPasswordSetting(bool* showPassword)
|
||||||
*showPassword = true;
|
*showPassword = true;
|
||||||
#ifdef MOZ_WIDGET_ANDROID
|
#ifdef MOZ_WIDGET_ANDROID
|
||||||
NS_ASSERTION(AndroidBridge::Bridge() != nullptr, "AndroidBridge is not available");
|
NS_ASSERTION(AndroidBridge::Bridge() != nullptr, "AndroidBridge is not available");
|
||||||
if (AndroidBridge::Bridge() != nullptr)
|
|
||||||
*showPassword = GeckoAppShell::GetShowPasswordSetting();
|
*showPassword = GeckoAppShell::GetShowPasswordSetting();
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,8 +26,6 @@ AndroidLocationProvider::~AndroidLocationProvider()
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
AndroidLocationProvider::Startup()
|
AndroidLocationProvider::Startup()
|
||||||
{
|
{
|
||||||
if (!AndroidBridge::Bridge())
|
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
|
||||||
GeckoAppShell::EnableLocation(true);
|
GeckoAppShell::EnableLocation(true);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -44,8 +42,6 @@ AndroidLocationProvider::Watch(nsIGeolocationUpdate* aCallback)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
AndroidLocationProvider::Shutdown()
|
AndroidLocationProvider::Shutdown()
|
||||||
{
|
{
|
||||||
if (!AndroidBridge::Bridge())
|
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
|
||||||
GeckoAppShell::EnableLocation(false);
|
GeckoAppShell::EnableLocation(false);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -53,8 +49,6 @@ AndroidLocationProvider::Shutdown()
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
AndroidLocationProvider::SetHighAccuracy(bool enable)
|
AndroidLocationProvider::SetHighAccuracy(bool enable)
|
||||||
{
|
{
|
||||||
if (!AndroidBridge::Bridge())
|
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
|
||||||
GeckoAppShell::EnableLocationHighAccuracy(enable);
|
GeckoAppShell::EnableLocationHighAccuracy(enable);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,10 +14,6 @@ NS_IMPL_ISUPPORTS1(nsHapticFeedback, nsIHapticFeedback)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsHapticFeedback::PerformSimpleAction(int32_t aType)
|
nsHapticFeedback::PerformSimpleAction(int32_t aType)
|
||||||
{
|
{
|
||||||
AndroidBridge* bridge = AndroidBridge::Bridge();
|
GeckoAppShell::PerformHapticFeedback(aType == LongPress);
|
||||||
if (bridge) {
|
return NS_OK;
|
||||||
GeckoAppShell::PerformHapticFeedback(aType == LongPress);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,10 +139,6 @@ GetCurrentScreenConfiguration(ScreenConfiguration* aScreenConfiguration)
|
||||||
bool
|
bool
|
||||||
LockScreenOrientation(const ScreenOrientation& aOrientation)
|
LockScreenOrientation(const ScreenOrientation& aOrientation)
|
||||||
{
|
{
|
||||||
if (!AndroidBridge::Bridge()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (aOrientation) {
|
switch (aOrientation) {
|
||||||
// The Android backend only supports these orientations.
|
// The Android backend only supports these orientations.
|
||||||
case eScreenOrientation_PortraitPrimary:
|
case eScreenOrientation_PortraitPrimary:
|
||||||
|
|
|
@ -93,13 +93,11 @@ nsAndroidHistory::VisitURI(nsIURI *aURI, nsIURI *aLastVisitedURI, uint32_t aFlag
|
||||||
if (aFlags & VisitFlags::UNRECOVERABLE_ERROR)
|
if (aFlags & VisitFlags::UNRECOVERABLE_ERROR)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
||||||
if (AndroidBridge::Bridge()) {
|
nsAutoCString uri;
|
||||||
nsAutoCString uri;
|
nsresult rv = aURI->GetSpec(uri);
|
||||||
nsresult rv = aURI->GetSpec(uri);
|
if (NS_FAILED(rv)) return rv;
|
||||||
if (NS_FAILED(rv)) return rv;
|
NS_ConvertUTF8toUTF16 uriString(uri);
|
||||||
NS_ConvertUTF8toUTF16 uriString(uri);
|
GeckoAppShell::MarkURIVisited(uriString);
|
||||||
GeckoAppShell::MarkURIVisited(uriString);
|
|
||||||
}
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,9 +67,6 @@ nsAndroidHandlerApp::Equals(nsIHandlerApp *aHandlerApp, bool *aRetval)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsAndroidHandlerApp::LaunchWithURI(nsIURI *aURI, nsIInterfaceRequestor *aWindowContext)
|
nsAndroidHandlerApp::LaunchWithURI(nsIURI *aURI, nsIInterfaceRequestor *aWindowContext)
|
||||||
{
|
{
|
||||||
if (!mozilla::AndroidBridge::Bridge())
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
nsCString uriSpec;
|
nsCString uriSpec;
|
||||||
aURI->GetSpec(uriSpec);
|
aURI->GetSpec(uriSpec);
|
||||||
return GeckoAppShell::OpenUriExternal(NS_ConvertUTF8toUTF16(uriSpec), NS_ConvertUTF8toUTF16(mMimeType), mPackageName, mClassName, mAction) ?
|
return GeckoAppShell::OpenUriExternal(NS_ConvertUTF8toUTF16(uriSpec), NS_ConvertUTF8toUTF16(mMimeType), mPackageName, mClassName, mAction) ?
|
||||||
|
@ -79,9 +76,6 @@ nsAndroidHandlerApp::LaunchWithURI(nsIURI *aURI, nsIInterfaceRequestor *aWindowC
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsAndroidHandlerApp::Share(const nsAString & data, const nsAString & title)
|
nsAndroidHandlerApp::Share(const nsAString & data, const nsAString & title)
|
||||||
{
|
{
|
||||||
if (!mozilla::AndroidBridge::Bridge())
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
return GeckoAppShell::OpenUriExternal(data, NS_ConvertUTF8toUTF16(mMimeType), mPackageName,
|
return GeckoAppShell::OpenUriExternal(data, NS_ConvertUTF8toUTF16(mMimeType), mPackageName,
|
||||||
mClassName, mAction) ? NS_OK : NS_ERROR_FAILURE;
|
mClassName, mAction) ? NS_OK : NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,11 +31,7 @@ nsExternalSharingAppService::ShareWithDefault(const nsAString & data,
|
||||||
{
|
{
|
||||||
NS_NAMED_LITERAL_STRING(sendAction, "android.intent.action.SEND");
|
NS_NAMED_LITERAL_STRING(sendAction, "android.intent.action.SEND");
|
||||||
const nsString emptyString = EmptyString();
|
const nsString emptyString = EmptyString();
|
||||||
if (AndroidBridge::Bridge())
|
return GeckoAppShell::OpenUriExternal(data, mime, emptyString,emptyString, sendAction, title) ? NS_OK : NS_ERROR_FAILURE;
|
||||||
return GeckoAppShell::OpenUriExternal(data, mime,
|
|
||||||
emptyString,emptyString, sendAction, title) ? NS_OK : NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
|
|
@ -30,10 +30,7 @@ nsMIMEInfoAndroid::LoadUriInternal(nsIURI * aURI)
|
||||||
nsCString uriScheme;
|
nsCString uriScheme;
|
||||||
aURI->GetScheme(uriScheme);
|
aURI->GetScheme(uriScheme);
|
||||||
|
|
||||||
if (mozilla::AndroidBridge::Bridge())
|
return GeckoAppShell::OpenUriExternal(NS_ConvertUTF8toUTF16(uriSpec), (mType.Equals(uriScheme) || mType.Equals(uriSpec)) ? EmptyString() : NS_ConvertUTF8toUTF16(mType)) ? NS_OK : NS_ERROR_FAILURE;
|
||||||
return GeckoAppShell::OpenUriExternal(NS_ConvertUTF8toUTF16(uriSpec), (mType.Equals(uriScheme) || mType.Equals(uriSpec)) ? EmptyString() : NS_ConvertUTF8toUTF16(mType)) ? NS_OK : NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include "nsRect.h"
|
#include "nsRect.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
#include "nsTArray.h"
|
#include "nsTArray.h"
|
||||||
|
#include "nsIAndroidBridge.h"
|
||||||
#include "nsIObserver.h"
|
#include "nsIObserver.h"
|
||||||
#include "mozilla/gfx/Rect.h"
|
#include "mozilla/gfx/Rect.h"
|
||||||
#include "mozilla/dom/Touch.h"
|
#include "mozilla/dom/Touch.h"
|
||||||
|
|
|
@ -236,11 +236,6 @@ nsAppShell::Observe(nsISupports* aSubject,
|
||||||
NS_LITERAL_STRING(PREFNAME_COALESCE_TOUCHES)) ||
|
NS_LITERAL_STRING(PREFNAME_COALESCE_TOUCHES)) ||
|
||||||
nsDependentString(aData).Equals(
|
nsDependentString(aData).Equals(
|
||||||
NS_LITERAL_STRING(PREFNAME_MATCH_OS)))) {
|
NS_LITERAL_STRING(PREFNAME_MATCH_OS)))) {
|
||||||
AndroidBridge* bridge = AndroidBridge::Bridge();
|
|
||||||
if (!bridge) {
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool match;
|
bool match;
|
||||||
nsresult rv = Preferences::GetBool(PREFNAME_MATCH_OS, &match);
|
nsresult rv = Preferences::GetBool(PREFNAME_MATCH_OS, &match);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
@ -407,10 +402,6 @@ nsAppShell::ProcessNextNativeEvent(bool mayWait)
|
||||||
if (!mBrowserApp)
|
if (!mBrowserApp)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
AndroidBridge* bridge = AndroidBridge::Bridge();
|
|
||||||
if (!bridge)
|
|
||||||
break;
|
|
||||||
|
|
||||||
int32_t tabId = curEvent->MetaState();
|
int32_t tabId = curEvent->MetaState();
|
||||||
const nsTArray<nsIntPoint>& points = curEvent->Points();
|
const nsTArray<nsIntPoint>& points = curEvent->Points();
|
||||||
RefCountedJavaObject* buffer = curEvent->ByteBuffer();
|
RefCountedJavaObject* buffer = curEvent->ByteBuffer();
|
||||||
|
|
|
@ -44,11 +44,7 @@ nsClipboard::SetData(nsITransferable *aTransferable,
|
||||||
supportsString->GetData(buffer);
|
supportsString->GetData(buffer);
|
||||||
|
|
||||||
if (XRE_GetProcessType() == GeckoProcessType_Default) {
|
if (XRE_GetProcessType() == GeckoProcessType_Default) {
|
||||||
if (AndroidBridge::Bridge())
|
Clipboard::SetClipboardText(buffer);
|
||||||
Clipboard::SetClipboardText(buffer);
|
|
||||||
else
|
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
bool isPrivateData = false;
|
bool isPrivateData = false;
|
||||||
aTransferable->GetIsPrivateData(&isPrivateData);
|
aTransferable->GetIsPrivateData(&isPrivateData);
|
||||||
|
@ -101,8 +97,7 @@ nsClipboard::EmptyClipboard(int32_t aWhichClipboard)
|
||||||
if (aWhichClipboard != kGlobalClipboard)
|
if (aWhichClipboard != kGlobalClipboard)
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
if (XRE_GetProcessType() == GeckoProcessType_Default) {
|
if (XRE_GetProcessType() == GeckoProcessType_Default) {
|
||||||
if (AndroidBridge::Bridge())
|
Clipboard::ClearText();
|
||||||
Clipboard::ClearText();
|
|
||||||
} else {
|
} else {
|
||||||
ContentChild::GetSingleton()->SendEmptyClipboard();
|
ContentChild::GetSingleton()->SendEmptyClipboard();
|
||||||
}
|
}
|
||||||
|
@ -119,8 +114,7 @@ nsClipboard::HasDataMatchingFlavors(const char **aFlavorList,
|
||||||
if (aWhichClipboard != kGlobalClipboard)
|
if (aWhichClipboard != kGlobalClipboard)
|
||||||
return NS_ERROR_NOT_IMPLEMENTED;
|
return NS_ERROR_NOT_IMPLEMENTED;
|
||||||
if (XRE_GetProcessType() == GeckoProcessType_Default) {
|
if (XRE_GetProcessType() == GeckoProcessType_Default) {
|
||||||
if (AndroidBridge::Bridge())
|
*aHasText = Clipboard::HasText();
|
||||||
*aHasText = Clipboard::HasText();
|
|
||||||
} else {
|
} else {
|
||||||
ContentChild::GetSingleton()->SendClipboardHasText(aHasText);
|
ContentChild::GetSingleton()->SendClipboardHasText(aHasText);
|
||||||
}
|
}
|
||||||
|
|
|
@ -464,10 +464,7 @@ nsLookAndFeel::GetEchoPasswordImpl()
|
||||||
{
|
{
|
||||||
if (!mInitializedShowPassword) {
|
if (!mInitializedShowPassword) {
|
||||||
if (XRE_GetProcessType() == GeckoProcessType_Default) {
|
if (XRE_GetProcessType() == GeckoProcessType_Default) {
|
||||||
if (AndroidBridge::Bridge())
|
mShowPassword = GeckoAppShell::GetShowPasswordSetting();
|
||||||
mShowPassword = GeckoAppShell::GetShowPasswordSetting();
|
|
||||||
else
|
|
||||||
NS_ASSERTION(AndroidBridge::Bridge() != nullptr, "AndroidBridge is not available!");
|
|
||||||
} else {
|
} else {
|
||||||
ContentChild::GetSingleton()->SendGetShowPasswordSetting(&mShowPassword);
|
ContentChild::GetSingleton()->SendGetShowPasswordSetting(&mShowPassword);
|
||||||
}
|
}
|
||||||
|
|
|
@ -210,11 +210,6 @@ nsWindow::Create(nsIWidget *aParent,
|
||||||
{
|
{
|
||||||
ALOG("nsWindow[%p]::Create %p [%d %d %d %d]", (void*)this, (void*)aParent, aRect.x, aRect.y, aRect.width, aRect.height);
|
ALOG("nsWindow[%p]::Create %p [%d %d %d %d]", (void*)this, (void*)aParent, aRect.x, aRect.y, aRect.width, aRect.height);
|
||||||
nsWindow *parent = (nsWindow*) aParent;
|
nsWindow *parent = (nsWindow*) aParent;
|
||||||
|
|
||||||
if (!AndroidBridge::Bridge()) {
|
|
||||||
aNativeParent = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (aNativeParent) {
|
if (aNativeParent) {
|
||||||
if (parent) {
|
if (parent) {
|
||||||
ALOG("Ignoring native parent on Android window [%p], since parent was specified (%p %p)", (void*)this, (void*)aNativeParent, (void*)aParent);
|
ALOG("Ignoring native parent on Android window [%p], since parent was specified (%p %p)", (void*)this, (void*)aNativeParent, (void*)aParent);
|
||||||
|
@ -354,9 +349,7 @@ nsWindow::GetDefaultScaleInternal()
|
||||||
return density;
|
return density;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AndroidBridge::Bridge()) {
|
density = GeckoAppShell::GetDensity();
|
||||||
density = GeckoAppShell::GetDensity();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!density) {
|
if (!density) {
|
||||||
density = 1.0;
|
density = 1.0;
|
||||||
|
@ -572,9 +565,6 @@ nsWindow::SetFocus(bool aRaise)
|
||||||
ALOG("nsWindow::SetFocus: can't set focus without raising, ignoring aRaise = false!");
|
ALOG("nsWindow::SetFocus: can't set focus without raising, ignoring aRaise = false!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!AndroidBridge::Bridge())
|
|
||||||
return NS_OK;
|
|
||||||
|
|
||||||
nsWindow *top = FindTopLevel();
|
nsWindow *top = FindTopLevel();
|
||||||
top->mFocus = this;
|
top->mFocus = this;
|
||||||
top->BringToFront();
|
top->BringToFront();
|
||||||
|
@ -770,9 +760,6 @@ nsWindow::CreateLayerManager(int aCompositorWidth, int aCompositorHeight)
|
||||||
void
|
void
|
||||||
nsWindow::OnGlobalAndroidEvent(AndroidGeckoEvent *ae)
|
nsWindow::OnGlobalAndroidEvent(AndroidGeckoEvent *ae)
|
||||||
{
|
{
|
||||||
if (!AndroidBridge::Bridge())
|
|
||||||
return;
|
|
||||||
|
|
||||||
nsWindow *win = TopWindow();
|
nsWindow *win = TopWindow();
|
||||||
if (!win)
|
if (!win)
|
||||||
return;
|
return;
|
||||||
|
@ -950,9 +937,6 @@ nsWindow::OnGlobalAndroidEvent(AndroidGeckoEvent *ae)
|
||||||
void
|
void
|
||||||
nsWindow::OnAndroidEvent(AndroidGeckoEvent *ae)
|
nsWindow::OnAndroidEvent(AndroidGeckoEvent *ae)
|
||||||
{
|
{
|
||||||
if (!AndroidBridge::Bridge())
|
|
||||||
return;
|
|
||||||
|
|
||||||
switch (ae->Type()) {
|
switch (ae->Type()) {
|
||||||
case AndroidGeckoEvent::DRAW:
|
case AndroidGeckoEvent::DRAW:
|
||||||
OnDraw(ae);
|
OnDraw(ae);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче