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

Unified Diff: ui/android/java/src/org/chromium/ui/base/LocalizationUtils.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
Index: ui/android/java/src/org/chromium/ui/base/LocalizationUtils.java
diff --git a/ui/android/java/src/org/chromium/ui/base/LocalizationUtils.java b/ui/android/java/src/org/chromium/ui/base/LocalizationUtils.java
index becf1f4782890dfcdbb8874e4c9a944c0a08e8c6..eab8ea0d0eec1412e5024963e4cc1f9918964278 100644
--- a/ui/android/java/src/org/chromium/ui/base/LocalizationUtils.java
+++ b/ui/android/java/src/org/chromium/ui/base/LocalizationUtils.java
@@ -9,7 +9,9 @@ import android.view.View;
import org.chromium.base.ApiCompatibilityUtils;
import org.chromium.base.ApplicationStatus;
+import org.chromium.base.BaseSwitches;
import org.chromium.base.CalledByNative;
+import org.chromium.base.CommandLine;
import org.chromium.base.JNINamespace;
import org.chromium.base.LocaleUtils;
@@ -51,6 +53,18 @@ public class LocalizationUtils {
}
/**
+ * 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();
+ }
+
+ /**
* Returns whether the Android layout direction is RTL.
*
* Note that the locale direction can be different from layout direction. Two known cases:

Powered by Google App Engine
This is Rietveld 408576698