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

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; cleanups; checking current level instead of forced user level. 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(
grt (UTC plus 2) 2012/11/16 21:01:46 reformatting like this makes it more difficult to
huangs 2012/11/16 21:32:02 Okay, will avoid in future.
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()) {
176 // Uninstall App Host if Chrome is being uninstalled, and (non-App Launcher)
177 // App Host exists. If we uninstall system-level Chrome, but we have
178 // user-level (non-App Launcher) App Host, then app_host.exe remains.
179 // On next execution, app_host.exe prompts user for further action.
180 if (is_uninstall && prefs.install_chrome()
grt (UTC plus 2) 2012/11/16 21:01:46 - is_uninstall is tested on line 175, so please re
huangs 2012/11/16 21:32:02 Done.
181 && !prefs.install_chrome_app_host()) {
182 const ProductState* app_host_state = machine_state.GetProductState(
183 system_install(), BrowserDistribution::CHROME_APP_HOST);
184 // If App Host (non-App Launcher) is installed.
185 if (app_host_state && !app_host_state->uninstall_command()
186 .HasSwitch(switches::kChromeAppLauncher)) {
187 Product* p = AddProductFromPreferences(
188 BrowserDistribution::CHROME_APP_HOST, prefs, machine_state);
189 VLOG(1) << "Also uninstall distribution: "
190 << p->distribution()->GetAppShortCutName();
191 }
192 }
193
180 if (FindProduct(BrowserDistribution::CHROME_BROWSER)) { 194 if (FindProduct(BrowserDistribution::CHROME_BROWSER)) {
181 const ProductState* chrome_frame_state = machine_state.GetProductState( 195 const ProductState* chrome_frame_state = machine_state.GetProductState(
182 system_install(), BrowserDistribution::CHROME_FRAME); 196 system_install(), BrowserDistribution::CHROME_FRAME);
183 197
184 if (chrome_frame_state != NULL && 198 if (chrome_frame_state != NULL &&
185 chrome_frame_state->uninstall_command().HasSwitch( 199 chrome_frame_state->uninstall_command().HasSwitch(
186 switches::kChromeFrameReadyMode) && 200 switches::kChromeFrameReadyMode) &&
187 !FindProduct(BrowserDistribution::CHROME_FRAME)) { 201 !FindProduct(BrowserDistribution::CHROME_FRAME)) {
188 // Chrome Frame is installed in Ready Mode. Remove it along with Chrome. 202 // Chrome Frame is installed in Ready Mode. Remove it along with Chrome.
189 Product* p = AddProductFromPreferences( 203 Product* p = AddProductFromPreferences(
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 keep_binaries = true; 243 keep_binaries = true;
230 break; 244 break;
231 } 245 }
232 246
233 } 247 }
234 } 248 }
235 249
236 // The product is being uninstalled. 250 // The product is being uninstalled.
237 } 251 }
238 if (!keep_binaries) { 252 if (!keep_binaries) {
239 Product* p = 253 Product* p = AddProductFromPreferences(
240 AddProductFromPreferences(BrowserDistribution::CHROME_BINARIES, prefs, 254 BrowserDistribution::CHROME_BINARIES, prefs, machine_state);
241 machine_state);
242 VLOG(1) << (is_uninstall ? "Uninstall" : "Install") 255 VLOG(1) << (is_uninstall ? "Uninstall" : "Install")
243 << " distribution: " << p->distribution()->GetAppShortCutName(); 256 << " distribution: " << p->distribution()->GetAppShortCutName();
244 } 257 }
245 } 258 }
246 259
247 BrowserDistribution* operand = NULL; 260 BrowserDistribution* operand = NULL;
248 261
249 if (is_uninstall) { 262 if (is_uninstall) {
250 operation_ = UNINSTALL; 263 operation_ = UNINSTALL;
251 } else if (!prefs.is_multi_install()) { 264 } else if (!prefs.is_multi_install()) {
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 if (is_multi_install()) { 776 if (is_multi_install()) {
764 InstallUtil::AddInstallerResultItems( 777 InstallUtil::AddInstallerResultItems(
765 system_install, multi_package_binaries_distribution()->GetStateKey(), 778 system_install, multi_package_binaries_distribution()->GetStateKey(),
766 status, string_resource_id, launch_cmd, install_list.get()); 779 status, string_resource_id, launch_cmd, install_list.get());
767 } 780 }
768 if (!install_list->Do()) 781 if (!install_list->Do())
769 LOG(ERROR) << "Failed to record installer error information in registry."; 782 LOG(ERROR) << "Failed to record installer error information in registry.";
770 } 783 }
771 784
772 } // namespace installer 785 } // 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