OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/installer/util/product.h" | 5 #include "chrome/installer/util/product.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/process/launch.h" | 11 #include "base/process/launch.h" |
12 #include "base/win/registry.h" | 12 #include "base/win/registry.h" |
13 #include "chrome/installer/util/chrome_binaries_operations.h" | |
14 #include "chrome/installer/util/chrome_browser_operations.h" | 13 #include "chrome/installer/util/chrome_browser_operations.h" |
15 #include "chrome/installer/util/chrome_browser_sxs_operations.h" | 14 #include "chrome/installer/util/chrome_browser_sxs_operations.h" |
16 #include "chrome/installer/util/google_update_constants.h" | 15 #include "chrome/installer/util/google_update_constants.h" |
17 #include "chrome/installer/util/install_util.h" | 16 #include "chrome/installer/util/install_util.h" |
18 #include "chrome/installer/util/master_preferences.h" | 17 #include "chrome/installer/util/master_preferences.h" |
19 #include "chrome/installer/util/master_preferences_constants.h" | 18 #include "chrome/installer/util/master_preferences_constants.h" |
20 #include "chrome/installer/util/product_operations.h" | 19 #include "chrome/installer/util/product_operations.h" |
21 | 20 |
22 using base::win::RegKey; | 21 using base::win::RegKey; |
23 using installer::MasterPreferences; | 22 using installer::MasterPreferences; |
24 | 23 |
25 namespace installer { | 24 namespace installer { |
26 | 25 |
27 Product::Product(BrowserDistribution* distribution) | 26 Product::Product(BrowserDistribution* distribution) |
28 : distribution_(distribution) { | 27 : distribution_(distribution) { |
29 switch (distribution->GetType()) { | 28 switch (distribution->GetType()) { |
30 case BrowserDistribution::CHROME_BROWSER: | 29 case BrowserDistribution::CHROME_BROWSER: |
31 operations_.reset(InstallUtil::IsChromeSxSProcess() ? | 30 operations_.reset(InstallUtil::IsChromeSxSProcess() ? |
32 new ChromeBrowserSxSOperations() : | 31 new ChromeBrowserSxSOperations() : |
33 new ChromeBrowserOperations()); | 32 new ChromeBrowserOperations()); |
34 break; | 33 break; |
35 case BrowserDistribution::CHROME_BINARIES: | |
36 operations_.reset(new ChromeBinariesOperations()); | |
37 break; | |
38 default: | 34 default: |
39 NOTREACHED() << "Unsupported BrowserDistribution::Type: " | 35 NOTREACHED() << "Unsupported BrowserDistribution::Type: " |
40 << distribution->GetType(); | 36 << distribution->GetType(); |
41 } | 37 } |
42 } | 38 } |
43 | 39 |
44 Product::~Product() { | 40 Product::~Product() { |
45 } | 41 } |
46 | 42 |
47 void Product::InitializeFromPreferences(const MasterPreferences& prefs) { | 43 void Product::InitializeFromPreferences(const MasterPreferences& prefs) { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 } | 111 } |
116 if (result != ERROR_SUCCESS && result != ERROR_FILE_NOT_FOUND) { | 112 if (result != ERROR_SUCCESS && result != ERROR_FILE_NOT_FOUND) { |
117 LOG(ERROR) | 113 LOG(ERROR) |
118 << "Failed to Open or Write MSI value to client state key. error: " | 114 << "Failed to Open or Write MSI value to client state key. error: " |
119 << result; | 115 << result; |
120 return false; | 116 return false; |
121 } | 117 } |
122 return true; | 118 return true; |
123 } | 119 } |
124 | 120 |
125 bool Product::ShouldCreateUninstallEntry() const { | |
126 return operations_->ShouldCreateUninstallEntry(options_); | |
127 } | |
128 | |
129 void Product::AddKeyFiles(std::vector<base::FilePath>* key_files) const { | 121 void Product::AddKeyFiles(std::vector<base::FilePath>* key_files) const { |
130 operations_->AddKeyFiles(options_, key_files); | 122 operations_->AddKeyFiles(options_, key_files); |
131 } | 123 } |
132 | 124 |
133 void Product::AppendProductFlags(base::CommandLine* command_line) const { | 125 void Product::AppendProductFlags(base::CommandLine* command_line) const { |
134 operations_->AppendProductFlags(options_, command_line); | 126 operations_->AppendProductFlags(options_, command_line); |
135 } | 127 } |
136 | 128 |
137 void Product::AppendRenameFlags(base::CommandLine* command_line) const { | 129 void Product::AppendRenameFlags(base::CommandLine* command_line) const { |
138 operations_->AppendRenameFlags(options_, command_line); | 130 operations_->AppendRenameFlags(options_, command_line); |
(...skipping 16 matching lines...) Expand all Loading... |
155 if (distribution_->HasUserExperiments()) { | 147 if (distribution_->HasUserExperiments()) { |
156 VLOG(1) << "LaunchUserExperiment status: " << status << " product: " | 148 VLOG(1) << "LaunchUserExperiment status: " << status << " product: " |
157 << distribution_->GetDisplayName() | 149 << distribution_->GetDisplayName() |
158 << " system_level: " << system_level; | 150 << " system_level: " << system_level; |
159 operations_->LaunchUserExperiment( | 151 operations_->LaunchUserExperiment( |
160 setup_path, options_, status, system_level); | 152 setup_path, options_, status, system_level); |
161 } | 153 } |
162 } | 154 } |
163 | 155 |
164 } // namespace installer | 156 } // namespace installer |
OLD | NEW |