Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: chrome/installer/util/installer_state.cc

Issue 11413029: Uninstall Chrome + has App Host + not App Launcher => Uninstall App Host. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing comments and spacing. Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/installer/setup/install.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 112
113 if (!prefs.GetBool(master_preferences::kMsi, &msi_)) 113 if (!prefs.GetBool(master_preferences::kMsi, &msi_))
114 msi_ = false; 114 msi_ = false;
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 = 122 Product* p = AddProductFromPreferences(
123 AddProductFromPreferences(BrowserDistribution::CHROME_BROWSER, prefs, 123 BrowserDistribution::CHROME_BROWSER, prefs, machine_state);
124 machine_state);
125 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") 124 VLOG(1) << (is_uninstall ? "Uninstall" : "Install")
126 << " distribution: " << p->distribution()->GetAppShortCutName(); 125 << " distribution: " << p->distribution()->GetAppShortCutName();
127 } 126 }
128 if (prefs.install_chrome_frame()) { 127 if (prefs.install_chrome_frame()) {
129 Product* p = 128 Product* p = AddProductFromPreferences(
130 AddProductFromPreferences(BrowserDistribution::CHROME_FRAME, prefs, 129 BrowserDistribution::CHROME_FRAME, prefs, machine_state);
131 machine_state);
132 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") 130 VLOG(1) << (is_uninstall ? "Uninstall" : "Install")
133 << " distribution: " << p->distribution()->GetAppShortCutName(); 131 << " distribution: " << p->distribution()->GetAppShortCutName();
134 } 132 }
133
135 if (prefs.install_chrome_app_host()) { 134 if (prefs.install_chrome_app_host()) {
136 Product* p = 135 Product* p = AddProductFromPreferences(
137 AddProductFromPreferences(BrowserDistribution::CHROME_APP_HOST, prefs, 136 BrowserDistribution::CHROME_APP_HOST, prefs, machine_state);
138 machine_state);
139 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") 137 VLOG(1) << (is_uninstall ? "Uninstall" : "Install")
140 << " distribution: " << p->distribution()->GetAppShortCutName(); 138 << " distribution: " << p->distribution()->GetAppShortCutName();
141 } 139 }
142 140
143 if (!is_uninstall && is_multi_install()) { 141 if (!is_uninstall && is_multi_install()) {
144 bool need_binaries = false; 142 bool need_binaries = false;
145 if (FindProduct(BrowserDistribution::CHROME_APP_HOST)) { 143 if (FindProduct(BrowserDistribution::CHROME_APP_HOST)) {
146 // 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
147 // level, even if app host is user level. 145 // level, even if app host is user level.
148 const ProductState* chrome_state = machine_state.GetProductState( 146 const ProductState* chrome_state = machine_state.GetProductState(
(...skipping 11 matching lines...) Expand all
160 158
161 // Chrome/Chrome Frame multi need Binaries at their own level. 159 // Chrome/Chrome Frame multi need Binaries at their own level.
162 if (FindProduct(BrowserDistribution::CHROME_BROWSER)) 160 if (FindProduct(BrowserDistribution::CHROME_BROWSER))
163 need_binaries = true; 161 need_binaries = true;
164 162
165 if (FindProduct(BrowserDistribution::CHROME_FRAME)) 163 if (FindProduct(BrowserDistribution::CHROME_FRAME))
166 need_binaries = true; 164 need_binaries = true;
167 165
168 if (need_binaries && !FindProduct(BrowserDistribution::CHROME_BINARIES)) { 166 if (need_binaries && !FindProduct(BrowserDistribution::CHROME_BINARIES)) {
169 // Force binaries to be installed/updated. 167 // Force binaries to be installed/updated.
170 Product* p = 168 Product* p = AddProductFromPreferences(
171 AddProductFromPreferences(BrowserDistribution::CHROME_BINARIES, 169 BrowserDistribution::CHROME_BINARIES, prefs, machine_state);
172 prefs,
173 machine_state);
174 VLOG(1) << "Install distribution: " 170 VLOG(1) << "Install distribution: "
175 << p->distribution()->GetAppShortCutName(); 171 << p->distribution()->GetAppShortCutName();
176 } 172 }
177 } 173 }
178 174
179 if (is_uninstall && prefs.is_multi_install()) { 175 if (is_uninstall && prefs.is_multi_install()) {
180 if (FindProduct(BrowserDistribution::CHROME_BROWSER)) { 176 if (FindProduct(BrowserDistribution::CHROME_BROWSER)) {
181 const ProductState* chrome_frame_state = machine_state.GetProductState( 177 // Uninstall each product of type |type| listed below based on the
182 system_install(), BrowserDistribution::CHROME_FRAME); 178 // presence or absence of |switch_name| in that product's uninstall
179 // command.
180 const struct {
181 BrowserDistribution::Type type;
182 const char* switch_name;
183 bool switch_expected;
184 } conditional_additions[] = {
185 // If Chrome Frame is installed in Ready Mode, remove it with Chrome.
186 { BrowserDistribution::CHROME_FRAME,
187 switches::kChromeFrameReadyMode,
188 true },
189 // If the App Host is installed, but not the App Launcher, remove it
190 // with Chrome. Note however that for system-level Chrome uninstalls,
191 // any installed user-level App Host will remain even if there is no
192 // App Launcher present (the orphaned app_host.exe will prompt the user
193 // for further action when executed).
194 { BrowserDistribution::CHROME_APP_HOST,
195 switches::kChromeAppLauncher,
196 false },
197 };
183 198
184 if (chrome_frame_state != NULL && 199 for (size_t i = 0; i < arraysize(conditional_additions); ++i) {
185 chrome_frame_state->uninstall_command().HasSwitch( 200 const ProductState* product_state = machine_state.GetProductState(
186 switches::kChromeFrameReadyMode) && 201 system_install(), conditional_additions[i].type);
187 !FindProduct(BrowserDistribution::CHROME_FRAME)) { 202 if (product_state != NULL &&
188 // Chrome Frame is installed in Ready Mode. Remove it along with Chrome. 203 product_state->uninstall_command().HasSwitch(
189 Product* p = AddProductFromPreferences( 204 conditional_additions[i].switch_name) ==
190 BrowserDistribution::CHROME_FRAME, prefs, machine_state); 205 conditional_additions[i].switch_expected &&
191 206 !FindProduct(conditional_additions[i].type)) {
192 VLOG(1) << "Uninstall distribution: " 207 Product* p = AddProductFromPreferences(
193 << p->distribution()->GetAppShortCutName(); 208 conditional_additions[i].type, prefs, machine_state);
209 VLOG(1) << "Uninstall distribution: "
210 << p->distribution()->GetAppShortCutName();
211 }
194 } 212 }
195 } 213 }
196 214
197 bool keep_binaries = false; 215 bool keep_binaries = false;
198 // 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
199 // uninstalled. If not found, binaries are uninstalled too. 217 // uninstalled. If not found, binaries are uninstalled too.
200 for (size_t i = 0; i < BrowserDistribution::NUM_TYPES; ++i) { 218 for (size_t i = 0; i < BrowserDistribution::NUM_TYPES; ++i) {
201 BrowserDistribution::Type type = 219 BrowserDistribution::Type type =
202 static_cast<BrowserDistribution::Type>(i); 220 static_cast<BrowserDistribution::Type>(i);
203 221
(...skipping 25 matching lines...) Expand all
229 keep_binaries = true; 247 keep_binaries = true;
230 break; 248 break;
231 } 249 }
232 250
233 } 251 }
234 } 252 }
235 253
236 // The product is being uninstalled. 254 // The product is being uninstalled.
237 } 255 }
238 if (!keep_binaries) { 256 if (!keep_binaries) {
239 Product* p = 257 Product* p = AddProductFromPreferences(
240 AddProductFromPreferences(BrowserDistribution::CHROME_BINARIES, prefs, 258 BrowserDistribution::CHROME_BINARIES, prefs, machine_state);
241 machine_state);
242 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") 259 VLOG(1) << (is_uninstall ? "Uninstall" : "Install")
243 << " distribution: " << p->distribution()->GetAppShortCutName(); 260 << " distribution: " << p->distribution()->GetAppShortCutName();
244 } 261 }
245 } 262 }
246 263
247 BrowserDistribution* operand = NULL; 264 BrowserDistribution* operand = NULL;
248 265
249 if (is_uninstall) { 266 if (is_uninstall) {
250 operation_ = UNINSTALL; 267 operation_ = UNINSTALL;
251 } else if (!prefs.is_multi_install()) { 268 } else if (!prefs.is_multi_install()) {
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 if (is_multi_install()) { 780 if (is_multi_install()) {
764 InstallUtil::AddInstallerResultItems( 781 InstallUtil::AddInstallerResultItems(
765 system_install, multi_package_binaries_distribution()->GetStateKey(), 782 system_install, multi_package_binaries_distribution()->GetStateKey(),
766 status, string_resource_id, launch_cmd, install_list.get()); 783 status, string_resource_id, launch_cmd, install_list.get());
767 } 784 }
768 if (!install_list->Do()) 785 if (!install_list->Do())
769 LOG(ERROR) << "Failed to record installer error information in registry."; 786 LOG(ERROR) << "Failed to record installer error information in registry.";
770 } 787 }
771 788
772 } // namespace installer 789 } // namespace installer
OLDNEW
« no previous file with comments | « chrome/installer/setup/install.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698