Commit b8df56ef authored by blundell@chromium.org's avatar blundell@chromium.org

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
parent 5be86f6b
...@@ -67,17 +67,14 @@ void SetMockLinkDoctorBaseURLForTesting() { ...@@ -67,17 +67,14 @@ void SetMockLinkDoctorBaseURLForTesting() {
gUseMockLinkDoctorBaseURLForTesting = true; gUseMockLinkDoctorBaseURLForTesting = true;
} }
std::string GetGoogleLocale() { std::string GetGoogleLocale(const std::string& application_locale) {
std::string locale = g_browser_process->GetApplicationLocale(); // Google does not recognize "nb" for Norwegian Bokmal; it uses "no".
// Google does not yet recognize 'nb' for Norwegian Bokmal, but it uses return (application_locale == "nb") ? "no" : application_locale;
// 'no' for that.
if (locale == "nb")
return "no";
return locale;
} }
GURL AppendGoogleLocaleParam(const GURL& url) { 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) { std::string StringAppendGoogleLocaleParam(const std::string& url) {
......
...@@ -27,9 +27,10 @@ const char kInstantExtendedAPIParam[] = "espv"; ...@@ -27,9 +27,10 @@ const char kInstantExtendedAPIParam[] = "espv";
GURL LinkDoctorBaseURL(); GURL LinkDoctorBaseURL();
void SetMockLinkDoctorBaseURLForTesting(); void SetMockLinkDoctorBaseURLForTesting();
// Returns the Google locale. This is the same string as // Returns the Google locale corresponding to |application_locale|. This is
// AppendGoogleLocaleParam adds to the URL, only without the leading "hl". // the same string as AppendGoogleLocaleParam adds to the URL, only without the
std::string GetGoogleLocale(); // 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 // Adds the Google locale string to the URL (e.g., hl=en-US). This does not
// check to see if the param already exists. // check to see if the param already exists.
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "chrome/browser/ui/navigation_correction_tab_observer.h" #include "chrome/browser/ui/navigation_correction_tab_observer.h"
#include "base/prefs/pref_service.h" #include "base/prefs/pref_service.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/google/google_profile_helper.h" #include "chrome/browser/google/google_profile_helper.h"
#include "chrome/browser/google/google_url_tracker_factory.h" #include "chrome/browser/google/google_url_tracker_factory.h"
...@@ -94,7 +95,7 @@ void NavigationCorrectionTabObserver::UpdateNavigationCorrectionInfo( ...@@ -94,7 +95,7 @@ void NavigationCorrectionTabObserver::UpdateNavigationCorrectionInfo(
rfh->Send(new ChromeViewMsg_SetNavigationCorrectionInfo( rfh->Send(new ChromeViewMsg_SetNavigationCorrectionInfo(
rfh->GetRoutingID(), rfh->GetRoutingID(),
GetNavigationCorrectionURL(), GetNavigationCorrectionURL(),
google_util::GetGoogleLocale(), google_util::GetGoogleLocale(g_browser_process->GetApplicationLocale()),
google_util::GetGoogleCountryCode( google_util::GetGoogleCountryCode(
google_profile_helper::GetGoogleHomePageURL(profile_)), google_profile_helper::GetGoogleHomePageURL(profile_)),
google_apis::GetAPIKey(), google_apis::GetAPIKey(),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment