summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authormirandac@google.com <mirandac@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-02 20:34:09 +0000
committermirandac@google.com <mirandac@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-02 20:34:09 +0000
commitcbe7a169e2395eaec83c8dbfba16616de4e6700b (patch)
treea9d6d07f1de44e35ba7b34303d1da3fffffa8aea /chrome
parent6ba198fd7a578d370215fd5816962286070f9b3c (diff)
downloadchromium_src-cbe7a169e2395eaec83c8dbfba16616de4e6700b.zip
chromium_src-cbe7a169e2395eaec83c8dbfba16616de4e6700b.tar.gz
chromium_src-cbe7a169e2395eaec83c8dbfba16616de4e6700b.tar.bz2
Refactor check for organic install into GoogleUpdateSettings, for use elsewhere.
BUG=none TEST=none Review URL: http://codereview.chromium.org/2836041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51564 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/rlz/rlz.cc20
-rw-r--r--chrome/installer/util/google_update_settings.cc17
-rw-r--r--chrome/installer/util/google_update_settings.h3
3 files changed, 21 insertions, 19 deletions
diff --git a/chrome/browser/rlz/rlz.cc b/chrome/browser/rlz/rlz.cc
index 8a6b925..685692d 100644
--- a/chrome/browser/rlz/rlz.cc
+++ b/chrome/browser/rlz/rlz.cc
@@ -165,7 +165,7 @@ class DelayedInitTask : public Task {
// means a chromium install. This is ok.
std::wstring brand;
GoogleUpdateSettings::GetBrand(&brand);
- if (is_strict_organic(brand))
+ if (GoogleUpdateSettings::IsOrganic(brand))
return;
// Do the initial event recording if is the first run or if we have an
@@ -222,24 +222,6 @@ class DelayedInitTask : public Task {
return urlref->HasGoogleBaseURLs();
}
- static bool is_strict_organic(const std::wstring& brand) {
- static const wchar_t* kBrands[] = {
- L"CHFO", L"CHFT", L"CHHS", L"CHHM", L"CHMA", L"CHMB", L"CHME", L"CHMF",
- L"CHMG", L"CHMH", L"CHMI", L"CHMQ", L"CHMV", L"CHNB", L"CHNC", L"CHNG",
- L"CHNH", L"CHNI", L"CHOA", L"CHOB", L"CHOC", L"CHON", L"CHOO", L"CHOP",
- L"CHOQ", L"CHOR", L"CHOS", L"CHOT", L"CHOU", L"CHOX", L"CHOY", L"CHOZ",
- L"CHPD", L"CHPE", L"CHPF", L"CHPG", L"EUBB", L"EUBC", L"GGLA", L"GGLS"
- };
- const wchar_t** end = &kBrands[arraysize(kBrands)];
- const wchar_t** found = std::find(&kBrands[0], end, brand);
- if (found != end)
- return true;
- if (StartsWith(brand, L"EUB", true) || StartsWith(brand, L"EUC", true) ||
- StartsWith(brand, L"GGR", true))
- return true;
- return false;
- }
-
bool first_run_;
DISALLOW_IMPLICIT_CONSTRUCTORS(DelayedInitTask);
};
diff --git a/chrome/installer/util/google_update_settings.cc b/chrome/installer/util/google_update_settings.cc
index a5460e2..d7ffe99 100644
--- a/chrome/installer/util/google_update_settings.cc
+++ b/chrome/installer/util/google_update_settings.cc
@@ -239,3 +239,20 @@ std::wstring GoogleUpdateSettings::GetNewGoogleUpdateApKey(
return new_value;
}
+bool GoogleUpdateSettings::IsOrganic(const std::wstring& brand) {
+ static const wchar_t* kBrands[] = {
+ L"CHFO", L"CHFT", L"CHHS", L"CHHM", L"CHMA", L"CHMB", L"CHME", L"CHMF",
+ L"CHMG", L"CHMH", L"CHMI", L"CHMQ", L"CHMV", L"CHNB", L"CHNC", L"CHNG",
+ L"CHNH", L"CHNI", L"CHOA", L"CHOB", L"CHOC", L"CHON", L"CHOO", L"CHOP",
+ L"CHOQ", L"CHOR", L"CHOS", L"CHOT", L"CHOU", L"CHOX", L"CHOY", L"CHOZ",
+ L"CHPD", L"CHPE", L"CHPF", L"CHPG", L"EUBB", L"EUBC", L"GGLA", L"GGLS"
+ };
+ const wchar_t** end = &kBrands[arraysize(kBrands)];
+ const wchar_t** found = std::find(&kBrands[0], end, brand);
+ if (found != end)
+ return true;
+ if (StartsWith(brand, L"EUB", true) || StartsWith(brand, L"EUC", true) ||
+ StartsWith(brand, L"GGR", true))
+ return true;
+ return false;
+}
diff --git a/chrome/installer/util/google_update_settings.h b/chrome/installer/util/google_update_settings.h
index dd7145e..522b96b 100644
--- a/chrome/installer/util/google_update_settings.h
+++ b/chrome/installer/util/google_update_settings.h
@@ -104,6 +104,9 @@ class GoogleUpdateSettings {
int install_return_code,
const std::wstring& value);
+ // True if a build is strictly organic, according to its brand code.
+ static bool IsOrganic(const std::wstring& brand);
+
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(GoogleUpdateSettings);
};