diff options
author | cpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-07 20:23:34 +0000 |
---|---|---|
committer | cpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-07 20:23:34 +0000 |
commit | 5984e47ab1f364a3483fc81c6aa260f5229ec363 (patch) | |
tree | 4219ad72bcce78e9d5695bbb95dcc7474d6b6a72 /chrome/browser/rlz | |
parent | 849b7f811d6781920f43d1403ed6baad0fa0dd82 (diff) | |
download | chromium_src-5984e47ab1f364a3483fc81c6aa260f5229ec363.zip chromium_src-5984e47ab1f364a3483fc81c6aa260f5229ec363.tar.gz chromium_src-5984e47ab1f364a3483fc81c6aa260f5229ec363.tar.bz2 |
Disable RLZ for organic chrome installs
- Uses a table of approved brandcodes
BUG=30948
TEST= see bug for testing details
Review URL: http://codereview.chromium.org/518062
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35723 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/rlz')
-rw-r--r-- | chrome/browser/rlz/rlz.cc | 22 | ||||
-rw-r--r-- | chrome/browser/rlz/rlz.h | 6 |
2 files changed, 26 insertions, 2 deletions
diff --git a/chrome/browser/rlz/rlz.cc b/chrome/browser/rlz/rlz.cc index 57e0f6a..669d674 100644 --- a/chrome/browser/rlz/rlz.cc +++ b/chrome/browser/rlz/rlz.cc @@ -8,6 +8,8 @@ #include "chrome/browser/rlz/rlz.h" +#include <algorithm> + #include <windows.h> #include <process.h> @@ -206,9 +208,10 @@ class DailyPingTask : public Task { } // Organic brands all start with GG, such as GGCM. - static bool is_organic(const std::wstring brand) { + static bool is_organic(const std::wstring& brand) { return (brand.size() < 2) ? false : (brand.substr(0,2) == L"GG"); } + }; // Performs late RLZ initialization and RLZ event recording for chrome. @@ -225,6 +228,13 @@ class DelayedInitTask : public Task { // because sometimes the very act of loading the dll causes QEMU to crash. if (::GetEnvironmentVariableW(env_vars::kHeadless, NULL, 0)) return; + // For organic brandcodes do not use rlz at all. Empty brandcode usually + // means a chromium install. This is ok. + std::wstring brand; + GoogleUpdateSettings::GetBrand(&brand); + if (is_strict_organic(brand)) + return; + if (!LoadRLZLibrary(directory_key_)) return; // Do the initial event recording if is the first run or if we have an @@ -280,6 +290,16 @@ class DelayedInitTask : public Task { return urlref->HasGoogleBaseURLs(); } + static bool is_strict_organic(const std::wstring& brand) { + const wchar_t* kBrands[] = { L"CHOA", L"CHOB", L"CHOC", L"CHOT", L"CHOU", + L"CHOR", L"CHOQ", L"CHOP", L"CHON", L"CHOO", + L"CHPD", L"CHPE", L"CHPF", L"CHPG", L"GGLS", + L"GGLA" }; + const wchar_t** end = &kBrands[arraysize(kBrands)]; + const wchar_t** found = std::find(&kBrands[0], end, brand); + return (found != end); + } + int directory_key_; bool first_run_; DISALLOW_IMPLICIT_CONSTRUCTORS(DelayedInitTask); diff --git a/chrome/browser/rlz/rlz.h b/chrome/browser/rlz/rlz.h index b4f1b9c4..c98f40d 100644 --- a/chrome/browser/rlz/rlz.h +++ b/chrome/browser/rlz/rlz.h @@ -66,13 +66,17 @@ class RLZTracker { // If the RLZ dll is not found in this directory the code falls back to try // to load it from base::DIR_EXE. // Returns false if the dll could not be loaded and initialized. - // This function is intended primarily for testing. + // + // This function is intended ONLY for testing. static bool InitRlz(int directory_key); // Like InitRlz() this function initializes the RLZ library services for use // in chrome. Besides binding the dll, it schedules a delayed task (delayed // by |delay| seconds) that performs the daily ping and registers some events // when 'first-run' is true. + // + // If the chrome brand is organic (no partners) then the RLZ library is not + // loaded or initialized and the pings don't ocurr. static bool InitRlzDelayed(int directory_key, bool first_run, int delay); // Records an RLZ event. Some events can be access point independent. |