Bug 1608577: Part 3 - Remove |using namespace mozilla::java| from widget/android; r=geckoview-reviewers,esawin

Differential Revision: https://phabricator.services.mozilla.com/D59798
This commit is contained in:
Aaron Klotz
2020-01-14 16:47:59 +00:00
parent c33b5d6013
commit c7d67b115e
6 changed files with 87 additions and 82 deletions

View File

@@ -47,7 +47,6 @@
using namespace mozilla;
using namespace mozilla::gfx;
using namespace mozilla::java;
AndroidBridge* AndroidBridge::sBridge = nullptr;
static jobject sGlobalContext = nullptr;
@@ -217,7 +216,7 @@ bool AndroidBridge::GetHandlersForMimeType(const nsAString& aMimeType,
const nsAString& aAction) {
ALOG_BRIDGE("AndroidBridge::GetHandlersForMimeType");
auto arr = GeckoAppShell::GetHandlersForMimeType(aMimeType, aAction);
auto arr = java::GeckoAppShell::GetHandlersForMimeType(aMimeType, aAction);
if (!arr) return false;
JNIEnv* const env = arr.Env();
@@ -233,7 +232,7 @@ bool AndroidBridge::GetHandlersForMimeType(const nsAString& aMimeType,
bool AndroidBridge::HasHWVP8Encoder() {
ALOG_BRIDGE("AndroidBridge::HasHWVP8Encoder");
bool value = GeckoAppShell::HasHWVP8Encoder();
bool value = java::GeckoAppShell::HasHWVP8Encoder();
return value;
}
@@ -241,7 +240,7 @@ bool AndroidBridge::HasHWVP8Encoder() {
bool AndroidBridge::HasHWVP8Decoder() {
ALOG_BRIDGE("AndroidBridge::HasHWVP8Decoder");
bool value = GeckoAppShell::HasHWVP8Decoder();
bool value = java::GeckoAppShell::HasHWVP8Decoder();
return value;
}
@@ -249,7 +248,7 @@ bool AndroidBridge::HasHWVP8Decoder() {
bool AndroidBridge::HasHWH264() {
ALOG_BRIDGE("AndroidBridge::HasHWH264");
return HardwareCodecCapabilityUtils::HasHWH264();
return java::HardwareCodecCapabilityUtils::HasHWH264();
}
bool AndroidBridge::GetHandlersForURL(const nsAString& aURL,
@@ -258,7 +257,7 @@ bool AndroidBridge::GetHandlersForURL(const nsAString& aURL,
const nsAString& aAction) {
ALOG_BRIDGE("AndroidBridge::GetHandlersForURL");
auto arr = GeckoAppShell::GetHandlersForURL(aURL, aAction);
auto arr = java::GeckoAppShell::GetHandlersForURL(aURL, aAction);
if (!arr) return false;
JNIEnv* const env = arr.Env();
@@ -275,7 +274,7 @@ void AndroidBridge::GetMimeTypeFromExtensions(const nsACString& aFileExt,
nsCString& aMimeType) {
ALOG_BRIDGE("AndroidBridge::GetMimeTypeFromExtensions");
auto jstrType = GeckoAppShell::GetMimeTypeFromExtensions(aFileExt);
auto jstrType = java::GeckoAppShell::GetMimeTypeFromExtensions(aFileExt);
if (jstrType) {
aMimeType = jstrType->ToCString();
@@ -286,7 +285,7 @@ void AndroidBridge::GetExtensionFromMimeType(const nsACString& aMimeType,
nsACString& aFileExt) {
ALOG_BRIDGE("AndroidBridge::GetExtensionFromMimeType");
auto jstrExt = GeckoAppShell::GetExtensionFromMimeType(aMimeType);
auto jstrExt = java::GeckoAppShell::GetExtensionFromMimeType(aMimeType);
if (jstrExt) {
aFileExt = jstrExt->ToCString();
@@ -296,7 +295,7 @@ void AndroidBridge::GetExtensionFromMimeType(const nsACString& aMimeType,
gfx::Rect AndroidBridge::getScreenSize() {
ALOG_BRIDGE("AndroidBridge::getScreenSize");
java::sdk::Rect::LocalRef screenrect = GeckoAppShell::GetScreenSize();
java::sdk::Rect::LocalRef screenrect = java::GeckoAppShell::GetScreenSize();
gfx::Rect screensize(screenrect->Left(), screenrect->Top(),
screenrect->Width(), screenrect->Height());
@@ -312,7 +311,7 @@ int AndroidBridge::GetScreenDepth() {
const int DEFAULT_DEPTH = 16;
if (jni::IsAvailable()) {
sDepth = GeckoAppShell::GetScreenDepth();
sDepth = java::GeckoAppShell::GetScreenDepth();
}
if (!sDepth) return DEFAULT_DEPTH;
@@ -336,7 +335,7 @@ void AndroidBridge::Vibrate(const nsTArray<uint32_t>& aPattern) {
ALOG_BRIDGE(" invalid vibration duration < 0");
return;
}
GeckoAppShell::Vibrate(d);
java::GeckoAppShell::Vibrate(d);
return;
}
@@ -365,8 +364,8 @@ void AndroidBridge::Vibrate(const nsTArray<uint32_t>& aPattern) {
}
env->ReleaseLongArrayElements(array, elts, 0);
GeckoAppShell::Vibrate(jni::LongArray::Ref::From(array),
-1 /* don't repeat */);
java::GeckoAppShell::Vibrate(jni::LongArray::Ref::From(array),
-1 /* don't repeat */);
}
void AndroidBridge::GetIconForExtension(const nsACString& aFileExt,
@@ -377,8 +376,8 @@ void AndroidBridge::GetIconForExtension(const nsACString& aFileExt,
"AndroidBridge::GetIconForExtension: aBuf is null!");
if (!aBuf) return;
auto arr = GeckoAppShell::GetIconForExtension(NS_ConvertUTF8toUTF16(aFileExt),
aIconSize);
auto arr = java::GeckoAppShell::GetIconForExtension(
NS_ConvertUTF8toUTF16(aFileExt), aIconSize);
NS_ASSERTION(
arr != nullptr,
@@ -520,7 +519,7 @@ void AndroidBridge::GetCurrentBatteryInformation(
// 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.
auto arr = GeckoAppShell::GetCurrentBatteryInformation();
auto arr = java::GeckoAppShell::GetCurrentBatteryInformation();
JNIEnv* const env = arr.Env();
if (!arr || env->GetArrayLength(arr.Get()) != 3) {
@@ -544,7 +543,7 @@ void AndroidBridge::GetCurrentNetworkInformation(
// an array of double even if we actually want an integer, a boolean, and an
// integer.
auto arr = GeckoAppShell::GetCurrentNetworkInformation();
auto arr = java::GeckoAppShell::GetCurrentNetworkInformation();
JNIEnv* const env = arr.Env();
if (!arr || env->GetArrayLength(arr.Get()) != 3) {
@@ -562,7 +561,7 @@ void AndroidBridge::GetCurrentNetworkInformation(
jobject AndroidBridge::GetGlobalContextRef() {
// The context object can change, so get a fresh copy every time.
auto context = GeckoAppShell::GetApplicationContext();
auto context = java::GeckoAppShell::GetApplicationContext();
sGlobalContext = jni::Object::GlobalRef(context).Forget();
MOZ_ASSERT(sGlobalContext);
return sGlobalContext;
@@ -623,13 +622,13 @@ void nsAndroidBridge::RemoveObservers() {
uint32_t AndroidBridge::GetScreenOrientation() {
ALOG_BRIDGE("AndroidBridge::GetScreenOrientation");
int16_t orientation = GeckoAppShell::GetScreenOrientation();
int16_t orientation = java::GeckoAppShell::GetScreenOrientation();
return static_cast<hal::ScreenOrientation>(orientation);
}
uint16_t AndroidBridge::GetScreenAngle() {
return GeckoAppShell::GetScreenAngle();
return java::GeckoAppShell::GetScreenAngle();
}
nsresult AndroidBridge::GetProxyForURI(const nsACString& aSpec,
@@ -641,7 +640,8 @@ nsresult AndroidBridge::GetProxyForURI(const nsACString& aSpec,
return NS_ERROR_FAILURE;
}
auto jstrRet = GeckoAppShell::GetProxyForURI(aSpec, aScheme, aHost, aPort);
auto jstrRet =
java::GeckoAppShell::GetProxyForURI(aSpec, aScheme, aHost, aPort);
if (!jstrRet) return NS_ERROR_FAILURE;
@@ -670,7 +670,7 @@ bool AndroidBridge::PumpMessageLoop() {
return false;
}
return GeckoThread::PumpMessageLoop(msg);
return java::GeckoThread::PumpMessageLoop(msg);
}
NS_IMETHODIMP nsAndroidBridge::GetIsFennec(bool* aIsFennec) {