diff options
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/app/client_util.cc | 12 | ||||
-rw-r--r-- | chrome/installer/util/channel_info.cc | 9 | ||||
-rw-r--r-- | chrome/installer/util/channel_info_unittest.cc | 9 | ||||
-rw-r--r-- | chrome/installer/util/google_update_settings.cc | 11 | ||||
-rw-r--r-- | chrome/installer/util/google_update_settings.h | 5 | ||||
-rw-r--r-- | chrome/installer/util/google_update_settings_unittest.cc | 15 | ||||
-rw-r--r-- | chrome/installer/util/util_constants.cc | 9 | ||||
-rw-r--r-- | chrome/installer/util/util_constants.h | 12 |
8 files changed, 49 insertions, 33 deletions
diff --git a/chrome/app/client_util.cc b/chrome/app/client_util.cc index 14c841f..93aa26e 100644 --- a/chrome/app/client_util.cc +++ b/chrome/app/client_util.cc @@ -25,7 +25,6 @@ #include "chrome/installer/util/browser_distribution.h" #include "chrome/installer/util/channel_info.h" #include "chrome/installer/util/install_util.h" -#include "chrome/installer/util/google_chrome_sxs_distribution.h" // PreRead. #include "chrome/installer/util/google_update_constants.h" #include "chrome/installer/util/google_update_settings.h" #include "chrome/installer/util/util_constants.h" @@ -115,13 +114,10 @@ bool PreReadShouldRun() { return false; // The experiment should only run on canary and dev. - BrowserDistribution* dist = BrowserDistribution::GetDistribution(); - std::wstring channel; - if (!dist->GetChromeChannel(&channel)) - return false; - return channel == GoogleChromeSxSDistribution::ChannelName() || - channel == L"dev"; - return true; + const string16 kChannel(GoogleUpdateSettings::GetChromeChannel( + GoogleUpdateSettings::IsSystemInstall())); + return kChannel == installer::kChromeChannelCanary || + kChannel == installer::kChromeChannelDev; } // Checks to see if the experiment is running. If so, either tosses a coin diff --git a/chrome/installer/util/channel_info.cc b/chrome/installer/util/channel_info.cc index 72ea0a3..24c5199 100644 --- a/chrome/installer/util/channel_info.cc +++ b/chrome/installer/util/channel_info.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -7,13 +7,12 @@ #include "base/logging.h" #include "base/win/registry.h" #include "chrome/installer/util/google_update_constants.h" +#include "chrome/installer/util/util_constants.h" using base::win::RegKey; namespace { -const wchar_t kChannelBeta[] = L"beta"; -const wchar_t kChannelDev[] = L"dev"; const wchar_t kModChrome[] = L"-chrome"; const wchar_t kModChromeFrame[] = L"-chromeframe"; const wchar_t kModMultiInstall[] = L"-multi"; @@ -23,8 +22,8 @@ const wchar_t kSfxFull[] = L"-full"; const wchar_t kSfxMultiFail[] = L"-multifail"; const wchar_t* const kChannels[] = { - kChannelBeta, - kChannelDev + installer::kChromeChannelBeta, + installer::kChromeChannelDev }; const wchar_t* const kModifiers[] = { diff --git a/chrome/installer/util/channel_info_unittest.cc b/chrome/installer/util/channel_info_unittest.cc index d68078e..efc6ef1 100644 --- a/chrome/installer/util/channel_info_unittest.cc +++ b/chrome/installer/util/channel_info_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -6,15 +6,16 @@ #include "base/basictypes.h" #include "chrome/installer/util/channel_info.h" +#include "chrome/installer/util/util_constants.h" #include "testing/gtest/include/gtest/gtest.h" using installer::ChannelInfo; namespace { -const std::wstring kChannelStable; -const std::wstring kChannelBeta(L"beta"); -const std::wstring kChannelDev(L"dev"); +const std::wstring kChannelStable(installer::kChromeChannelStable); +const std::wstring kChannelBeta(installer::kChromeChannelBeta); +const std::wstring kChannelDev(installer::kChromeChannelDev); } // namespace diff --git a/chrome/installer/util/google_update_settings.cc b/chrome/installer/util/google_update_settings.cc index 9bf0e12..13d6185 100644 --- a/chrome/installer/util/google_update_settings.cc +++ b/chrome/installer/util/google_update_settings.cc @@ -135,12 +135,12 @@ bool GetChromeChannelInternal(bool system_install, installer::ChannelInfo channel_info; if (!channel_info.Initialize(key)) { - channel->assign(L"unknown"); + channel->assign(installer::kChromeChannelUnknown); return false; } if (!channel_info.GetChannelName(channel)) { - channel->assign(L"unknown"); + channel->assign(installer::kChromeChannelUnknown); } // Tag the channel name if this is a multi-install. @@ -172,8 +172,9 @@ bool GetUpdatePolicyFromDword( return false; } -// Determine whether this is a system-level or a user-level install. -bool IsSystemInstall() { +} // namespace + +bool GoogleUpdateSettings::IsSystemInstall() { bool system_install = false; FilePath module_dir; if (!PathService::Get(base::DIR_MODULE, &module_dir)) { @@ -185,8 +186,6 @@ bool IsSystemInstall() { return system_install; } -} // namespace - bool GoogleUpdateSettings::GetCollectStatsConsent() { return GetCollectStatsConsentAtLevel(IsSystemInstall()); } diff --git a/chrome/installer/util/google_update_settings.h b/chrome/installer/util/google_update_settings.h index 33c1e04..a21e81c 100644 --- a/chrome/installer/util/google_update_settings.h +++ b/chrome/installer/util/google_update_settings.h @@ -31,6 +31,9 @@ class GoogleUpdateSettings { MANUAL_UPDATES_ONLY = 2, }; + // Returns true if this install is system-wide, false if it is per-user. + static bool IsSystemInstall(); + // Returns whether the user has given consent to collect UMA data and send // crash dumps to Google. This information is collected by the web server // used to download the chrome installer. @@ -127,7 +130,7 @@ class GoogleUpdateSettings { // Returns only the channel name: "" (stable), "dev", "beta", "canary", or // "unknown" if unknown. This value will not be modified by "-m" for a - // multi-install. + // multi-install. See kChromeChannel* in util_constants.h static std::wstring GetChromeChannel(bool system_install); // Return a human readable modifier for the version string, e.g. diff --git a/chrome/installer/util/google_update_settings_unittest.cc b/chrome/installer/util/google_update_settings_unittest.cc index a483c6a..59c414c 100644 --- a/chrome/installer/util/google_update_settings_unittest.cc +++ b/chrome/installer/util/google_update_settings_unittest.cc @@ -14,6 +14,7 @@ #include "chrome/installer/util/fake_installation_state.h" #include "chrome/installer/util/google_update_constants.h" #include "chrome/installer/util/google_update_settings.h" +#include "chrome/installer/util/util_constants.h" #include "chrome/installer/util/work_item_list.h" #include "testing/gtest/include/gtest/gtest.h" @@ -103,12 +104,12 @@ class GoogleUpdateSettingsTest: public testing::Test { const wchar_t* ap_value; const wchar_t* channel; } expectations[] = { - { L"dev", L"dev" }, - { L"-dev", L"dev" }, - { L"-developer", L"dev" }, - { L"beta", L"beta" }, - { L"-beta", L"beta" }, - { L"-betamax", L"beta" }, + { L"dev", installer::kChromeChannelDev }, + { L"-dev", installer::kChromeChannelDev }, + { L"-developer", installer::kChromeChannelDev }, + { L"beta", installer::kChromeChannelBeta }, + { L"-beta", installer::kChromeChannelBeta }, + { L"-betamax", installer::kChromeChannelBeta }, }; bool is_system = install == SYSTEM_INSTALL; const wchar_t* prefixes[] = { @@ -238,7 +239,7 @@ TEST_F(GoogleUpdateSettingsTest, CurrentChromeChannelVariousApValuesUser) { } // Run through all combinations of diff vs. full install, single vs. multi -// install, success and failure results, and a fistfull of initial "ap" values +// install, success and failure results, and a fistful of initial "ap" values // checking that the expected final "ap" value is generated by // GoogleUpdateSettings::UpdateGoogleUpdateApKey. TEST_F(GoogleUpdateSettingsTest, UpdateGoogleUpdateApKey) { diff --git a/chrome/installer/util/util_constants.cc b/chrome/installer/util/util_constants.cc index b2287c3..432d675 100644 --- a/chrome/installer/util/util_constants.cc +++ b/chrome/installer/util/util_constants.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -200,4 +200,11 @@ const char kGoogleUpdateIsMachineEnvVar[] = "GoogleUpdateIsMachine"; const wchar_t kOptionMultiInstall[] = L"multi-install"; const wchar_t kOptionReadyMode[] = L"ready-mode"; +// Chrome channel display names. +extern const wchar_t kChromeChannelUnknown[] = L"unknown"; +extern const wchar_t kChromeChannelCanary[] = L"canary"; +extern const wchar_t kChromeChannelDev[] = L"dev"; +extern const wchar_t kChromeChannelBeta[] = L"beta"; +extern const wchar_t kChromeChannelStable[] = L""; + } // namespace installer diff --git a/chrome/installer/util/util_constants.h b/chrome/installer/util/util_constants.h index d8da379..39e7d4d 100644 --- a/chrome/installer/util/util_constants.h +++ b/chrome/installer/util/util_constants.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. // @@ -205,6 +205,16 @@ extern const char kGoogleUpdateIsMachineEnvVar[]; extern const wchar_t kOptionMultiInstall[]; extern const wchar_t kOptionReadyMode[]; +// Chrome channel display names. +// NOTE: Canary is not strictly a 'channel', but rather a separate product +// installed side-by-side. However, GoogleUpdateSettings::GetChromeChannel +// will return "canary" for that product. +extern const wchar_t kChromeChannelUnknown[]; +extern const wchar_t kChromeChannelCanary[]; +extern const wchar_t kChromeChannelDev[]; +extern const wchar_t kChromeChannelBeta[]; +extern const wchar_t kChromeChannelStable[]; + } // namespace installer #endif // CHROME_INSTALLER_UTIL_UTIL_CONSTANTS_H_ |