summaryrefslogtreecommitdiffstats
path: root/chrome/installer
diff options
context:
space:
mode:
authorchrisha@chromium.org <chrisha@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-14 21:08:02 +0000
committerchrisha@chromium.org <chrisha@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-14 21:08:02 +0000
commit4f5098779d0fb87a339bc3732a38ba7cef9ec578 (patch)
tree211056b8765fe2134e4cf80effd1888ab16ec290 /chrome/installer
parentfc83b1764f09f01012d7888d186637d476c56a7a (diff)
downloadchromium_src-4f5098779d0fb87a339bc3732a38ba7cef9ec578.zip
chromium_src-4f5098779d0fb87a339bc3732a38ba7cef9ec578.tar.gz
chromium_src-4f5098779d0fb87a339bc3732a38ba7cef9ec578.tar.bz2
Add IsSystemInstall to GoogleUpdateSettings.
This CL promotes the utility function IsSystemInstall to be a static member function of GoogleUpdateSettings. It also centralizes the various chrome channel display name constants to util_constants.*, and makes use of them throughout the installer code. Finally, it updates app/client_util.cc to use the new functionality. BUG= TEST= Review URL: http://codereview.chromium.org/9107060 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117810 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer')
-rw-r--r--chrome/installer/util/channel_info.cc9
-rw-r--r--chrome/installer/util/channel_info_unittest.cc9
-rw-r--r--chrome/installer/util/google_update_settings.cc11
-rw-r--r--chrome/installer/util/google_update_settings.h5
-rw-r--r--chrome/installer/util/google_update_settings_unittest.cc15
-rw-r--r--chrome/installer/util/util_constants.cc9
-rw-r--r--chrome/installer/util/util_constants.h12
7 files changed, 45 insertions, 25 deletions
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_