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

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: rebase 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..505cdc0050771a0966d6183e2f7e95990651b044 100644
--- a/ui/android/java/src/org/chromium/ui/base/LocalizationUtils.java
+++ b/ui/android/java/src/org/chromium/ui/base/LocalizationUtils.java
@@ -4,12 +4,15 @@
package org.chromium.ui.base;
+import android.content.Context;
import android.content.res.Configuration;
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 +54,18 @@ public class LocalizationUtils {
}
/**
+ * Get the default country code set during install.
+ * @return country code.
+ */
+ @CalledByNative
+ private static String getDefaultCountryCode(Context context) {
+ CommandLine commandLine = CommandLine.getInstance();
+ return commandLine.hasSwitch(BaseSwitches.DEFAULT_COUNTRY_CODE_AT_INSTALL) ?
+ commandLine.getSwitchValue(BaseSwitches.DEFAULT_COUNTRY_CODE_AT_INSTALL) :
+ context.getResources().getConfiguration().locale.getCountry();
newt (away) 2014/10/06 18:34:03 Is context.getResources().getConfiguration().local
Yaron 2014/10/08 00:08:54 Done.
+ }
+
+ /**
* 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