summaryrefslogtreecommitdiffstats
path: root/chrome/installer/util/install_util.cc
diff options
context:
space:
mode:
authorrahulk@google.com <rahulk@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-18 21:39:43 +0000
committerrahulk@google.com <rahulk@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-18 21:39:43 +0000
commit8bcdcbe8e59f804e03f75e86744211210c64484a (patch)
tree06a04450b42770a59ecab09998608c005fed391d /chrome/installer/util/install_util.cc
parentaf784739ebdc4ca47d9d52e366587e4c7ba2313b (diff)
downloadchromium_src-8bcdcbe8e59f804e03f75e86744211210c64484a.zip
chromium_src-8bcdcbe8e59f804e03f75e86744211210c64484a.tar.gz
chromium_src-8bcdcbe8e59f804e03f75e86744211210c64484a.tar.bz2
First set of changes to start separating Google specific branding from Chromium. This change mostly tries to modify installer to install Chromium or Google Chrome depending on a compile flag. The goal is to try to isolate all the differences in a single class that can be overridden for customization. There is also a lot of refactoring to make this happen.
Some changes are yet to be done but I didn't want to make this change even bigger than it already is. With all these changes the default build should still work as it is (Google Chrome should get installed/uninstalled). The changes yet to be done: - Separating string resources (this is marked by TODO in one of the files) - Generate different chrome.7z (Chromium will not include rlz.dll) for mini_installer BUG=1296800 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@999 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/util/install_util.cc')
-rw-r--r--chrome/installer/util/install_util.cc48
1 files changed, 3 insertions, 45 deletions
diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc
index 087589b..8a1dfcc 100644
--- a/chrome/installer/util/install_util.cc
+++ b/chrome/installer/util/install_util.cc
@@ -37,22 +37,17 @@
#include "base/logging.h"
#include "base/registry.h"
#include "base/string_util.h"
+#include "chrome/installer/util/browser_distribution.h"
#include "chrome/installer/util/google_update_constants.h"
-std::wstring InstallUtil::GetChromeGoogleUpdateKey() {
- std::wstring chrome_google_update_key(google_update::kRegPathClients);
- chrome_google_update_key.append(L"\\");
- chrome_google_update_key.append(google_update::kChromeGuid);
- return chrome_google_update_key;
-}
-
installer::Version* InstallUtil::GetChromeVersion(bool system_install) {
RegKey key;
std::wstring version_str;
HKEY reg_root = (system_install) ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
- if (!key.Open(reg_root, GetChromeGoogleUpdateKey().c_str(), KEY_READ) ||
+ BrowserDistribution* dist = BrowserDistribution::GetDistribution();
+ if (!key.Open(reg_root, dist->GetVersionKey().c_str(), KEY_READ) ||
!key.ReadValue(google_update::kRegVersionField, &version_str)) {
LOG(INFO) << "No existing Chrome install found.";
key.Close();
@@ -62,40 +57,3 @@ installer::Version* InstallUtil::GetChromeVersion(bool system_install) {
LOG(INFO) << "Existing Chrome version found " << version_str;
return installer::Version::GetVersionFromString(version_str);
}
-
-std::wstring InstallUtil::GetNewGoogleUpdateApKey(bool diff_install,
- installer_util::InstallStatus status, const std::wstring& value) {
- // Magic suffix that we need to add or remove to "ap" key value.
- const std::wstring kMagicSuffix = L"-full";
-
- bool has_magic_string = false;
- if ((value.length() >= kMagicSuffix.length()) &&
- (value.rfind(kMagicSuffix) == (value.length() - kMagicSuffix.length()))) {
- LOG(INFO) << "Incremental installer failure key already set.";
- has_magic_string = true;
- }
-
- std::wstring new_value(value);
- if ((!diff_install || InstallSuccessful(status)) && has_magic_string) {
- LOG(INFO) << "Removing failure key from value " << value;
- new_value = value.substr(0, value.length() - kMagicSuffix.length());
- } else if ((diff_install && !InstallSuccessful(status)) &&
- !has_magic_string) {
- LOG(INFO) << "Incremental installer failed, setting failure key.";
- new_value.append(kMagicSuffix);
- }
-
- return new_value;
-}
-
-bool InstallUtil::InstallSuccessful(installer_util::InstallStatus status) {
- switch (status) {
- case installer_util::FIRST_INSTALL_SUCCESS:
- case installer_util::INSTALL_REPAIRED:
- case installer_util::NEW_VERSION_UPDATED:
- case installer_util::HIGHER_VERSION_EXISTS:
- return true;
- default:
- return false;
- }
-}