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 product that is not the binaries and that is not being | 217 // Look for a product that is not the binaries and that is not being |
218 // uninstalled. If not found, binaries are uninstalled too. | 218 // 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 } | 253 } |
254 | 254 |
255 // The product is being uninstalled. | 255 // The product is being uninstalled. |
256 } | 256 } |
257 if (!keep_binaries && | 257 if (!keep_binaries && |
258 machine_state.GetProductState(system_install(), | 258 machine_state.GetProductState(system_install(), |
259 BrowserDistribution::CHROME_BINARIES)) { | 259 BrowserDistribution::CHROME_BINARIES)) { |
260 Product* p = AddProductFromPreferences( | 260 Product* p = AddProductFromPreferences( |
261 BrowserDistribution::CHROME_BINARIES, prefs, machine_state); | 261 BrowserDistribution::CHROME_BINARIES, prefs, machine_state); |
262 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") | 262 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") |
263 << " distribution: " << p->distribution()->GetAppShortCutName(); | 263 << " distribution: " << p->distribution()->GetDisplayName(); |
264 } | 264 } |
265 } | 265 } |
266 | 266 |
267 BrowserDistribution* operand = NULL; | 267 BrowserDistribution* operand = NULL; |
268 | 268 |
269 if (is_uninstall) { | 269 if (is_uninstall) { |
270 operation_ = UNINSTALL; | 270 operation_ = UNINSTALL; |
271 } else if (!prefs.is_multi_install()) { | 271 } else if (!prefs.is_multi_install()) { |
272 // For a single-install, the current browser dist is the operand. | 272 // For a single-install, the current browser dist is the operand. |
273 operand = BrowserDistribution::GetDistribution(); | 273 operand = BrowserDistribution::GetDistribution(); |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 } | 791 } |
792 if (!install_list->Do()) | 792 if (!install_list->Do()) |
793 LOG(ERROR) << "Failed to record installer error information in registry."; | 793 LOG(ERROR) << "Failed to record installer error information in registry."; |
794 } | 794 } |
795 | 795 |
796 bool InstallerState::RequiresActiveSetup() const { | 796 bool InstallerState::RequiresActiveSetup() const { |
797 return system_install() && FindProduct(BrowserDistribution::CHROME_BROWSER); | 797 return system_install() && FindProduct(BrowserDistribution::CHROME_BROWSER); |
798 } | 798 } |
799 | 799 |
800 } // namespace installer | 800 } // namespace installer |
OLD | NEW |