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/installer_state.h" | 5 #include "chrome/installer/util/installer_state.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 116 |
117 ensure_google_update_present_ = | 117 ensure_google_update_present_ = |
118 command_line.HasSwitch(installer::switches::kEnsureGoogleUpdatePresent); | 118 command_line.HasSwitch(installer::switches::kEnsureGoogleUpdatePresent); |
119 | 119 |
120 const bool is_uninstall = command_line.HasSwitch(switches::kUninstall); | 120 const bool is_uninstall = command_line.HasSwitch(switches::kUninstall); |
121 | 121 |
122 if (prefs.install_chrome()) { | 122 if (prefs.install_chrome()) { |
123 Product* p = AddProductFromPreferences( | 123 Product* p = AddProductFromPreferences( |
124 BrowserDistribution::CHROME_BROWSER, prefs, machine_state); | 124 BrowserDistribution::CHROME_BROWSER, prefs, machine_state); |
125 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") | 125 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") |
126 << " distribution: " << p->distribution()->GetAppShortCutName(); | 126 << " distribution: " << p->distribution()->GetDisplayName(); |
127 } | 127 } |
128 if (prefs.install_chrome_frame()) { | 128 if (prefs.install_chrome_frame()) { |
129 Product* p = AddProductFromPreferences( | 129 Product* p = AddProductFromPreferences( |
130 BrowserDistribution::CHROME_FRAME, prefs, machine_state); | 130 BrowserDistribution::CHROME_FRAME, prefs, machine_state); |
131 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") | 131 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") |
132 << " distribution: " << p->distribution()->GetAppShortCutName(); | 132 << " distribution: " << p->distribution()->GetDisplayName(); |
133 } | 133 } |
134 | 134 |
135 if (prefs.install_chrome_app_launcher()) { | 135 if (prefs.install_chrome_app_launcher()) { |
136 Product* p = AddProductFromPreferences( | 136 Product* p = AddProductFromPreferences( |
137 BrowserDistribution::CHROME_APP_HOST, prefs, machine_state); | 137 BrowserDistribution::CHROME_APP_HOST, prefs, machine_state); |
138 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") | 138 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") |
139 << " distribution: " << p->distribution()->GetAppShortCutName(); | 139 << " distribution: " << p->distribution()->GetDisplayName(); |
140 } | 140 } |
141 | 141 |
142 if (!is_uninstall && is_multi_install()) { | 142 if (!is_uninstall && is_multi_install()) { |
143 bool need_binaries = false; | 143 bool need_binaries = false; |
144 if (FindProduct(BrowserDistribution::CHROME_APP_HOST)) { | 144 if (FindProduct(BrowserDistribution::CHROME_APP_HOST)) { |
145 // App Host will happily use Chrome at system level, or binaries at system | 145 // App Host will happily use Chrome at system level, or binaries at system |
146 // level, even if app host is user level. | 146 // level, even if app host is user level. |
147 const ProductState* chrome_state = machine_state.GetProductState( | 147 const ProductState* chrome_state = machine_state.GetProductState( |
148 true, // system level | 148 true, // system level |
149 BrowserDistribution::CHROME_BROWSER); | 149 BrowserDistribution::CHROME_BROWSER); |
(...skipping 12 matching lines...) Expand all Loading... |
162 need_binaries = true; | 162 need_binaries = true; |
163 | 163 |
164 if (FindProduct(BrowserDistribution::CHROME_FRAME)) | 164 if (FindProduct(BrowserDistribution::CHROME_FRAME)) |
165 need_binaries = true; | 165 need_binaries = true; |
166 | 166 |
167 if (need_binaries && !FindProduct(BrowserDistribution::CHROME_BINARIES)) { | 167 if (need_binaries && !FindProduct(BrowserDistribution::CHROME_BINARIES)) { |
168 // Force binaries to be installed/updated. | 168 // Force binaries to be installed/updated. |
169 Product* p = AddProductFromPreferences( | 169 Product* p = AddProductFromPreferences( |
170 BrowserDistribution::CHROME_BINARIES, prefs, machine_state); | 170 BrowserDistribution::CHROME_BINARIES, prefs, machine_state); |
171 VLOG(1) << "Install distribution: " | 171 VLOG(1) << "Install distribution: " |
172 << p->distribution()->GetAppShortCutName(); | 172 << p->distribution()->GetDisplayName(); |
173 } | 173 } |
174 } | 174 } |
175 | 175 |
176 if (is_uninstall && prefs.is_multi_install()) { | 176 if (is_uninstall && prefs.is_multi_install()) { |
177 if (FindProduct(BrowserDistribution::CHROME_BROWSER)) { | 177 if (FindProduct(BrowserDistribution::CHROME_BROWSER)) { |
178 // Uninstall each product of type |type| listed below based on the | 178 // Uninstall each product of type |type| listed below based on the |
179 // presence or absence of |switch_name| in that product's uninstall | 179 // presence or absence of |switch_name| in that product's uninstall |
180 // command. | 180 // command. |
181 const struct { | 181 const struct { |
182 BrowserDistribution::Type type; | 182 BrowserDistribution::Type type; |
(...skipping 18 matching lines...) Expand all Loading... |
201 const ProductState* product_state = machine_state.GetProductState( | 201 const ProductState* product_state = machine_state.GetProductState( |
202 system_install(), conditional_additions[i].type); | 202 system_install(), conditional_additions[i].type); |
203 if (product_state != NULL && | 203 if (product_state != NULL && |
204 product_state->uninstall_command().HasSwitch( | 204 product_state->uninstall_command().HasSwitch( |
205 conditional_additions[i].switch_name) == | 205 conditional_additions[i].switch_name) == |
206 conditional_additions[i].switch_expected && | 206 conditional_additions[i].switch_expected && |
207 !FindProduct(conditional_additions[i].type)) { | 207 !FindProduct(conditional_additions[i].type)) { |
208 Product* p = AddProductFromPreferences( | 208 Product* p = AddProductFromPreferences( |
209 conditional_additions[i].type, prefs, machine_state); | 209 conditional_additions[i].type, prefs, machine_state); |
210 VLOG(1) << "Uninstall distribution: " | 210 VLOG(1) << "Uninstall distribution: " |
211 << p->distribution()->GetAppShortCutName(); | 211 << p->distribution()->GetDisplayName(); |
212 } | 212 } |
213 } | 213 } |
214 } | 214 } |
215 | 215 |
216 bool keep_binaries = false; | 216 bool keep_binaries = false; |
217 // Look for a multi-install product that is not the binaries and that is not | 217 // Look for a multi-install product that is not the binaries and that is not |
218 // being uninstalled. If not found, binaries are uninstalled too. | 218 // being uninstalled. If not found, binaries are uninstalled too. |
219 for (size_t i = 0; i < BrowserDistribution::NUM_TYPES; ++i) { | 219 for (size_t i = 0; i < BrowserDistribution::NUM_TYPES; ++i) { |
220 BrowserDistribution::Type type = | 220 BrowserDistribution::Type type = |
221 static_cast<BrowserDistribution::Type>(i); | 221 static_cast<BrowserDistribution::Type>(i); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 } | 264 } |
265 | 265 |
266 // The product is being uninstalled. | 266 // The product is being uninstalled. |
267 } | 267 } |
268 if (!keep_binaries && | 268 if (!keep_binaries && |
269 machine_state.GetProductState(system_install(), | 269 machine_state.GetProductState(system_install(), |
270 BrowserDistribution::CHROME_BINARIES)) { | 270 BrowserDistribution::CHROME_BINARIES)) { |
271 Product* p = AddProductFromPreferences( | 271 Product* p = AddProductFromPreferences( |
272 BrowserDistribution::CHROME_BINARIES, prefs, machine_state); | 272 BrowserDistribution::CHROME_BINARIES, prefs, machine_state); |
273 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") | 273 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") |
274 << " distribution: " << p->distribution()->GetAppShortCutName(); | 274 << " distribution: " << p->distribution()->GetDisplayName(); |
275 } | 275 } |
276 } | 276 } |
277 | 277 |
278 BrowserDistribution* operand = NULL; | 278 BrowserDistribution* operand = NULL; |
279 | 279 |
280 if (is_uninstall) { | 280 if (is_uninstall) { |
281 operation_ = UNINSTALL; | 281 operation_ = UNINSTALL; |
282 } else if (!prefs.is_multi_install()) { | 282 } else if (!prefs.is_multi_install()) { |
283 // For a single-install, the current browser dist is the operand. | 283 // For a single-install, the current browser dist is the operand. |
284 operand = BrowserDistribution::GetDistribution(); | 284 operand = BrowserDistribution::GetDistribution(); |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 } | 801 } |
802 if (!install_list->Do()) | 802 if (!install_list->Do()) |
803 LOG(ERROR) << "Failed to record installer error information in registry."; | 803 LOG(ERROR) << "Failed to record installer error information in registry."; |
804 } | 804 } |
805 | 805 |
806 bool InstallerState::RequiresActiveSetup() const { | 806 bool InstallerState::RequiresActiveSetup() const { |
807 return system_install() && FindProduct(BrowserDistribution::CHROME_BROWSER); | 807 return system_install() && FindProduct(BrowserDistribution::CHROME_BROWSER); |
808 } | 808 } |
809 | 809 |
810 } // namespace installer | 810 } // namespace installer |
OLD | NEW |