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 76a9cc8ce54d67b7541cfb96b3e60ef6427c4c53..5315a410d82bd3c44fe919be1db74a701e933e23 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; |
@@ -294,6 +295,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; |
@@ -611,7 +614,12 @@ public class AwContents implements SmartClipProvider, |
public void onLowMemory() {} |
@Override |
- public void onConfigurationChanged(Configuration configuration) {} |
+ public void onConfigurationChanged(Configuration configuration) { |
+ String newLocale = LocaleUtils.getLocale(configuration.locale); |
+ if (!sCurrentLocale.equals(newLocale)) { |
Torne
2015/07/24 10:55:39
May not be worth checking if they're equal here si
ctserng
2015/07/24 18:17:22
The caching was left over from a previous patch wh
|
+ sCurrentLocale = newLocale; |
+ } |
+ } |
}; |
//-------------------------------------------------------------------------------------------- |
@@ -644,6 +652,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 |
@@ -2387,6 +2397,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); |
} |
@@ -2884,6 +2899,11 @@ public class AwContents implements SmartClipProvider, |
mContainerView.getHeight()); |
updateHardwareAcceleratedFeaturesToggle(); |
+ String currentLocale = LocaleUtils.getDefaultLocale(); |
+ if (!sCurrentLocale.equals(currentLocale)) { |
+ sCurrentLocale = currentLocale; |
+ } |
+ |
if (mComponentCallbacks != null) return; |
mComponentCallbacks = new AwComponentCallbacks(); |
mContext.registerComponentCallbacks(mComponentCallbacks); |