diff options
author | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-10 16:51:58 +0000 |
---|---|---|
committer | finnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-10 16:51:58 +0000 |
commit | 950f2d0ab8360f499272b3031efecb3750f89ab1 (patch) | |
tree | 72174c845d6ec2f26b77d0fd015a146edc599e21 /chrome | |
parent | 492d214950b16d229ced62021486e9e0ec859e40 (diff) | |
download | chromium_src-950f2d0ab8360f499272b3031efecb3750f89ab1.zip chromium_src-950f2d0ab8360f499272b3031efecb3750f89ab1.tar.gz chromium_src-950f2d0ab8360f499272b3031efecb3750f89ab1.tar.bz2 |
Change the toast text and make sure errors are written to
HKLM too (not just success messages).
The toast text changes are listed in the bug; basically we
have 4 experiments that differ only in the text we display
as a headline.
I also fixed an issue raised by QA with error codes being
written to HKCU as opposed to HKLM. This should fix that
issue.
BUG=http://crbug.com/54835, http://crbug.com/44378
TEST=Requires manual testing by QA.
Review URL: http://codereview.chromium.org/3341026
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59102 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/app/chromium_strings.grd | 12 | ||||
-rw-r--r-- | chrome/app/google_chrome_strings.grd | 10 | ||||
-rw-r--r-- | chrome/browser/first_run/first_run_win.cc | 23 | ||||
-rw-r--r-- | chrome/installer/util/google_chrome_distribution.cc | 81 |
4 files changed, 79 insertions, 47 deletions
diff --git a/chrome/app/chromium_strings.grd b/chrome/app/chromium_strings.grd index 2d9d895..5ad7c4c 100644 --- a/chrome/app/chromium_strings.grd +++ b/chrome/app/chromium_strings.grd @@ -427,9 +427,15 @@ be available for now. --> <message name="IDS_TRY_TOAST_HEADING" desc="Top line of the try-chrome-again dialog"> There is a new version of Chromium available. </message> - <message name="IDS_TRY_TOAST_ALT_HEADING" desc="Alternate top line of the try-chrome-again dialog"> - There's a new version of Chromium available that includes extensions. - </message> + <message name="IDS_TRY_TOAST_HEADING2" desc="Top line of the try-chrome-again dialog"> + There's a new version of Chromium available, and it's faster than ever. + </message> + <message name="IDS_TRY_TOAST_HEADING3" desc="Top line of the try-chrome-again dialog"> + There's a new, safer version of Chromium available. + </message> + <message name="IDS_TRY_TOAST_HEADING4" desc="Top line of the try-chrome-again dialog"> + Chromium has been updated, but you haven't used it for at least 30 days. + </message> <message name="IDS_TRY_TOAST_TRY_OPT" desc="First option radio button on the dialog to try chrome"> Try it out (already installed) </message> diff --git a/chrome/app/google_chrome_strings.grd b/chrome/app/google_chrome_strings.grd index 5b8325b..55e30fa 100644 --- a/chrome/app/google_chrome_strings.grd +++ b/chrome/app/google_chrome_strings.grd @@ -478,8 +478,14 @@ Chrome supports. --> <message name="IDS_TRY_TOAST_HEADING" desc="Top line of the try-chrome-again dialog"> There is a new version of Google Chrome available. </message> - <message name="IDS_TRY_TOAST_ALT_HEADING" desc="Alternate top line of the try-chrome-again dialog"> - There's a new version of Google Chrome available that includes extensions. + <message name="IDS_TRY_TOAST_HEADING2" desc="Top line of the try-chrome-again dialog"> + There's a new version of Google Chrome available, and it's faster than ever. + </message> + <message name="IDS_TRY_TOAST_HEADING3" desc="Top line of the try-chrome-again dialog"> + There's a new, safer version of Google Chrome available. + </message> + <message name="IDS_TRY_TOAST_HEADING4" desc="Top line of the try-chrome-again dialog"> + Google Chrome has been updated, but you haven't used it for at least 30 days. </message> <message name="IDS_TRY_TOAST_TRY_OPT" desc="First option radio button on the dialog to try chrome"> Try it out (already installed) diff --git a/chrome/browser/first_run/first_run_win.cc b/chrome/browser/first_run/first_run_win.cc index 4538519..589dc32 100644 --- a/chrome/browser/first_run/first_run_win.cc +++ b/chrome/browser/first_run/first_run_win.cc @@ -610,8 +610,9 @@ const wchar_t kHelpCenterUrl[] = class TryChromeDialog : public views::ButtonListener, public views::LinkController { public: - TryChromeDialog() - : popup_(NULL), + explicit TryChromeDialog(size_t version) + : version_(version), + popup_(NULL), try_chrome_(NULL), kill_chrome_(NULL), result_(Upgrade::TD_LAST_ENUM) { @@ -699,11 +700,17 @@ class TryChromeDialog : public views::ButtonListener, // The heading has two flavors of text, the alt one features extensions but // we only use it in the US until some international issues are fixed. const std::string app_locale = g_browser_process->GetApplicationLocale(); - const std::wstring heading = (app_locale == "en-US") ? - l10n_util::GetString(IDS_TRY_TOAST_ALT_HEADING) : - l10n_util::GetString(IDS_TRY_TOAST_HEADING); - views::Label* label = - new views::Label(heading); + std::wstring heading; + switch (version_) { + case 0: heading = l10n_util::GetString(IDS_TRY_TOAST_HEADING); break; + case 1: heading = l10n_util::GetString(IDS_TRY_TOAST_HEADING2); break; + case 2: heading = l10n_util::GetString(IDS_TRY_TOAST_HEADING3); break; + case 3: heading = l10n_util::GetString(IDS_TRY_TOAST_HEADING4); break; + default: + NOTREACHED() << "Cannot determine which headline to show."; + return Upgrade::TD_DIALOG_ERROR; + } + views::Label* label = new views::Label(heading); label->SetFont(rb.GetFont(ResourceBundle::MediumBoldFont)); label->SetMultiLine(true); label->SizeToFit(200); @@ -860,6 +867,6 @@ Upgrade::TryResult Upgrade::ShowTryChromeDialog(size_t version) { // returning this early. See EarlyReturnTest test harness. return Upgrade::TD_NOT_NOW; } - TryChromeDialog td; + TryChromeDialog td(version); return td.ShowModal(); } diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc index 0ce8878..c9f19c3 100644 --- a/chrome/installer/util/google_chrome_distribution.cc +++ b/chrome/installer/util/google_chrome_distribution.cc @@ -56,13 +56,14 @@ const wchar_t kToastExpBaseGroup[] = L"T%lc80"; // Generates the actual group string that gets written in the registry. // |group| is one of the above kToast* strings and |flavor| is a number -// between 0 and 5. +// from 0 to 3. // // The big experiment in Dec 2009 used TGxx and THxx. -// The big experiment in Feb 2010 uses TKxx and TLxx. -// The big experiment in Apr 2010 uses TMxx and TNxx. +// The big experiment in Feb 2010 used TKxx and TLxx. +// The big experiment in Apr 2010 used TMxx and TNxx. +// The big experiment in Oct 2010 (current) uses TVxx TWxx TXxx TYxx. std::wstring GetExperimentGroup(const wchar_t* group, int flavor) { - wchar_t c = flavor < 5 ? L'M' + flavor : L'X'; + wchar_t c = flavor < 4 ? L'V' + flavor : L'Z'; return StringPrintf(group, c); } @@ -513,6 +514,39 @@ void GoogleChromeDistribution::UpdateDiffInstallStatus(bool system_install, // The functions below are not used by the 64-bit Windows binary - // see the comment in google_chrome_distribution_dummy.cc #ifndef _WIN64 +// A helper function that writes to HKLM if the handle was passed through the +// command line, but HKCU otherwise. |experiment_group| is the value to write +// and |last_write| is used when writing to HKLM to determine whether to close +// the handle when done. +void SetClient(std::wstring experiment_group, bool last_write) { + static int reg_key_handle = -1; + if (reg_key_handle == -1) { + // If a specific Toast Results key handle (presumably to our HKLM key) was + // passed in to the command line (such as for system level installs), we use + // it. Otherwise, we write to the key under HKCU. + const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); + if (cmd_line.HasSwitch(installer_util::switches::kToastResultsKey)) { + // Get the handle to the key under HKLM. + base::StringToInt(cmd_line.GetSwitchValueASCII( + WideToASCII(installer_util::switches::kToastResultsKey)).c_str(), + ®_key_handle); + } else { + reg_key_handle = 0; + } + } + + if (reg_key_handle) { + // Use it to write the experiment results. + GoogleUpdateSettings::WriteGoogleUpdateSystemClientKey( + reg_key_handle, google_update::kRegClientField, experiment_group); + if (last_write) + CloseHandle((HANDLE) reg_key_handle); + } else { + // Write to HKCU. + GoogleUpdateSettings::SetClient(experiment_group); + } +} + // Currently we only have one experiment: the inactive user toast. Which only // applies for users doing upgrades. // @@ -538,8 +572,9 @@ void GoogleChromeDistribution::LaunchUserExperiment( } } - // currently only two equal experiment groups. 90% get the welcome back url. - int flavor = (base::RandDouble() > 0.1) ? 0 : 1; + // This ends up being processed by ShowTryChromeDialog to show different + // experiments. + int flavor = base::RandInt(0, 3); std::wstring brand; if (GoogleUpdateSettings::GetBrand(&brand) && (brand == L"CHXX")) { @@ -556,28 +591,24 @@ void GoogleChromeDistribution::LaunchUserExperiment( // This means that we failed to find the user data dir. The most likely // cause is that this user has not ever used chrome at all which can // happen in a system-level install. - GoogleUpdateSettings::SetClient( - GetExperimentGroup(kToastUDDirFailure, flavor)); + SetClient(GetExperimentGroup(kToastUDDirFailure, flavor), true); return; } else if (dir_age_hours < kThirtyDays) { // An active user, so it does not qualify. LOG(INFO) << "Chrome used in last " << dir_age_hours << " hours"; - GoogleUpdateSettings::SetClient( - GetExperimentGroup(kToastActiveGroup, flavor)); + SetClient(GetExperimentGroup(kToastActiveGroup, flavor), true); return; } // 1% are in the control group that qualifies but does not get drafted. if (base::RandDouble() > 0.99) { - GoogleUpdateSettings::SetClient( - GetExperimentGroup(kToastExpControlGroup, flavor)); + SetClient(GetExperimentGroup(kToastExpControlGroup, flavor), true); LOG(INFO) << "User is control group"; return; } } LOG(INFO) << "User drafted for toast experiment " << flavor; - GoogleUpdateSettings::SetClient( - GetExperimentGroup(kToastExpBaseGroup, flavor)); + SetClient(GetExperimentGroup(kToastExpBaseGroup, flavor), false); // User level: The experiment needs to be performed in a different process // because google_update expects the upgrade process to be quick and nimble. // System level: We have already been relaunched, so we don't need to be @@ -619,26 +650,8 @@ void GoogleChromeDistribution::InactiveUserToastExperiment(int flavor, outcome = kToastExpTriesErrorGroup; }; - // If a specific Toast Results key handle (presumably to our HKLM key) was - // passed in to the command line (such as for system level installs), we use - // it. Otherwise, we write to the key under HKCU. - const CommandLine& cmd_line = *CommandLine::ForCurrentProcess(); - if (cmd_line.HasSwitch(installer_util::switches::kToastResultsKey)) { - // Get the handle to the key under HKLM. - int handle; - base::StringToInt(cmd_line.GetSwitchValueASCII( - WideToASCII(installer_util::switches::kToastResultsKey)).c_str(), - &handle); - // Use it to write the experiment results. - GoogleUpdateSettings::WriteGoogleUpdateSystemClientKey( - handle, - google_update::kRegClientField, - GetExperimentGroup(outcome, flavor)); - CloseHandle((HANDLE) handle); - } else { - // Write to HKCU. - GoogleUpdateSettings::SetClient(GetExperimentGroup(outcome, flavor)); - } + // Write to the |client| key for the last time. + SetClient(GetExperimentGroup(outcome, flavor), true); if (outcome != kToastExpUninstallGroup) return; |