summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorblundell@chromium.org <blundell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-11 15:24:52 +0000
committerblundell@chromium.org <blundell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-11 15:24:52 +0000
commitb8df56efb6abde9b8e445fffed5cc13342ef94d9 (patch)
tree8fd219971ada56d9e4d3f860c9062beb2364a75e
parent5be86f6b95d5770ac23cc8952c0a6b1ba1e6331e (diff)
downloadchromium_src-b8df56efb6abde9b8e445fffed5cc13342ef94d9.zip
chromium_src-b8df56efb6abde9b8e445fffed5cc13342ef94d9.tar.gz
chromium_src-b8df56efb6abde9b8e445fffed5cc13342ef94d9.tar.bz2
Change google_util::GetGoogleLocale() to take in the application locale
This function will be componentized and so cannot reference g_browser_process. google_util::AppendGoogleLocaleToURL() will be handled in followup work. BUG=373203 Review URL: https://codereview.chromium.org/327833002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@276406 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/google/google_util.cc13
-rw-r--r--chrome/browser/google/google_util.h7
-rw-r--r--chrome/browser/ui/navigation_correction_tab_observer.cc3
3 files changed, 11 insertions, 12 deletions
diff --git a/chrome/browser/google/google_util.cc b/chrome/browser/google/google_util.cc
index dead358..47e9d78 100644
--- a/chrome/browser/google/google_util.cc
+++ b/chrome/browser/google/google_util.cc
@@ -67,17 +67,14 @@ void SetMockLinkDoctorBaseURLForTesting() {
gUseMockLinkDoctorBaseURLForTesting = true;
}
-std::string GetGoogleLocale() {
- std::string locale = g_browser_process->GetApplicationLocale();
- // Google does not yet recognize 'nb' for Norwegian Bokmal, but it uses
- // 'no' for that.
- if (locale == "nb")
- return "no";
- return locale;
+std::string GetGoogleLocale(const std::string& application_locale) {
+ // Google does not recognize "nb" for Norwegian Bokmal; it uses "no".
+ return (application_locale == "nb") ? "no" : application_locale;
}
GURL AppendGoogleLocaleParam(const GURL& url) {
- return net::AppendQueryParameter(url, "hl", GetGoogleLocale());
+ return net::AppendQueryParameter(
+ url, "hl", GetGoogleLocale(g_browser_process->GetApplicationLocale()));
}
std::string StringAppendGoogleLocaleParam(const std::string& url) {
diff --git a/chrome/browser/google/google_util.h b/chrome/browser/google/google_util.h
index a8cc238..3210405 100644
--- a/chrome/browser/google/google_util.h
+++ b/chrome/browser/google/google_util.h
@@ -27,9 +27,10 @@ const char kInstantExtendedAPIParam[] = "espv";
GURL LinkDoctorBaseURL();
void SetMockLinkDoctorBaseURLForTesting();
-// Returns the Google locale. This is the same string as
-// AppendGoogleLocaleParam adds to the URL, only without the leading "hl".
-std::string GetGoogleLocale();
+// Returns the Google locale corresponding to |application_locale|. This is
+// the same string as AppendGoogleLocaleParam adds to the URL, only without the
+// leading "hl".
+std::string GetGoogleLocale(const std::string& application_locale);
// Adds the Google locale string to the URL (e.g., hl=en-US). This does not
// check to see if the param already exists.
diff --git a/chrome/browser/ui/navigation_correction_tab_observer.cc b/chrome/browser/ui/navigation_correction_tab_observer.cc
index 6ae211f..c9d563e 100644
--- a/chrome/browser/ui/navigation_correction_tab_observer.cc
+++ b/chrome/browser/ui/navigation_correction_tab_observer.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/ui/navigation_correction_tab_observer.h"
#include "base/prefs/pref_service.h"
+#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/google/google_profile_helper.h"
#include "chrome/browser/google/google_url_tracker_factory.h"
@@ -94,7 +95,7 @@ void NavigationCorrectionTabObserver::UpdateNavigationCorrectionInfo(
rfh->Send(new ChromeViewMsg_SetNavigationCorrectionInfo(
rfh->GetRoutingID(),
GetNavigationCorrectionURL(),
- google_util::GetGoogleLocale(),
+ google_util::GetGoogleLocale(g_browser_process->GetApplicationLocale()),
google_util::GetGoogleCountryCode(
google_profile_helper::GetGoogleHomePageURL(profile_)),
google_apis::GetAPIKey(),