diff options
author | rogerta@chromium.org <rogerta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-12 17:49:27 +0000 |
---|---|---|
committer | rogerta@chromium.org <rogerta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-12 17:49:27 +0000 |
commit | 1d70bdfef0f6cd5a4cf122365eaeb9f66747340a (patch) | |
tree | cda39e0acef1fe0724b56846f629df620c2e3c10 /chrome/browser/google/google_util.cc | |
parent | 4db3e9ddb4e2c0ce95196bb0a035a3b08dfdfc61 (diff) | |
download | chromium_src-1d70bdfef0f6cd5a4cf122365eaeb9f66747340a.zip chromium_src-1d70bdfef0f6cd5a4cf122365eaeb9f66747340a.tar.gz chromium_src-1d70bdfef0f6cd5a4cf122365eaeb9f66747340a.tar.bz2 |
Add brand code to app extension URLs. This should only occur for non-organic
brand code.
BUG=94920
TEST=Make sure to install chrome with a non-organic brand code. Look at the
update checks from any installed extensions (the default apps will do) and
make sure they have "brand%3DXXXX" in the URL, where XXXX is the brand code.
Review URL: http://codereview.chromium.org/8113007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105117 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/google/google_util.cc')
-rw-r--r-- | chrome/browser/google/google_util.cc | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/chrome/browser/google/google_util.cc b/chrome/browser/google/google_util.cc index 7eb1b35..dd2bb65 100644 --- a/chrome/browser/google/google_util.cc +++ b/chrome/browser/google/google_util.cc @@ -23,6 +23,8 @@ namespace { +const char* brand_for_testing = NULL; + // A helper method for adding a query param to |url|. GURL AppendParam(const GURL& url, const std::string& param_name, @@ -43,6 +45,15 @@ namespace google_util { const char kLinkDoctorBaseURL[] = "http://linkhelp.clients.google.com/tbproxy/lh/fixurl"; +BrandForTesting::BrandForTesting(const std::string& brand) : brand_(brand) { + DCHECK(brand_for_testing == NULL); + brand_for_testing = brand_.c_str(); +} + +BrandForTesting::~BrandForTesting() { + brand_for_testing = NULL; +} + GURL AppendGoogleLocaleParam(const GURL& url) { // Google does not yet recognize 'nb' for Norwegian Bokmal, but it uses // 'no' for that. @@ -74,6 +85,11 @@ GURL AppendGoogleTLDParam(const GURL& url) { #if defined(OS_WIN) bool GetBrand(std::string* brand) { + if (brand_for_testing) { + brand->assign(brand_for_testing); + return true; + } + string16 brand16; bool ret = GoogleUpdateSettings::GetBrand(&brand16); if (ret) @@ -92,6 +108,11 @@ bool GetReactivationBrand(std::string* brand) { #elif defined(OS_MACOSX) bool GetBrand(std::string* brand) { + if (brand_for_testing) { + brand->assign(brand_for_testing); + return true; + } + brand->assign(keystone_glue::BrandCode()); return true; } @@ -104,6 +125,11 @@ bool GetReactivationBrand(std::string* brand) { #else bool GetBrand(std::string* brand) { + if (brand_for_testing) { + brand->assign(brand_for_testing); + return true; + } + brand->clear(); return true; } |