Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3587)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/preferences/LocationSettings.java

Issue 2671623002: Expose WindowAndroid from WebContents. (Closed)
Patch Set: Rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/preferences/LocationSettings.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/LocationSettings.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/LocationSettings.java
index 1cdf3ec8de01712a1549e42b92f40c2bf728857e..27bbad0217962d6f76765f605a0f2cecb645c61e 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/LocationSettings.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/LocationSettings.java
@@ -15,7 +15,6 @@ import org.chromium.chrome.browser.AppHooks;
import org.chromium.components.location.LocationSettingsDialogContext.LocationSettingsDialogContextEnum;
import org.chromium.components.location.LocationSettingsDialogOutcome;
import org.chromium.components.location.LocationUtils;
-import org.chromium.content.browser.ContentViewCore;
import org.chromium.content_public.browser.WebContents;
import org.chromium.ui.base.WindowAndroid;
@@ -55,7 +54,7 @@ public class LocationSettings {
@CalledByNative
private static boolean canPromptForAndroidLocationPermission(WebContents webContents) {
- WindowAndroid windowAndroid = windowFromWebContents(webContents);
+ WindowAndroid windowAndroid = webContents.getTopLevelNativeWindow();
if (windowAndroid == null) return false;
return windowAndroid.canRequestPermission(Manifest.permission.ACCESS_FINE_LOCATION);
@@ -75,7 +74,7 @@ public class LocationSettings {
private static void promptToEnableSystemLocationSetting(
@LocationSettingsDialogContextEnum int promptContext, WebContents webContents,
final long nativeCallback) {
- WindowAndroid window = windowFromWebContents(webContents);
+ WindowAndroid window = webContents.getTopLevelNativeWindow();
if (window == null) {
nativeOnLocationSettingsDialogOutcome(
nativeCallback, LocationSettingsDialogOutcome.NO_PROMPT);
@@ -110,11 +109,5 @@ public class LocationSettings {
sInstance = instance;
}
- private static WindowAndroid windowFromWebContents(WebContents webContents) {
- ContentViewCore contentViewCore = ContentViewCore.fromWebContents(webContents);
- if (contentViewCore == null) return null;
- return contentViewCore.getWindowAndroid();
- }
-
private static native void nativeOnLocationSettingsDialogOutcome(long callback, int result);
}

Powered by Google App Engine
This is Rietveld 408576698