diff options
author | cpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-20 03:57:25 +0000 |
---|---|---|
committer | cpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-20 03:57:25 +0000 |
commit | d38c8e73acde0577c3679415eff9ff047e299f09 (patch) | |
tree | ac3eb9f56df333cae3600e10dc73a4b96c19ac49 /chrome | |
parent | 021c6aacd0cfc3f5f8b24af3361dac0205c6fb04 (diff) | |
download | chromium_src-d38c8e73acde0577c3679415eff9ff047e299f09.zip chromium_src-d38c8e73acde0577c3679415eff9ff047e299f09.tar.gz chromium_src-d38c8e73acde0577c3679415eff9ff047e299f09.tar.bz2 |
Go back to a single toast flavor.
- We have picked a winner, code can go back to being simple.
- result codes are now TFxx
TEST=launch setup with --inactive-user-toast
BUG=none
Review URL: http://codereview.chromium.org/416002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32597 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/installer/setup/setup_main.cc | 7 | ||||
-rw-r--r-- | chrome/installer/util/browser_distribution.cc | 2 | ||||
-rw-r--r-- | chrome/installer/util/browser_distribution.h | 2 | ||||
-rw-r--r-- | chrome/installer/util/google_chrome_distribution.cc | 45 | ||||
-rw-r--r-- | chrome/installer/util/google_chrome_distribution.h | 5 |
5 files changed, 22 insertions, 39 deletions
diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc index 558326f..dab45e2 100644 --- a/chrome/installer/setup/setup_main.cc +++ b/chrome/installer/setup/setup_main.cc @@ -462,11 +462,8 @@ bool HandleNonInstallCmdLineOptions(const CommandLine& cmd_line, exit_code = tmp; return true; } else if (cmd_line.HasSwitch(installer_util::switches::kInactiveUserToast)) { - // Launch the inactive user toast experiment. If there is no value - // associated with the switch the function uses 0 as the flavor. - std::wstring flavor = - cmd_line.GetSwitchValue(installer_util::switches::kInactiveUserToast); - dist->InactiveUserToastExperiment(StringToInt(flavor)); + // Launch the inactive user toast experiment. + dist->InactiveUserToastExperiment(); return true; } return false; diff --git a/chrome/installer/util/browser_distribution.cc b/chrome/installer/util/browser_distribution.cc index 25ed75f..fe9884f 100644 --- a/chrome/installer/util/browser_distribution.cc +++ b/chrome/installer/util/browser_distribution.cc @@ -115,5 +115,5 @@ void BrowserDistribution::LaunchUserExperiment( } -void BrowserDistribution::InactiveUserToastExperiment(int flavor) { +void BrowserDistribution::InactiveUserToastExperiment() { } diff --git a/chrome/installer/util/browser_distribution.h b/chrome/installer/util/browser_distribution.h index 5d26219..8948bdc 100644 --- a/chrome/installer/util/browser_distribution.h +++ b/chrome/installer/util/browser_distribution.h @@ -66,7 +66,7 @@ class BrowserDistribution { // The user has qualified for the inactive user toast experiment and this // function just performs it. - virtual void InactiveUserToastExperiment(int flavor); + virtual void InactiveUserToastExperiment(); protected: BrowserDistribution() {} diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc index 1f6538b..faf574b 100644 --- a/chrome/installer/util/google_chrome_distribution.cc +++ b/chrome/installer/util/google_chrome_distribution.cc @@ -37,20 +37,12 @@ const wchar_t kChromeGuid[] = L"{8A69D345-D564-463c-AFF1-A69D9E530F96}"; // The following strings are the possible outcomes of the toast experiment // as recorded in the |client| field. Previously the groups used "TSxx" but // the data captured is not valid. -const wchar_t kToastExpQualifyGroup[] = L"T%lc01"; -const wchar_t kToastExpCancelGroup[] = L"T%lc02"; -const wchar_t kToastExpUninstallGroup[] = L"T%lc04"; -const wchar_t kToastExpTriesOkGroup[] = L"T%lc18"; -const wchar_t kToastExpTriesErrorGroup[] = L"T%lc28"; -const wchar_t kToastExpBaseGroup[] = L"T%lc80"; - -// Generates the actual group that gets written in the registry. -// |group| is a printf style string with a single %c replacement and |value| -// is a number between 0 and 19. -std::wstring GetExperimentGroup(const wchar_t* group, int flavor) { - wchar_t c = flavor < 20 ? L'A' + flavor : L'X'; - return StringPrintf(group, c); -} +const wchar_t kToastExpQualifyGroup[] = L"TF01"; +const wchar_t kToastExpCancelGroup[] = L"TF02"; +const wchar_t kToastExpUninstallGroup[] = L"TF04"; +const wchar_t kToastExpTriesOkGroup[] = L"TF18"; +const wchar_t kToastExpTriesErrorGroup[] = L"TF28"; +const wchar_t kToastExpBaseGroup[] = L"TF80"; // Substitute the locale parameter in uninstall URL with whatever // Google Update tells us is the locale. In case we fail to find @@ -104,12 +96,12 @@ int GetDirectoryWriteAgeInHours(const wchar_t* path) { return (now_time - dir_time); } -// Launches again this same process with a single switch --|flag|=|value|. +// Launches again this same process with a single switch --|flag|. // Does not wait for the process to terminate. -bool RelaunchSetup(const std::wstring& flag, int value) { +bool RelaunchSetup(const std::wstring& flag) { CommandLine cmd_line(CommandLine::ForCurrentProcess()->GetProgram()); // TODO: make switches into ASCII. - cmd_line.AppendSwitchWithValue(WideToASCII(flag), IntToWString(value)); + cmd_line.AppendSwitch(WideToASCII(flag)); return base::LaunchApp(cmd_line, false, false, NULL); } @@ -437,8 +429,6 @@ void GoogleChromeDistribution::LaunchUserExperiment( return; std::wstring brand; - int flavor = base::RandInt(0, 3); - if (GoogleUpdateSettings::GetBrand(&brand) && (brand == L"CHXX")) { // The user automatically qualifies for the experiment. LOG(INFO) << "Experiment qualification bypass"; @@ -466,27 +456,24 @@ void GoogleChromeDistribution::LaunchUserExperiment( // tag a control group, which is at random 50% of the population. if (base::RandDouble() > 0.5) { // We tag the user, but it wont participate in the experiment. - GoogleUpdateSettings::SetClient( - GetExperimentGroup(kToastExpQualifyGroup, flavor)); + GoogleUpdateSettings::SetClient(kToastExpQualifyGroup); LOG(INFO) << "User is toast experiment control group"; return; } } LOG(INFO) << "User drafted for toast experiment"; - if (!GoogleUpdateSettings::SetClient( - GetExperimentGroup(kToastExpBaseGroup, flavor))) + if (!GoogleUpdateSettings::SetClient(kToastExpBaseGroup)) return; // The experiment needs to be performed in a different process because // google_update expects the upgrade process to be quick and nimble. - RelaunchSetup(installer_util::switches::kInactiveUserToast, flavor); + RelaunchSetup(installer_util::switches::kInactiveUserToast); } -void GoogleChromeDistribution::InactiveUserToastExperiment(int flavor) { - // User qualifies for the experiment. Launch chrome with --try-chrome. Before - // that we need to change the client so we can track the progress. +void GoogleChromeDistribution::InactiveUserToastExperiment() { + // User qualifies for the experiment. Launch chrome with --try-chrome=0. int32 exit_code = 0; std::wstring option( - StringPrintf(L"--%ls=%d", switches::kTryChromeAgain, flavor)); + StringPrintf(L"--%ls=%d", switches::kTryChromeAgain, 0)); if (!installer::LaunchChromeAndWaitForResult(false, option, &exit_code)) return; // The chrome process has exited, figure out what happened. @@ -504,7 +491,7 @@ void GoogleChromeDistribution::InactiveUserToastExperiment(int flavor) { default: outcome = kToastExpTriesErrorGroup; }; - GoogleUpdateSettings::SetClient(GetExperimentGroup(outcome, flavor)); + GoogleUpdateSettings::SetClient(outcome); if (outcome != kToastExpUninstallGroup) return; // The user wants to uninstall. This is a best effort operation. Note that diff --git a/chrome/installer/util/google_chrome_distribution.h b/chrome/installer/util/google_chrome_distribution.h index 78fcdec8..c696e61 100644 --- a/chrome/installer/util/google_chrome_distribution.h +++ b/chrome/installer/util/google_chrome_distribution.h @@ -88,9 +88,8 @@ class GoogleChromeDistribution : public BrowserDistribution { // Assuming that the user qualifies, this function performs the inactive user // toast experiment. It will use chrome to show the UI and it will record the - // outcome in the registry. |flavor| is an extra parameter that controls the - // specific wording on the experiment. - virtual void InactiveUserToastExperiment(int flavor); + // outcome in the registry. + virtual void InactiveUserToastExperiment(); private: friend class BrowserDistribution; |