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

Unified Diff: base/android/java/src/org/chromium/base/LocaleUtils.java

Issue 628263004: [Android] Simplify logic for grabbing initial country-code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « base/android/java/src/org/chromium/base/BaseSwitches.java ('k') | base/android/locale_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/android/java/src/org/chromium/base/LocaleUtils.java
diff --git a/base/android/java/src/org/chromium/base/LocaleUtils.java b/base/android/java/src/org/chromium/base/LocaleUtils.java
index 31d4127340c1ac2408e1871160b1ea3239307320..4f97d3a25c74e8a9bb4c29b936ee9abcf942639c 100644
--- a/base/android/java/src/org/chromium/base/LocaleUtils.java
+++ b/base/android/java/src/org/chromium/base/LocaleUtils.java
@@ -20,6 +20,7 @@ public class LocaleUtils {
* @return the default locale, translating Android deprecated
* language codes into the modern ones used by Chromium.
*/
+ @CalledByNative
public static String getDefaultLocale() {
Locale locale = Locale.getDefault();
String language = locale.getLanguage();
@@ -38,4 +39,17 @@ public class LocaleUtils {
}
return country.isEmpty() ? language : language + "-" + country;
}
+
+ /**
+ * Get the default country code set during install.
+ * @return country code.
+ */
+ @CalledByNative
+ private static String getDefaultCountryCode() {
+ CommandLine commandLine = CommandLine.getInstance();
+ return commandLine.hasSwitch(BaseSwitches.DEFAULT_COUNTRY_CODE_AT_INSTALL) ?
+ commandLine.getSwitchValue(BaseSwitches.DEFAULT_COUNTRY_CODE_AT_INSTALL) :
+ Locale.getDefault().getCountry();
+ }
+
}
« no previous file with comments | « base/android/java/src/org/chromium/base/BaseSwitches.java ('k') | base/android/locale_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698