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

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

Issue 2496183002: Use GetDefaultLocaleListString for returning LocaleList (Closed)
Patch Set: extract setLocale method, since configuration.getLocales() returns the same as LocaleUtils.getDefau… Created 4 years, 1 month 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 5a59ce7c7bf54715e17c7f679bc000589202032c..eedfd3eaeb0658da3595453c6e70928b557ed66a 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -360,7 +360,7 @@ public class AwContents implements SmartClipProvider, PostMessageSender.PostMess
// Do not use directly, call isDestroyed() instead.
private boolean mIsDestroyed = false;
- private static String sCurrentLocale = "";
+ private static String sCurrentLocales = "";
private static final class AwContentsDestroyRunnable implements Runnable {
private final long mNativeAwContents;
@@ -694,7 +694,7 @@ public class AwContents implements SmartClipProvider, PostMessageSender.PostMess
@Override
public void onConfigurationChanged(Configuration configuration) {
- setLocale(LocaleUtils.toLanguageTag(configuration.locale));
+ setLocale();
Seigo Nonaka 2016/11/15 05:15:59 setLocale() sounds confusing since it doesn't acce
Yirui Huang 2016/11/16 00:23:45 Done.
mSettings.updateAcceptLanguages();
}
};
@@ -745,7 +745,7 @@ public class AwContents implements SmartClipProvider, PostMessageSender.PostMess
InternalAccessDelegate internalAccessAdapter,
NativeDrawGLFunctorFactory nativeDrawGLFunctorFactory, AwContentsClient contentsClient,
AwSettings settings, DependencyFactory dependencyFactory) {
- setLocale(LocaleUtils.getDefaultLocaleString());
+ setLocale();
settings.updateAcceptLanguages();
mBrowserContext = browserContext;
@@ -1021,11 +1021,13 @@ public class AwContents implements SmartClipProvider, PostMessageSender.PostMess
return wrapper;
}
+ // Set and keep updating locales for webview.
Seigo Nonaka 2016/11/15 05:15:59 I'm confused with "keep updating". What does it in
Yirui Huang 2016/11/16 00:23:45 Done.
@VisibleForTesting
- public static void setLocale(String locale) {
- if (!sCurrentLocale.equals(locale)) {
- sCurrentLocale = locale;
- nativeSetLocale(sCurrentLocale);
+ public static void setLocale() {
+ String locales = LocaleUtils.getDefaultLocaleListString();
+ if (!sCurrentLocales.equals(locales)) {
+ sCurrentLocales = locales;
+ nativeSetLocale(LocaleUtils.getDefaultLocaleString(), sCurrentLocales);
Seigo Nonaka 2016/11/15 05:15:59 I think it is good to leave comments why you still
Yirui Huang 2016/11/16 00:23:45 Done.
}
}
@@ -3157,7 +3159,7 @@ public class AwContents implements SmartClipProvider, PostMessageSender.PostMess
postUpdateContentViewCoreVisibility();
mCurrentFunctor.onAttachedToWindow();
- setLocale(LocaleUtils.getDefaultLocaleString());
+ setLocale();
mSettings.updateAcceptLanguages();
if (mComponentCallbacks != null) return;
@@ -3309,7 +3311,7 @@ public class AwContents implements SmartClipProvider, PostMessageSender.PostMess
private static native void nativeSetAwDrawGLFunctionTable(long functionTablePointer);
private static native int nativeGetNativeInstanceCount();
private static native void nativeSetShouldDownloadFavicons();
- private static native void nativeSetLocale(String locale);
+ private static native void nativeSetLocale(String locale, String locales);
private native void nativeSetJavaPeers(long nativeAwContents, AwContents awContents,
AwWebContentsDelegate webViewWebContentsDelegate,

Powered by Google App Engine
This is Rietveld 408576698