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

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwContents.java

Issue 1172093002: Implement HttpUserAgentSettings delegate for Android WebView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: New plumbing Created 5 years, 6 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: android_webview/java/src/org/chromium/android_webview/AwContents.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java
index f901384752a503e169e19b9568866328fe7d3293..1535ba741c22fdc8652ac6b3cd6d245158b800e2 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -45,6 +45,7 @@ import android.widget.OverScroller;
import org.chromium.android_webview.permission.AwPermissionRequest;
import org.chromium.base.CalledByNative;
import org.chromium.base.JNINamespace;
+import org.chromium.base.LocaleUtils;
import org.chromium.base.ThreadUtils;
import org.chromium.base.TraceEvent;
import org.chromium.base.VisibleForTesting;
@@ -295,6 +296,8 @@ public class AwContents implements SmartClipProvider,
// Do not use directly, call isDestroyed() instead.
private boolean mIsDestroyed = false;
+ private static String sCurrentLocale;
+
private static final class DestroyRunnable implements Runnable {
private final long mNativeAwContents;
@@ -609,7 +612,12 @@ public class AwContents implements SmartClipProvider,
public void onLowMemory() {}
@Override
- public void onConfigurationChanged(Configuration configuration) {}
+ public void onConfigurationChanged(Configuration configuration) {
Torne 2015/07/17 13:33:19 Hm, so there's a bit of a problem here potentially
ctserng 2015/07/17 16:51:15 Good point. I'll see if it's possible to handle t
+ String newLocale = LocaleUtils.getLocale(configuration.locale);
+ if (!sCurrentLocale.equals(newLocale)) {
+ sCurrentLocale = newLocale;
+ }
+ }
};
//--------------------------------------------------------------------------------------------
@@ -651,6 +659,8 @@ public class AwContents implements SmartClipProvider,
InternalAccessDelegate internalAccessAdapter, NativeGLDelegate nativeGLDelegate,
AwContentsClient contentsClient, AwSettings settings,
DependencyFactory dependencyFactory) {
+ sCurrentLocale = LocaleUtils.getDefaultLocale();
+
mBrowserContext = browserContext;
// setWillNotDraw(false) is required since WebView draws it's own contents using it's
@@ -2392,6 +2402,11 @@ public class AwContents implements SmartClipProvider,
}
@CalledByNative
+ private static String getLocale() {
+ return sCurrentLocale;
+ }
+
+ @CalledByNative
private void onReceivedTouchIconUrl(String url, boolean precomposed) {
mContentsClient.onReceivedTouchIconUrl(url, precomposed);
}

Powered by Google App Engine
This is Rietveld 408576698