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

Move branding information out of google_util

google_util is intended for componentization, whereas the information of what
the current brand is and whether a given brand is organic is inherently
embedder-specific. This functionality is moved to a new google_brand namespace.

BUG=373224
TBR=jochen

Review URL: https://codereview.chromium.org/316963002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275413 0039d316-1c4b-4281-b951-d872f2087c98
parent 438f807d
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include "base/prefs/pref_service.h" #include "base/prefs/pref_service.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "chrome/browser/auto_launch_trial.h" #include "chrome/browser/auto_launch_trial.h"
#include "chrome/browser/google/google_util.h" #include "chrome/browser/google/google_brand.h"
#include "chrome/browser/omnibox/omnibox_field_trial.h" #include "chrome/browser/omnibox/omnibox_field_trial.h"
#include "chrome/browser/prerender/prerender_field_trial.h" #include "chrome/browser/prerender/prerender_field_trial.h"
#include "chrome/browser/profiles/profiles_state.h" #include "chrome/browser/profiles/profiles_state.h"
...@@ -38,7 +38,7 @@ namespace { ...@@ -38,7 +38,7 @@ namespace {
void AutoLaunchChromeFieldTrial() { void AutoLaunchChromeFieldTrial() {
std::string brand; std::string brand;
google_util::GetBrand(&brand); google_brand::GetBrand(&brand);
// Create a 100% field trial based on the brand code. // Create a 100% field trial based on the brand code.
if (auto_launch_trial::IsInExperimentGroup(brand)) { if (auto_launch_trial::IsInExperimentGroup(brand)) {
......
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
#include "chrome/browser/chromeos/settings/cros_settings.h" #include "chrome/browser/chromeos/settings/cros_settings.h"
#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/first_run/first_run.h" #include "chrome/browser/first_run/first_run.h"
#include "chrome/browser/google/google_util_chromeos.h" #include "chrome/browser/google/google_brand_chromeos.h"
#include "chrome/browser/lifetime/application_lifetime.h" #include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/pref_service_flags_storage.h" #include "chrome/browser/pref_service_flags_storage.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
...@@ -673,7 +673,7 @@ void LoginUtilsImpl::InitRlzDelayed(Profile* user_profile) { ...@@ -673,7 +673,7 @@ void LoginUtilsImpl::InitRlzDelayed(Profile* user_profile) {
#if defined(ENABLE_RLZ) #if defined(ENABLE_RLZ)
if (!g_browser_process->local_state()->HasPrefPath(prefs::kRLZBrand)) { if (!g_browser_process->local_state()->HasPrefPath(prefs::kRLZBrand)) {
// Read brand code asynchronously from an OEM data and repost ourselves. // Read brand code asynchronously from an OEM data and repost ourselves.
google_util::chromeos::InitBrand( google_brand::chromeos::InitBrand(
base::Bind(&LoginUtilsImpl::InitRlzDelayed, AsWeakPtr(), user_profile)); base::Bind(&LoginUtilsImpl::InitRlzDelayed, AsWeakPtr(), user_profile));
return; return;
} }
...@@ -690,7 +690,7 @@ void LoginUtilsImpl::InitRlz(Profile* user_profile, bool disabled) { ...@@ -690,7 +690,7 @@ void LoginUtilsImpl::InitRlz(Profile* user_profile, bool disabled) {
PrefService* local_state = g_browser_process->local_state(); PrefService* local_state = g_browser_process->local_state();
if (disabled) { if (disabled) {
// Empty brand code means an organic install (no RLZ pings are sent). // Empty brand code means an organic install (no RLZ pings are sent).
google_util::chromeos::ClearBrandForCurrentSession(); google_brand::chromeos::ClearBrandForCurrentSession();
} }
if (disabled != local_state->GetBoolean(prefs::kRLZDisabled)) { if (disabled != local_state->GetBoolean(prefs::kRLZDisabled)) {
// When switching to RLZ enabled/disabled state, clear all recorded events. // When switching to RLZ enabled/disabled state, clear all recorded events.
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#include "chrome/browser/extensions/updater/extension_updater.h" #include "chrome/browser/extensions/updater/extension_updater.h"
#include "chrome/browser/extensions/updater/manifest_fetch_data.h" #include "chrome/browser/extensions/updater/manifest_fetch_data.h"
#include "chrome/browser/extensions/updater/request_queue_impl.h" #include "chrome/browser/extensions/updater/request_queue_impl.h"
#include "chrome/browser/google/google_util.h" #include "chrome/browser/google/google_brand.h"
#include "chrome/browser/omaha_query_params/omaha_query_params.h" #include "chrome/browser/omaha_query_params/omaha_query_params.h"
#include "chrome/browser/prefs/pref_service_syncable.h" #include "chrome/browser/prefs/pref_service_syncable.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
...@@ -1376,7 +1376,7 @@ class ExtensionUpdaterTest : public testing::Test { ...@@ -1376,7 +1376,7 @@ class ExtensionUpdaterTest : public testing::Test {
} }
void TestGalleryRequestsWithBrand(bool use_organic_brand_code) { void TestGalleryRequestsWithBrand(bool use_organic_brand_code) {
google_util::BrandForTesting brand_for_testing( google_brand::BrandForTesting brand_for_testing(
use_organic_brand_code ? "GGLS" : "TEST"); use_organic_brand_code ? "GGLS" : "TEST");
// We want to test a variety of combinations of expected ping conditions for // We want to test a variety of combinations of expected ping conditions for
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include "base/metrics/histogram.h" #include "base/metrics/histogram.h"
#include "base/strings/string_number_conversions.h" #include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "chrome/browser/google/google_util.h" #include "chrome/browser/google/google_brand.h"
#include "chrome/browser/metrics/chrome_metrics_service_accessor.h" #include "chrome/browser/metrics/chrome_metrics_service_accessor.h"
#include "chrome/browser/omaha_query_params/omaha_query_params.h" #include "chrome/browser/omaha_query_params/omaha_query_params.h"
#include "net/base/escape.h" #include "net/base/escape.h"
...@@ -91,8 +91,8 @@ bool ManifestFetchData::AddExtension(const std::string& id, ...@@ -91,8 +91,8 @@ bool ManifestFetchData::AddExtension(const std::string& id,
if (base_url_.DomainIs("google.com")) { if (base_url_.DomainIs("google.com")) {
#if defined(GOOGLE_CHROME_BUILD) #if defined(GOOGLE_CHROME_BUILD)
std::string brand; std::string brand;
google_util::GetBrand(&brand); google_brand::GetBrand(&brand);
if (!brand.empty() && !google_util::IsOrganic(brand)) if (!brand.empty() && !google_brand::IsOrganic(brand))
parts.push_back("brand=" + brand); parts.push_back("brand=" + brand);
#endif #endif
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/updater/extension_updater.h" #include "chrome/browser/extensions/updater/extension_updater.h"
#include "chrome/browser/first_run/first_run_internal.h" #include "chrome/browser/first_run/first_run_internal.h"
#include "chrome/browser/google/google_util.h" #include "chrome/browser/google/google_brand.h"
#include "chrome/browser/importer/external_process_importer_host.h" #include "chrome/browser/importer/external_process_importer_host.h"
#include "chrome/browser/importer/importer_list.h" #include "chrome/browser/importer/importer_list.h"
#include "chrome/browser/importer/importer_progress_observer.h" #include "chrome/browser/importer/importer_progress_observer.h"
...@@ -566,8 +566,8 @@ bool CreateSentinel() { ...@@ -566,8 +566,8 @@ bool CreateSentinel() {
#if !defined(OS_LINUX) && !defined(OS_BSD) #if !defined(OS_LINUX) && !defined(OS_BSD)
bool IsOrganicFirstRun() { bool IsOrganicFirstRun() {
std::string brand; std::string brand;
google_util::GetBrand(&brand); google_brand::GetBrand(&brand);
return google_util::IsOrganicFirstRun(brand); return google_brand::IsOrganicFirstRun(brand);
} }
#endif #endif
......
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/google/google_brand.h"
#include <string>
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/installer/util/google_update_settings.h"
#if defined(OS_MACOSX)
#include "chrome/browser/mac/keystone_glue.h"
#elif defined(OS_CHROMEOS)
#include "chrome/browser/google/google_brand_chromeos.h"
#endif
// Helpers --------------------------------------------------------------------
namespace {
const char* g_brand_for_testing = NULL;
} // namespace
namespace google_brand {
// Global functions -----------------------------------------------------------
#if defined(OS_WIN)
bool GetBrand(std::string* brand) {
if (g_brand_for_testing) {
brand->assign(g_brand_for_testing);
return true;
}
base::string16 brand16;
bool ret = GoogleUpdateSettings::GetBrand(&brand16);
if (ret)
brand->assign(base::UTF16ToASCII(brand16));
return ret;
}
bool GetReactivationBrand(std::string* brand) {
base::string16 brand16;
bool ret = GoogleUpdateSettings::GetReactivationBrand(&brand16);
if (ret)
brand->assign(base::UTF16ToASCII(brand16));
return ret;
}
#else
bool GetBrand(std::string* brand) {
if (g_brand_for_testing) {
brand->assign(g_brand_for_testing);
return true;
}
#if defined(OS_MACOSX)
brand->assign(keystone_glue::BrandCode());
#elif defined(OS_CHROMEOS)
brand->assign(google_brand::chromeos::GetBrand());
#else
brand->clear();
#endif
return true;
}
bool GetReactivationBrand(std::string* brand) {
brand->clear();
return true;
}
#endif
bool IsOrganic(const std::string& brand) {
#if defined(OS_MACOSX)
if (brand.empty()) {
// An empty brand string on Mac is used for channels other than stable,
// which are always organic.
return true;
}
#endif
const char* const kBrands[] = {
"CHCA", "CHCB", "CHCG", "CHCH", "CHCI", "CHCJ", "CHCK", "CHCL",
"CHFO", "CHFT", "CHHS", "CHHM", "CHMA", "CHMB", "CHME", "CHMF",
"CHMG", "CHMH", "CHMI", "CHMQ", "CHMV", "CHNB", "CHNC", "CHNG",
"CHNH", "CHNI", "CHOA", "CHOB", "CHOC", "CHON", "CHOO", "CHOP",
"CHOQ", "CHOR", "CHOS", "CHOT", "CHOU", "CHOX", "CHOY", "CHOZ",
"CHPD", "CHPE", "CHPF", "CHPG", "ECBA", "ECBB", "ECDA", "ECDB",
"ECSA", "ECSB", "ECVA", "ECVB", "ECWA", "ECWB", "ECWC", "ECWD",
"ECWE", "ECWF", "EUBB", "EUBC", "GGLA", "GGLS"
};
const char* const* end = &kBrands[arraysize(kBrands)];
const char* const* found = std::find(&kBrands[0], end, brand);
if (found != end)
return true;
return StartsWithASCII(brand, "EUB", true) ||
StartsWithASCII(brand, "EUC", true) ||
StartsWithASCII(brand, "GGR", true);
}
bool IsOrganicFirstRun(const std::string& brand) {
#if defined(OS_MACOSX)
if (brand.empty()) {
// An empty brand string on Mac is used for channels other than stable,
// which are always organic.
return true;
}
#endif
return StartsWithASCII(brand, "GG", true) ||
StartsWithASCII(brand, "EU", true);
}
bool IsInternetCafeBrandCode(const std::string& brand) {
const char* const kBrands[] = {
"CHIQ", "CHSG", "HLJY", "NTMO", "OOBA", "OOBB", "OOBC", "OOBD", "OOBE",
"OOBF", "OOBG", "OOBH", "OOBI", "OOBJ", "IDCM",
};
const char* const* end = &kBrands[arraysize(kBrands)];
const char* const* found = std::find(&kBrands[0], end, brand);
return found != end;
}
// BrandForTesting ------------------------------------------------------------
BrandForTesting::BrandForTesting(const std::string& brand) : brand_(brand) {
DCHECK(g_brand_for_testing == NULL);
g_brand_for_testing = brand_.c_str();
}
BrandForTesting::~BrandForTesting() {
g_brand_for_testing = NULL;
}
} // namespace google_brand
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// This namespace provides various helpers and state relating to Google Chrome
// distributions (such as RLZ), and specifically relating to the brand of the
// current install. Brands are codes that are assigned to partners for tracking
// distribution information.
#ifndef CHROME_BROWSER_GOOGLE_GOOGLE_BRAND_H__
#define CHROME_BROWSER_GOOGLE_GOOGLE_BRAND_H__
#include <string>
#include "base/basictypes.h"
class GURL;
namespace google_brand {
// Returns in |brand| the brand code or distribution tag that has been
// assigned to a partner. Returns false if the information is not available.
bool GetBrand(std::string* brand);
// Returns in |brand| the reactivation brand code or distribution tag
// that has been assigned to a partner for reactivating a dormant chrome
// install. Returns false if the information is not available.
bool GetReactivationBrand(std::string* brand);
// True if a build is strictly organic, according to its brand code.
bool IsOrganic(const std::string& brand);
// True if a build should run as organic during first run. This uses
// a slightly different set of brand codes from the standard IsOrganic
// method.
bool IsOrganicFirstRun(const std::string& brand);
// True if |brand| is an internet cafe brand code.
bool IsInternetCafeBrandCode(const std::string& brand);
// This class is meant to be used only from test code, and sets the brand
// code returned by the function GetBrand() above while the object exists.
class BrandForTesting {
public:
explicit BrandForTesting(const std::string& brand);
~BrandForTesting();
private:
std::string brand_;
DISALLOW_COPY_AND_ASSIGN(BrandForTesting);
};
} // namespace google_brand
#endif // CHROME_BROWSER_GOOGLE_GOOGLE_BRAND_H__
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include "chromeos/system/statistics_provider.h" #include "chromeos/system/statistics_provider.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
namespace google_util { namespace google_brand {
namespace chromeos { namespace chromeos {
namespace { namespace {
...@@ -82,4 +82,4 @@ void InitBrand(const base::Closure& callback) { ...@@ -82,4 +82,4 @@ void InitBrand(const base::Closure& callback) {
} }
} // namespace chromeos } // namespace chromeos
} // namespace google_util } // namespace google_brand
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CHROME_BROWSER_GOOGLE_GOOGLE_UTIL_CHROMEOS_H_ #ifndef CHROME_BROWSER_GOOGLE_GOOGLE_BRAND_CHROMEOS_H_
#define CHROME_BROWSER_GOOGLE_GOOGLE_UTIL_CHROMEOS_H_ #define CHROME_BROWSER_GOOGLE_GOOGLE_BRAND_CHROMEOS_H_
#include <string> #include <string>
#include "base/callback_forward.h" #include "base/callback_forward.h"
namespace google_util { namespace google_brand {
namespace chromeos { namespace chromeos {
// Returns the brand code stored in Local State that has been assigned to a // Returns the brand code stored in Local State that has been assigned to a
...@@ -26,6 +26,6 @@ void ClearBrandForCurrentSession(); ...@@ -26,6 +26,6 @@ void ClearBrandForCurrentSession();
void InitBrand(const base::Closure& callback); void InitBrand(const base::Closure& callback);
} // namespace chromeos } // namespace chromeos
} // namespace google_util } // namespace google_brand
#endif // CHROME_BROWSER_GOOGLE_GOOGLE_UTIL_CHROMEOS_H_ #endif // CHROME_BROWSER_GOOGLE_GOOGLE_BRAND_CHROMEOS_H_
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/path_service.h" #include "base/path_service.h"
#include "base/test/scoped_path_override.h" #include "base/test/scoped_path_override.h"
#include "chrome/browser/google/google_util.h" #include "chrome/browser/google/google_brand.h"
#include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_paths.h"
#include "chrome/installer/util/google_update_settings.h" #include "chrome/installer/util/google_update_settings.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -51,14 +51,14 @@ TEST_F(GoogleUpdateTest, LastRunTime) { ...@@ -51,14 +51,14 @@ TEST_F(GoogleUpdateTest, LastRunTime) {
TEST_F(GoogleUpdateTest, IsOrganicFirstRunBrandCodes) { TEST_F(GoogleUpdateTest, IsOrganicFirstRunBrandCodes) {
// Test some brand codes to ensure that future changes to this method won't // Test some brand codes to ensure that future changes to this method won't
// go unnoticed. // go unnoticed.
EXPECT_FALSE(google_util::IsOrganicFirstRun("CHFO")); EXPECT_FALSE(google_brand::IsOrganicFirstRun("CHFO"));
EXPECT_FALSE(google_util::IsOrganicFirstRun("CHMA")); EXPECT_FALSE(google_brand::IsOrganicFirstRun("CHMA"));
EXPECT_TRUE(google_util::IsOrganicFirstRun("EUBA")); EXPECT_TRUE(google_brand::IsOrganicFirstRun("EUBA"));
EXPECT_TRUE(google_util::IsOrganicFirstRun("GGRA")); EXPECT_TRUE(google_brand::IsOrganicFirstRun("GGRA"));
#if defined(OS_MACOSX) #if defined(OS_MACOSX)
// An empty brand string on Mac is used for channels other than stable, // An empty brand string on Mac is used for channels other than stable,
// which are always organic. // which are always organic.
EXPECT_TRUE(google_util::IsOrganicFirstRun("")); EXPECT_TRUE(google_brand::IsOrganicFirstRun(""));
#endif #endif
} }
...@@ -14,20 +14,12 @@ ...@@ -14,20 +14,12 @@
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/google/google_url_tracker.h"
#include "chrome/common/net/url_fixer_upper.h" #include "chrome/common/net/url_fixer_upper.h"
#include "chrome/installer/util/google_update_settings.h"
#include "components/google/core/browser/google_switches.h" #include "components/google/core/browser/google_switches.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h" #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
#include "net/base/url_util.h" #include "net/base/url_util.h"
#include "url/gurl.h" #include "url/gurl.h"
#if defined(OS_MACOSX)
#include "chrome/browser/mac/keystone_glue.h"
#elif defined(OS_CHROMEOS)
#include "chrome/browser/google/google_util_chromeos.h"
#endif
// Only use Link Doctor on official builds. It uses an API key, too, but // Only use Link Doctor on official builds. It uses an API key, too, but
// seems best to just disable it, for more responsive error pages and to reduce // seems best to just disable it, for more responsive error pages and to reduce
// server load. // server load.
...@@ -42,7 +34,6 @@ ...@@ -42,7 +34,6 @@
namespace { namespace {
const char* brand_for_testing = NULL;
bool gUseMockLinkDoctorBaseURLForTesting = false; bool gUseMockLinkDoctorBaseURLForTesting = false;
bool IsPathHomePageBase(const std::string& path) { bool IsPathHomePageBase(const std::string& path) {
...@@ -127,54 +118,6 @@ GURL GetGoogleSearchURL(GURL google_homepage_url) { ...@@ -127,54 +118,6 @@ GURL GetGoogleSearchURL(GURL google_homepage_url) {
return google_homepage_url.ReplaceComponents(replacements); return google_homepage_url.ReplaceComponents(replacements);
} }
#if defined(OS_WIN)
bool GetBrand(std::string* brand) {
if (brand_for_testing) {
brand->assign(brand_for_testing);
return true;
}
base::string16 brand16;
bool ret = GoogleUpdateSettings::GetBrand(&brand16);
if (ret)
brand->assign(base::UTF16ToASCII(brand16));
return ret;
}
bool GetReactivationBrand(std::string* brand) {
base::string16 brand16;
bool ret = GoogleUpdateSettings::GetReactivationBrand(&brand16);
if (ret)
brand->assign(base::UTF16ToASCII(brand16));
return ret;
}
#else
bool GetBrand(std::string* brand) {
if (brand_for_testing) {
brand->assign(brand_for_testing);
return true;
}
#if defined(OS_MACOSX)
brand->assign(keystone_glue::BrandCode());
#elif defined(OS_CHROMEOS)
brand->assign(google_util::chromeos::GetBrand());
#else
brand->clear();
#endif
return true;
}
bool GetReactivationBrand(std::string* brand) {
brand->clear();
return true;
}
#endif
GURL CommandLineGoogleBaseURL() { GURL CommandLineGoogleBaseURL() {
// Unit tests may add command-line flags after the first call to this // Unit tests may add command-line flags after the first call to this
// function, so we don't simply initialize a static |base_url| directly and // function, so we don't simply initialize a static |base_url| directly and
...@@ -254,69 +197,4 @@ bool IsGoogleSearchUrl(const GURL& url) { ...@@ -254,69 +197,4 @@ bool IsGoogleSearchUrl(const GURL& url) {
(!is_home_page_base && HasGoogleSearchQueryParam(url.query())); (!is_home_page_base && HasGoogleSearchQueryParam(url.query()));
} }
bool IsOrganic(const std::string& brand) {
#if defined(OS_MACOSX)
if (brand.empty()) {
// An empty brand string on Mac is used for channels other than stable,
// which are always organic.
return true;
}
#endif
const char* const kBrands[] = {
"CHCA", "CHCB", "CHCG", "CHCH", "CHCI", "CHCJ", "CHCK", "CHCL",
"CHFO", "CHFT", "CHHS", "CHHM", "CHMA", "CHMB", "CHME", "CHMF",
"CHMG", "CHMH", "CHMI", "CHMQ", "CHMV", "CHNB", "CHNC", "CHNG",
"CHNH", "CHNI", "CHOA", "CHOB", "CHOC", "CHON", "CHOO", "CHOP",
"CHOQ", "CHOR", "CHOS", "CHOT", "CHOU", "CHOX", "CHOY", "CHOZ",
"CHPD", "CHPE", "CHPF", "CHPG", "ECBA", "ECBB", "ECDA", "ECDB",
"ECSA", "ECSB", "ECVA", "ECVB", "ECWA", "ECWB", "ECWC", "ECWD",
"ECWE", "ECWF", "EUBB", "EUBC", "GGLA", "GGLS"
};
const char* const* end = &kBrands[arraysize(kBrands)];
const char* const* found = std::find(&kBrands[0], end, brand);
if (found != end)
return true;
return StartsWithASCII(brand, "EUB", true) ||
StartsWithASCII(brand, "EUC", true) ||
StartsWithASCII(brand, "GGR", true);
}
bool IsOrganicFirstRun(const std::string& brand) {
#if defined(OS_MACOSX)
if (brand.empty()) {
// An empty brand string on Mac is used for channels other than stable,
// which are always organic.
return true;
}
#endif
return StartsWithASCII(brand, "GG", true) ||
StartsWithASCII(brand, "EU", true);
}
bool IsInternetCafeBrandCode(const std::string& brand) {
const char* const kBrands[] = {
"CHIQ", "CHSG", "HLJY", "NTMO", "OOBA", "OOBB", "OOBC", "OOBD", "OOBE",
"OOBF", "OOBG", "OOBH", "OOBI", "OOBJ", "IDCM",
};
const char* const* end = &kBrands[arraysize(kBrands)];
const char* const* found = std::find(&kBrands[0], end, brand);
return found != end;
}
// BrandForTesting ------------------------------------------------------------
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;
}
} // namespace google_util } // namespace google_util
...@@ -13,8 +13,7 @@ ...@@ -13,8 +13,7 @@
class GURL; class GURL;
// This namespace provides various helpers around handling Google-related URLs // This namespace provides various helpers around handling Google-related URLs.
// and state relating to Google Chrome distributions (such as RLZ).
namespace google_util { namespace google_util {
// True iff |str| contains a "q=" query parameter with a non-empty value. // True iff |str| contains a "q=" query parameter with a non-empty value.
...@@ -45,15 +44,6 @@ std::string GetGoogleCountryCode(GURL google_homepage_url); ...@@ -45,15 +44,6 @@ std::string GetGoogleCountryCode(GURL google_homepage_url);
// Returns the Google search URL for the given Google homepage URL. // Returns the Google search URL for the given Google homepage URL.
GURL GetGoogleSearchURL(GURL google_homepage_url); GURL GetGoogleSearchURL(GURL google_homepage_url);
// Returns in |brand| the brand code or distribution tag that has been
// assigned to a partner. Returns false if the information is not available.
bool GetBrand(std::string* brand);
// Returns in |brand| the reactivation brand code or distribution tag
// that has been assigned to a partner for reactivating a dormant chrome
// install. Returns false if the information is not available.
bool GetReactivationBrand(std::string* brand);
// Returns the Google base URL specified on the command line, if it exists. // Returns the Google base URL specified on the command line, if it exists.
// This performs some fixup and sanity-checking to ensure that the resulting URL // This performs some fixup and sanity-checking to ensure that the resulting URL
// is valid and has no query or ref. // is valid and has no query or ref.
...@@ -113,29 +103,6 @@ bool IsGoogleHomePageUrl(const GURL& url); ...@@ -113,29 +103,6 @@ bool IsGoogleHomePageUrl(const GURL& url);
// True if |url| represents a valid Google search URL. // True if |url| represents a valid Google search URL.
bool IsGoogleSearchUrl(const GURL& url); bool IsGoogleSearchUrl(const GURL& url);
// True if a build is strictly organic, according to its brand code.
bool IsOrganic(const std::string& brand);
// True if a build should run as organic during first run. This uses
// a slightly different set of brand codes from the standard IsOrganic
// method.
bool IsOrganicFirstRun(const std::string& brand);
// True if |brand| is an internet cafe brand code.
bool IsInternetCafeBrandCode(const std::string& brand);
// This class is meant to be used only from test code, and sets the brand
// code returned by the function GetBrand() above while the object exists.
class BrandForTesting {
public:
explicit BrandForTesting(const std::string& brand);
~BrandForTesting();
private:
std::string brand_;
DISALLOW_COPY_AND_ASSIGN(BrandForTesting);
};
} // namespace google_util } // namespace google_util
#endif // CHROME_BROWSER_GOOGLE_GOOGLE_UTIL_H__ #endif // CHROME_BROWSER_GOOGLE_GOOGLE_UTIL_H__
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include "base/time/time.h" #include "base/time/time.h"
#include "chrome/browser/browser_process.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_util.h" #include "chrome/browser/google/google_brand.h"
#include "chrome/browser/memory_details.h" #include "chrome/browser/memory_details.h"
#include "chrome/browser/metrics/extensions_metrics_provider.h" #include "chrome/browser/metrics/extensions_metrics_provider.h"
#include "chrome/browser/metrics/metrics_service.h" #include "chrome/browser/metrics/metrics_service.h"
...@@ -159,7 +159,7 @@ std::string ChromeMetricsServiceClient::GetApplicationLocale() { ...@@ -159,7 +159,7 @@ std::string ChromeMetricsServiceClient::GetApplicationLocale() {
} }
bool ChromeMetricsServiceClient::GetBrand(std::string* brand_code) { bool ChromeMetricsServiceClient::GetBrand(std::string* brand_code) {
return google_util::GetBrand(brand_code); return google_brand::GetBrand(brand_code);
} }
metrics::SystemProfileProto::Channel ChromeMetricsServiceClient::GetChannel() { metrics::SystemProfileProto::Channel ChromeMetricsServiceClient::GetChannel() {
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include "base/values.h" #include "base/values.h"
#include "chrome/app/chrome_command_ids.h" #include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/google/google_util.h" #include "chrome/browser/google/google_brand.h"
#include "chrome/browser/profile_resetter/brandcode_config_fetcher.h" #include "chrome/browser/profile_resetter/brandcode_config_fetcher.h"
#include "chrome/browser/profile_resetter/profile_reset_global_error.h" #include "chrome/browser/profile_resetter/profile_reset_global_error.h"
#include "chrome/browser/profile_resetter/profile_resetter.h" #include "chrome/browser/profile_resetter/profile_resetter.h"
...@@ -193,7 +193,7 @@ void AutomaticProfileResetterDelegateImpl:: ...@@ -193,7 +193,7 @@ void AutomaticProfileResetterDelegateImpl::
return; return;
std::string brandcode; std::string brandcode;
google_util::GetBrand(&brandcode); google_brand::GetBrand(&brandcode);
if (brandcode.empty()) { if (brandcode.empty()) {
brandcoded_defaults_.reset(new BrandcodedDefaultSettings); brandcoded_defaults_.reset(new BrandcodedDefaultSettings);
brandcoded_defaults_fetched_event_.Signal(); brandcoded_defaults_fetched_event_.Signal();
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include "chrome/app/chrome_command_ids.h" #include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/extension_service_unittest.h" #include "chrome/browser/extensions/extension_service_unittest.h"
#include "chrome/browser/google/google_util.h" #include "chrome/browser/google/google_brand.h"
#include "chrome/browser/profile_resetter/brandcoded_default_settings.h" #include "chrome/browser/profile_resetter/brandcoded_default_settings.h"
#include "chrome/browser/profile_resetter/profile_reset_global_error.h" #include "chrome/browser/profile_resetter/profile_reset_global_error.h"
#include "chrome/browser/search_engines/default_search_manager.h" #include "chrome/browser/search_engines/default_search_manager.h"
...@@ -441,7 +441,7 @@ TEST_F(AutomaticProfileResetterDelegateTest, ...@@ -441,7 +441,7 @@ TEST_F(AutomaticProfileResetterDelegateTest,
TEST_F(AutomaticProfileResetterDelegateTest, TEST_F(AutomaticProfileResetterDelegateTest,
FetchAndWaitOnDefaultSettingsVanilla) { FetchAndWaitOnDefaultSettingsVanilla) {
google_util::BrandForTesting scoped_brand_for_testing((std::string())); google_brand::BrandForTesting scoped_brand_for_testing((std::string()));
// Expect ready_callback to be called just after empty brandcoded settings // Expect ready_callback to be called just after empty brandcoded settings
// are loaded, given this is a vanilla build. Fail if it is not called, or // are loaded, given this is a vanilla build. Fail if it is not called, or
...@@ -473,7 +473,7 @@ TEST_F(AutomaticProfileResetterDelegateTest, ...@@ -473,7 +473,7 @@ TEST_F(AutomaticProfileResetterDelegateTest,
TEST_F(AutomaticProfileResetterDelegateTest, TEST_F(AutomaticProfileResetterDelegateTest,
FetchAndWaitOnDefaultSettingsBranded) { FetchAndWaitOnDefaultSettingsBranded) {
google_util::BrandForTesting scoped_brand_for_testing(kTestBrandcode); google_brand::BrandForTesting scoped_brand_for_testing(kTestBrandcode);
// Expect ready_callback to be called just after the brandcoded settings are // Expect ready_callback to be called just after the brandcoded settings are
// downloaded. Fail if it is not called, or called too early. // downloaded. Fail if it is not called, or called too early.
...@@ -506,7 +506,7 @@ TEST_F(AutomaticProfileResetterDelegateTest, ...@@ -506,7 +506,7 @@ TEST_F(AutomaticProfileResetterDelegateTest,
TEST_F(AutomaticProfileResetterDelegateTest, TEST_F(AutomaticProfileResetterDelegateTest,
FetchAndWaitOnDefaultSettingsBrandedFailure) { FetchAndWaitOnDefaultSettingsBrandedFailure) {
google_util::BrandForTesting scoped_brand_for_testing(kTestBrandcode); google_brand::BrandForTesting scoped_brand_for_testing(kTestBrandcode);
// Expect ready_callback to be called just after the brandcoded settings have // Expect ready_callback to be called just after the brandcoded settings have
// failed to download. Fail if it is not called, or called too early. // failed to download. Fail if it is not called, or called too early.
...@@ -532,7 +532,7 @@ TEST_F(AutomaticProfileResetterDelegateTest, ...@@ -532,7 +532,7 @@ TEST_F(AutomaticProfileResetterDelegateTest,
} }
TEST_F(AutomaticProfileResetterDelegateTest, TriggerReset) { TEST_F(AutomaticProfileResetterDelegateTest, TriggerReset) {
google_util::BrandForTesting scoped_brand_for_testing(kTestBrandcode); google_brand::BrandForTesting scoped_brand_for_testing(kTestBrandcode);
PrefService* prefs = profile()->GetPrefs(); PrefService* prefs = profile()->GetPrefs();
DCHECK(prefs); DCHECK(prefs);
...@@ -551,7 +551,7 @@ TEST_F(AutomaticProfileResetterDelegateTest, TriggerReset) { ...@@ -551,7 +551,7 @@ TEST_F(AutomaticProfileResetterDelegateTest, TriggerReset) {
TEST_F(AutomaticProfileResetterDelegateTest, TEST_F(AutomaticProfileResetterDelegateTest,
TriggerResetWithDefaultSettingsAlreadyLoaded) { TriggerResetWithDefaultSettingsAlreadyLoaded) {
google_util::BrandForTesting scoped_brand_for_testing(kTestBrandcode); google_brand::BrandForTesting scoped_brand_for_testing(kTestBrandcode);
PrefService* prefs = profile()->GetPrefs(); PrefService* prefs = profile()->GetPrefs();
DCHECK(prefs); DCHECK(prefs);
...@@ -573,7 +573,7 @@ TEST_F(AutomaticProfileResetterDelegateTest, ...@@ -573,7 +573,7 @@ TEST_F(AutomaticProfileResetterDelegateTest,
TEST_F(AutomaticProfileResetterDelegateTest, TEST_F(AutomaticProfileResetterDelegateTest,
TriggerResetAndSendFeedback) { TriggerResetAndSendFeedback) {
google_util::BrandForTesting scoped_brand_for_testing(kTestBrandcode); google_brand::BrandForTesting scoped_brand_for_testing(kTestBrandcode);
PrefService* prefs = profile()->GetPrefs(); PrefService* prefs = profile()->GetPrefs();
DCHECK(prefs); DCHECK(prefs);
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "chrome/browser/browser_process.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_brand.h"
#include "chrome/browser/google/google_util.h" #include "chrome/browser/google/google_util.h"
#include "chrome/browser/omnibox/omnibox_log.h" #include "chrome/browser/omnibox/omnibox_log.h"
#include "chrome/browser/prefs/session_startup_pref.h" #include "chrome/browser/prefs/session_startup_pref.h"
...@@ -65,7 +66,7 @@ const base::TimeDelta kMaxInitDelay = base::TimeDelta::FromSeconds(200); ...@@ -65,7 +66,7 @@ const base::TimeDelta kMaxInitDelay = base::TimeDelta::FromSeconds(200);
const base::TimeDelta kMinInitDelay = base::TimeDelta::FromSeconds(20); const base::TimeDelta kMinInitDelay = base::TimeDelta::FromSeconds(20);
bool IsBrandOrganic(const std::string& brand) { bool IsBrandOrganic(const std::string& brand) {
return brand.empty() || google_util::IsOrganic(brand); return brand.empty() || google_brand::IsOrganic(brand);
} }
void RecordProductEvents(bool first_run, void RecordProductEvents(bool first_run,
...@@ -291,7 +292,7 @@ bool RLZTracker::Init(bool first_run, ...@@ -291,7 +292,7 @@ bool RLZTracker::Init(bool first_run,
delay = std::min(kMaxInitDelay, std::max(min_init_delay_, delay)); delay = std::min(kMaxInitDelay, std::max(min_init_delay_, delay));
if (google_util::GetBrand(&brand_) && !IsBrandOrganic(brand_)) { if (google_brand::GetBrand(&brand_) && !IsBrandOrganic(brand_)) {
// Register for notifications from the omnibox so that we can record when // Register for notifications from the omnibox so that we can record when
// the user performs a first search. // the user performs a first search.
registrar_.Add(this, chrome::NOTIFICATION_OMNIBOX_OPENED_URL, registrar_.Add(this, chrome::NOTIFICATION_OMNIBOX_OPENED_URL,
...@@ -304,7 +305,7 @@ bool RLZTracker::Init(bool first_run, ...@@ -304,7 +305,7 @@ bool RLZTracker::Init(bool first_run,
content::NotificationService::AllSources()); content::NotificationService::AllSources());
#endif // !defined(OS_IOS) #endif // !defined(OS_IOS)
} }
google_util::GetReactivationBrand(&reactivation_brand_); google_brand::GetReactivationBrand(&reactivation_brand_);
net::URLRequestContextGetter* context_getter = net::URLRequestContextGetter* context_getter =
g_browser_process->system_request_context(); g_browser_process->system_request_context();
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include "chrome/browser/autocomplete/autocomplete_controller.h" #include "chrome/browser/autocomplete/autocomplete_controller.h"
#include "chrome/browser/autocomplete/autocomplete_input.h" #include "chrome/browser/autocomplete/autocomplete_input.h"
#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/google/google_util.h" #include "chrome/browser/google/google_brand.h"
#include "chrome/browser/omnibox/omnibox_log.h" #include "chrome/browser/omnibox/omnibox_log.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/installer/util/browser_distribution.h" #include "chrome/installer/util/browser_distribution.h"
...@@ -182,7 +182,7 @@ class RlzLibTest : public RlzLibTestNoMachineState { ...@@ -182,7 +182,7 @@ class RlzLibTest : public RlzLibTestNoMachineState {
TestRLZTracker tracker_; TestRLZTracker tracker_;
#if defined(OS_POSIX) #if defined(OS_POSIX)
scoped_ptr<google_util::BrandForTesting> brand_override_; scoped_ptr<google_brand::BrandForTesting> brand_override_;
#endif #endif
}; };
...@@ -199,10 +199,10 @@ void RlzLibTest::SetMainBrand(const char* brand) { ...@@ -199,10 +199,10 @@ void RlzLibTest::SetMainBrand(const char* brand) {
#if defined(OS_WIN) #if defined(OS_WIN)
SetRegistryBrandValue(google_update::kRegRLZBrandField, brand); SetRegistryBrandValue(google_update::kRegRLZBrandField, brand);
#elif defined(OS_POSIX) #elif defined(OS_POSIX)
brand_override_.reset(new google_util::BrandForTesting(brand)); brand_override_.reset(new google_brand::BrandForTesting(brand));
#endif #endif
std::string check_brand; std::string check_brand;
google_util::GetBrand(&check_brand); google_brand::GetBrand(&check_brand);
EXPECT_EQ(brand, check_brand); EXPECT_EQ(brand, check_brand);
} }
...@@ -211,7 +211,7 @@ void RlzLibTest::SetReactivationBrand(const char* brand) { ...@@ -211,7 +211,7 @@ void RlzLibTest::SetReactivationBrand(const char* brand) {
#if defined(OS_WIN) #if defined(OS_WIN)
SetRegistryBrandValue(google_update::kRegRLZReactivationBrandField, brand); SetRegistryBrandValue(google_update::kRegRLZReactivationBrandField, brand);
std::string check_brand; std::string check_brand;
google_util::GetReactivationBrand(&check_brand); google_brand::GetReactivationBrand(&check_brand);
EXPECT_EQ(brand, check_brand); EXPECT_EQ(brand, check_brand);
#endif #endif
} }
...@@ -278,13 +278,13 @@ void RlzLibTest::ExpectEventRecorded(const char* event_name, bool expected) { ...@@ -278,13 +278,13 @@ void RlzLibTest::ExpectEventRecorded(const char* event_name, bool expected) {
void RlzLibTest::ExpectRlzPingSent(bool expected) { void RlzLibTest::ExpectRlzPingSent(bool expected) {
std::string brand; std::string brand;
google_util::GetBrand(&brand); google_brand::GetBrand(&brand);
EXPECT_EQ(expected, tracker_.was_ping_sent_for_brand(brand.c_str())); EXPECT_EQ(expected, tracker_.was_ping_sent_for_brand(brand.c_str()));
} }
void RlzLibTest::ExpectReactivationRlzPingSent(bool expected) { void RlzLibTest::ExpectReactivationRlzPingSent(bool expected) {
std::string brand; std::string brand;
google_util::GetReactivationBrand(&brand); google_brand::GetReactivationBrand(&brand);
EXPECT_EQ(expected, tracker_.was_ping_sent_for_brand(brand.c_str())); EXPECT_EQ(expected, tracker_.was_ping_sent_for_brand(brand.c_str()));
} }
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "base/metrics/field_trial.h" #include "base/metrics/field_trial.h"
#include "base/prefs/pref_service.h" #include "base/prefs/pref_service.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/google/google_brand.h"
#include "chrome/browser/google/google_profile_helper.h" #include "chrome/browser/google/google_profile_helper.h"
#include "chrome/browser/google/google_url_tracker.h" #include "chrome/browser/google/google_url_tracker.h"
#include "chrome/browser/google/google_util.h" #include "chrome/browser/google/google_util.h"
...@@ -122,8 +123,8 @@ base::string16 UIThreadSearchTermsData::GetRlzParameterValue( ...@@ -122,8 +123,8 @@ base::string16 UIThreadSearchTermsData::GetRlzParameterValue(
// For organic brandcodes do not use rlz at all. Empty brandcode usually // For organic brandcodes do not use rlz at all. Empty brandcode usually
// means a chromium install. This is ok. // means a chromium install. This is ok.
std::string brand; std::string brand;
if (google_util::GetBrand(&brand) && !brand.empty() && if (google_brand::GetBrand(&brand) && !brand.empty() &&
!google_util::IsOrganic(brand)) { !google_brand::IsOrganic(brand)) {
// This call will return false the first time(s) it is called until the // This call will return false the first time(s) it is called until the
// value has been cached. This normally would mean that at most one omnibox // value has been cached. This normally would mean that at most one omnibox
// search might not send the RLZ data but this is not really a problem. // search might not send the RLZ data but this is not really a problem.
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
#include "chrome/browser/google/google_util_chromeos.h" #include "chrome/browser/google/google_brand_chromeos.h"
#endif #endif
// Trivial subclass of TemplateURLService that records the last invocation of // Trivial subclass of TemplateURLService that records the last invocation of
...@@ -214,7 +214,7 @@ void TemplateURLServiceTestUtil::SetUp() { ...@@ -214,7 +214,7 @@ void TemplateURLServiceTestUtil::SetUp() {
TemplateURLServiceTestUtilBase::CreateTemplateUrlService(); TemplateURLServiceTestUtilBase::CreateTemplateUrlService();
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
google_util::chromeos::ClearBrandForCurrentSession(); google_brand::chromeos::ClearBrandForCurrentSession();
#endif #endif
} }
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#if defined(ENABLE_RLZ) #if defined(ENABLE_RLZ)
#include "chrome/browser/google/google_util.h" #include "chrome/browser/google/google_brand.h"
#endif #endif
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
...@@ -657,8 +657,8 @@ TEST_F(TemplateURLTest, RLZ) { ...@@ -657,8 +657,8 @@ TEST_F(TemplateURLTest, RLZ) {
base::string16 rlz_string; base::string16 rlz_string;
#if defined(ENABLE_RLZ) #if defined(ENABLE_RLZ)
std::string brand; std::string brand;
if (google_util::GetBrand(&brand) && !brand.empty() && if (google_brand::GetBrand(&brand) && !brand.empty() &&
!google_util::IsOrganic(brand)) { !google_brand::IsOrganic(brand)) {
RLZTracker::GetAccessPointRlz(RLZTracker::ChromeOmnibox(), &rlz_string); RLZTracker::GetAccessPointRlz(RLZTracker::ChromeOmnibox(), &rlz_string);
} }
#elif defined(OS_ANDROID) #elif defined(OS_ANDROID)
...@@ -687,8 +687,8 @@ TEST_F(TemplateURLTest, RLZFromAppList) { ...@@ -687,8 +687,8 @@ TEST_F(TemplateURLTest, RLZFromAppList) {
base::string16 rlz_string; base::string16 rlz_string;
#if defined(ENABLE_RLZ) #if defined(ENABLE_RLZ)
std::string brand; std::string brand;
if (google_util::GetBrand(&brand) && !brand.empty() && if (google_brand::GetBrand(&brand) && !brand.empty() &&
!google_util::IsOrganic(brand)) { !google_brand::IsOrganic(brand)) {
RLZTracker::GetAccessPointRlz(RLZTracker::ChromeAppList(), &rlz_string); RLZTracker::GetAccessPointRlz(RLZTracker::ChromeAppList(), &rlz_string);
} }
#endif #endif
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/first_run/first_run.h" #include "chrome/browser/first_run/first_run.h"
#include "chrome/browser/google/google_brand.h"
#include "chrome/browser/google/google_util.h" #include "chrome/browser/google/google_util.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_info_cache.h" #include "chrome/browser/profiles/profile_info_cache.h"
...@@ -62,12 +63,12 @@ bool g_force_web_based_signin_flow = false; ...@@ -62,12 +63,12 @@ bool g_force_web_based_signin_flow = false;
// Checks we want to show the sign in promo for the given brand. // Checks we want to show the sign in promo for the given brand.
bool AllowPromoAtStartupForCurrentBrand() { bool AllowPromoAtStartupForCurrentBrand() {
std::string brand; std::string brand;
google_util::GetBrand(&brand); google_brand::GetBrand(&brand);
if (brand.empty()) if (brand.empty())
return true; return true;
if (google_util::IsInternetCafeBrandCode(brand)) if (google_brand::IsInternetCafeBrandCode(brand))
return false; return false;
// Enable for both organic and distribution. // Enable for both organic and distribution.
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include "base/prefs/pref_service.h" #include "base/prefs/pref_service.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "base/values.h" #include "base/values.h"
#include "chrome/browser/google/google_util.h" #include "chrome/browser/google/google_brand.h"
#include "chrome/browser/profile_resetter/automatic_profile_resetter.h" #include "chrome/browser/profile_resetter/automatic_profile_resetter.h"
#include "chrome/browser/profile_resetter/automatic_profile_resetter_factory.h" #include "chrome/browser/profile_resetter/automatic_profile_resetter_factory.h"
#include "chrome/browser/profile_resetter/brandcode_config_fetcher.h" #include "chrome/browser/profile_resetter/brandcode_config_fetcher.h"
...@@ -29,7 +29,7 @@ namespace options { ...@@ -29,7 +29,7 @@ namespace options {
ResetProfileSettingsHandler::ResetProfileSettingsHandler() ResetProfileSettingsHandler::ResetProfileSettingsHandler()
: automatic_profile_resetter_(NULL), has_shown_confirmation_dialog_(false) { : automatic_profile_resetter_(NULL), has_shown_confirmation_dialog_(false) {
google_util::GetBrand(&brandcode_); google_brand::GetBrand(&brandcode_);
} }
ResetProfileSettingsHandler::~ResetProfileSettingsHandler() {} ResetProfileSettingsHandler::~ResetProfileSettingsHandler() {}
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include "base/time/time.h" #include "base/time/time.h"
#include "base/version.h" #include "base/version.h"
#include "chrome/browser/browser_process.h" #include "chrome/browser/browser_process.h"
#include "chrome/browser/google/google_util.h" #include "chrome/browser/google/google_brand.h"
#include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version_info.h" #include "chrome/common/chrome_version_info.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
...@@ -360,7 +360,7 @@ bool UpgradeDetectorImpl::DetectOutdatedInstall() { ...@@ -360,7 +360,7 @@ bool UpgradeDetectorImpl::DetectOutdatedInstall() {
static bool simulate_outdated = SimulatingOutdated(); static bool simulate_outdated = SimulatingOutdated();
if (!simulate_outdated) { if (!simulate_outdated) {
std::string brand; std::string brand;
if (google_util::GetBrand(&brand) && !google_util::IsOrganic(brand)) if (google_brand::GetBrand(&brand) && !google_brand::IsOrganic(brand))
return false; return false;
#if defined(OS_WIN) #if defined(OS_WIN)
......
...@@ -715,10 +715,12 @@ ...@@ -715,10 +715,12 @@
'browser/google/google_url_tracker_navigation_helper.h', 'browser/google/google_url_tracker_navigation_helper.h',
'browser/google/google_url_tracker_navigation_helper_impl.cc', 'browser/google/google_url_tracker_navigation_helper_impl.cc',
'browser/google/google_url_tracker_navigation_helper_impl.h', 'browser/google/google_url_tracker_navigation_helper_impl.h',
'browser/google/google_brand.cc',
'browser/google/google_brand.h',
'browser/google/google_brand_chromeos.cc',
'browser/google/google_brand_chromeos.h',
'browser/google/google_util.cc', 'browser/google/google_util.cc',
'browser/google/google_util.h', 'browser/google/google_util.h',
'browser/google/google_util_chromeos.cc',
'browser/google/google_util_chromeos.h',
'browser/gpu/gl_string_manager.cc', 'browser/gpu/gl_string_manager.cc',
'browser/gpu/gl_string_manager.h', 'browser/gpu/gl_string_manager.h',
'browser/gpu/gpu_feature_checker.cc', 'browser/gpu/gpu_feature_checker.cc',
......
...@@ -127,7 +127,7 @@ class GoogleUpdateSettings { ...@@ -127,7 +127,7 @@ class GoogleUpdateSettings {
// assigned to a partner. Returns false if the information is not available. // assigned to a partner. Returns false if the information is not available.
// //
// NOTE: This function is Windows only. If the code you are writing is not // NOTE: This function is Windows only. If the code you are writing is not
// specifically for Windows, prefer calling google_util::GetBrand(). // specifically for Windows, prefer calling google_brand::GetBrand().
static bool GetBrand(std::wstring* brand); static bool GetBrand(std::wstring* brand);
// Returns in |brand| the RLZ reactivation brand code or distribution tag // Returns in |brand| the RLZ reactivation brand code or distribution tag
...@@ -136,7 +136,7 @@ class GoogleUpdateSettings { ...@@ -136,7 +136,7 @@ class GoogleUpdateSettings {
// //
// NOTE: This function is Windows only. If the code you are writing is not // NOTE: This function is Windows only. If the code you are writing is not
// specifically for Windows, prefer calling // specifically for Windows, prefer calling
// google_util::GetReactivationBrand(). // google_brand::GetReactivationBrand().
static bool GetReactivationBrand(std::wstring* brand); static bool GetReactivationBrand(std::wstring* brand);
// Returns in |client| the google_update client field, which is currently // Returns in |client| the google_update client field, which is currently
......
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