summaryrefslogtreecommitdiffstats
path: root/chrome/installer/util/package.cc
diff options
context:
space:
mode:
authortommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-15 21:05:32 +0000
committertommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-15 21:05:32 +0000
commita405b4c6c34f1ab69f73df8ec7e7b58631a3167d (patch)
treecf10c39f8e09e4cd417f762ed72e6d1a809be202 /chrome/installer/util/package.cc
parent61e78f1855792814e87a777df59595edc9b163fe (diff)
downloadchromium_src-a405b4c6c34f1ab69f73df8ec7e7b58631a3167d.zip
chromium_src-a405b4c6c34f1ab69f73df8ec7e7b58631a3167d.tar.gz
chromium_src-a405b4c6c34f1ab69f73df8ec7e7b58631a3167d.tar.bz2
Adding a new class, PackageProperties that represents the shared binaries for each of the products.
Also removing the system_level() property out of the Product class and into the Package class as system_level can't be different for products that share the same package. TEST=Run installer and unit tests. BUG=61609 Review URL: http://codereview.chromium.org/5744001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69314 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/util/package.cc')
-rw-r--r--chrome/installer/util/package.cc24
1 files changed, 12 insertions, 12 deletions
diff --git a/chrome/installer/util/package.cc b/chrome/installer/util/package.cc
index cc94cd6..998dbc6d 100644
--- a/chrome/installer/util/package.cc
+++ b/chrome/installer/util/package.cc
@@ -9,13 +9,17 @@
#include "base/win/registry.h"
#include "chrome/installer/util/delete_tree_work_item.h"
#include "chrome/installer/util/google_update_constants.h"
+#include "chrome/installer/util/package_properties.h"
#include "chrome/installer/util/product.h"
using base::win::RegKey;
namespace installer {
-Package::Package(const FilePath& path) : path_(path) {
+Package::Package(bool system_level, const FilePath& path,
+ PackageProperties* properties)
+ : system_level_(system_level), path_(path), properties_(properties) {
+ DCHECK(properties_);
}
Package::~Package() {
@@ -29,6 +33,10 @@ const Products& Package::products() const {
return products_;
}
+PackageProperties* Package::properties() const {
+ return properties_;
+}
+
bool Package::IsEqual(const FilePath& path) const {
return FilePath::CompareEqualIgnoreCase(path_.value(), path.value());
}
@@ -36,7 +44,6 @@ bool Package::IsEqual(const FilePath& path) const {
void Package::AssociateProduct(const Product* product) {
#ifndef NDEBUG
for (size_t i = 0; i < products_.size(); ++i) {
- DCHECK_EQ(product->system_level(), products_[i]->system_level());
DCHECK_NE(product->distribution()->GetType(),
products_[i]->distribution()->GetType());
}
@@ -45,14 +52,7 @@ void Package::AssociateProduct(const Product* product) {
}
bool Package::system_level() const {
- // Convenience getter that returns the system_level value of the first
- // product for this folder. All distributions must have the same
- // value, so the function also checks this in debug builds.
- if (!products_.size()) {
- NOTREACHED() << "this should not be possible";
- return false;
- }
- return products_[0]->system_level();
+ return system_level_;
}
FilePath Package::GetInstallerDirectory(
@@ -68,10 +68,10 @@ Version* Package::GetCurrentVersion() const {
FilePath new_chrome_exe(path_.Append(installer::kChromeNewExe));
bool new_chrome_exists = file_util::PathExists(new_chrome_exe);
+ HKEY root = system_level_ ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER;
+
for (size_t i = 0; i < products_.size(); ++i) {
const Product* product = products_[i];
- HKEY root = product->system_level() ? HKEY_LOCAL_MACHINE :
- HKEY_CURRENT_USER;
RegKey chrome_key(root, product->distribution()->GetVersionKey().c_str(),
KEY_READ);
std::wstring version;