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