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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 | 115 |
116 ensure_google_update_present_ = | 116 ensure_google_update_present_ = |
117 command_line.HasSwitch(installer::switches::kEnsureGoogleUpdatePresent); | 117 command_line.HasSwitch(installer::switches::kEnsureGoogleUpdatePresent); |
118 | 118 |
119 const bool is_uninstall = command_line.HasSwitch(switches::kUninstall); | 119 const bool is_uninstall = command_line.HasSwitch(switches::kUninstall); |
120 | 120 |
121 if (prefs.install_chrome()) { | 121 if (prefs.install_chrome()) { |
122 Product* p = AddProductFromPreferences( | 122 Product* p = AddProductFromPreferences( |
123 BrowserDistribution::CHROME_BROWSER, prefs, machine_state); | 123 BrowserDistribution::CHROME_BROWSER, prefs, machine_state); |
124 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") | 124 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") |
125 << " distribution: " << p->distribution()->GetAppShortCutName(); | 125 << " distribution: " << p->distribution()->GetDisplayName(); |
126 } | 126 } |
127 if (prefs.install_chrome_frame()) { | 127 if (prefs.install_chrome_frame()) { |
128 Product* p = AddProductFromPreferences( | 128 Product* p = AddProductFromPreferences( |
129 BrowserDistribution::CHROME_FRAME, prefs, machine_state); | 129 BrowserDistribution::CHROME_FRAME, prefs, machine_state); |
130 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") | 130 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") |
131 << " distribution: " << p->distribution()->GetAppShortCutName(); | 131 << " distribution: " << p->distribution()->GetDisplayName(); |
132 } | 132 } |
133 | 133 |
134 if (prefs.install_chrome_app_launcher()) { | 134 if (prefs.install_chrome_app_launcher()) { |
135 Product* p = AddProductFromPreferences( | 135 Product* p = AddProductFromPreferences( |
136 BrowserDistribution::CHROME_APP_HOST, prefs, machine_state); | 136 BrowserDistribution::CHROME_APP_HOST, prefs, machine_state); |
137 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") | 137 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") |
138 << " distribution: " << p->distribution()->GetAppShortCutName(); | 138 << " distribution: " << p->distribution()->GetDisplayName(); |
139 } | 139 } |
140 | 140 |
141 if (!is_uninstall && is_multi_install()) { | 141 if (!is_uninstall && is_multi_install()) { |
142 bool need_binaries = false; | 142 bool need_binaries = false; |
143 if (FindProduct(BrowserDistribution::CHROME_APP_HOST)) { | 143 if (FindProduct(BrowserDistribution::CHROME_APP_HOST)) { |
144 // App Host will happily use Chrome at system level, or binaries at system | 144 // App Host will happily use Chrome at system level, or binaries at system |
145 // level, even if app host is user level. | 145 // level, even if app host is user level. |
146 const ProductState* chrome_state = machine_state.GetProductState( | 146 const ProductState* chrome_state = machine_state.GetProductState( |
147 true, // system level | 147 true, // system level |
148 BrowserDistribution::CHROME_BROWSER); | 148 BrowserDistribution::CHROME_BROWSER); |
(...skipping 12 matching lines...) Expand all Loading... |
161 need_binaries = true; | 161 need_binaries = true; |
162 | 162 |
163 if (FindProduct(BrowserDistribution::CHROME_FRAME)) | 163 if (FindProduct(BrowserDistribution::CHROME_FRAME)) |
164 need_binaries = true; | 164 need_binaries = true; |
165 | 165 |
166 if (need_binaries && !FindProduct(BrowserDistribution::CHROME_BINARIES)) { | 166 if (need_binaries && !FindProduct(BrowserDistribution::CHROME_BINARIES)) { |
167 // Force binaries to be installed/updated. | 167 // Force binaries to be installed/updated. |
168 Product* p = AddProductFromPreferences( | 168 Product* p = AddProductFromPreferences( |
169 BrowserDistribution::CHROME_BINARIES, prefs, machine_state); | 169 BrowserDistribution::CHROME_BINARIES, prefs, machine_state); |
170 VLOG(1) << "Install distribution: " | 170 VLOG(1) << "Install distribution: " |
171 << p->distribution()->GetAppShortCutName(); | 171 << p->distribution()->GetDisplayName(); |
172 } | 172 } |
173 } | 173 } |
174 | 174 |
175 if (is_uninstall && prefs.is_multi_install()) { | 175 if (is_uninstall && prefs.is_multi_install()) { |
176 if (FindProduct(BrowserDistribution::CHROME_BROWSER)) { | 176 if (FindProduct(BrowserDistribution::CHROME_BROWSER)) { |
177 // Uninstall each product of type |type| listed below based on the | 177 // Uninstall each product of type |type| listed below based on the |
178 // presence or absence of |switch_name| in that product's uninstall | 178 // presence or absence of |switch_name| in that product's uninstall |
179 // command. | 179 // command. |
180 const struct { | 180 const struct { |
181 BrowserDistribution::Type type; | 181 BrowserDistribution::Type type; |
(...skipping 18 matching lines...) Expand all Loading... |
200 const ProductState* product_state = machine_state.GetProductState( | 200 const ProductState* product_state = machine_state.GetProductState( |
201 system_install(), conditional_additions[i].type); | 201 system_install(), conditional_additions[i].type); |
202 if (product_state != NULL && | 202 if (product_state != NULL && |
203 product_state->uninstall_command().HasSwitch( | 203 product_state->uninstall_command().HasSwitch( |
204 conditional_additions[i].switch_name) == | 204 conditional_additions[i].switch_name) == |
205 conditional_additions[i].switch_expected && | 205 conditional_additions[i].switch_expected && |
206 !FindProduct(conditional_additions[i].type)) { | 206 !FindProduct(conditional_additions[i].type)) { |
207 Product* p = AddProductFromPreferences( | 207 Product* p = AddProductFromPreferences( |
208 conditional_additions[i].type, prefs, machine_state); | 208 conditional_additions[i].type, prefs, machine_state); |
209 VLOG(1) << "Uninstall distribution: " | 209 VLOG(1) << "Uninstall distribution: " |
210 << p->distribution()->GetAppShortCutName(); | 210 << p->distribution()->GetDisplayName(); |
211 } | 211 } |
212 } | 212 } |
213 } | 213 } |
214 | 214 |
215 bool keep_binaries = false; | 215 bool keep_binaries = false; |
216 // Look for a product that is not the binaries and that is not being | 216 // Look for a product that is not the binaries and that is not being |
217 // uninstalled. If not found, binaries are uninstalled too. | 217 // uninstalled. If not found, binaries are uninstalled too. |
218 for (size_t i = 0; i < BrowserDistribution::NUM_TYPES; ++i) { | 218 for (size_t i = 0; i < BrowserDistribution::NUM_TYPES; ++i) { |
219 BrowserDistribution::Type type = | 219 BrowserDistribution::Type type = |
220 static_cast<BrowserDistribution::Type>(i); | 220 static_cast<BrowserDistribution::Type>(i); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 } | 252 } |
253 | 253 |
254 // The product is being uninstalled. | 254 // The product is being uninstalled. |
255 } | 255 } |
256 if (!keep_binaries && | 256 if (!keep_binaries && |
257 machine_state.GetProductState(system_install(), | 257 machine_state.GetProductState(system_install(), |
258 BrowserDistribution::CHROME_BINARIES)) { | 258 BrowserDistribution::CHROME_BINARIES)) { |
259 Product* p = AddProductFromPreferences( | 259 Product* p = AddProductFromPreferences( |
260 BrowserDistribution::CHROME_BINARIES, prefs, machine_state); | 260 BrowserDistribution::CHROME_BINARIES, prefs, machine_state); |
261 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") | 261 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") |
262 << " distribution: " << p->distribution()->GetAppShortCutName(); | 262 << " distribution: " << p->distribution()->GetDisplayName(); |
263 } | 263 } |
264 } | 264 } |
265 | 265 |
266 BrowserDistribution* operand = NULL; | 266 BrowserDistribution* operand = NULL; |
267 | 267 |
268 if (is_uninstall) { | 268 if (is_uninstall) { |
269 operation_ = UNINSTALL; | 269 operation_ = UNINSTALL; |
270 } else if (!prefs.is_multi_install()) { | 270 } else if (!prefs.is_multi_install()) { |
271 // For a single-install, the current browser dist is the operand. | 271 // For a single-install, the current browser dist is the operand. |
272 operand = BrowserDistribution::GetDistribution(); | 272 operand = BrowserDistribution::GetDistribution(); |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
790 } | 790 } |
791 if (!install_list->Do()) | 791 if (!install_list->Do()) |
792 LOG(ERROR) << "Failed to record installer error information in registry."; | 792 LOG(ERROR) << "Failed to record installer error information in registry."; |
793 } | 793 } |
794 | 794 |
795 bool InstallerState::RequiresActiveSetup() const { | 795 bool InstallerState::RequiresActiveSetup() const { |
796 return system_install() && FindProduct(BrowserDistribution::CHROME_BROWSER); | 796 return system_install() && FindProduct(BrowserDistribution::CHROME_BROWSER); |
797 } | 797 } |
798 | 798 |
799 } // namespace installer | 799 } // namespace installer |
OLD | NEW |