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

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

Issue 2618583005: Remove support for non-browser products from InstallationState and ProductState. (Closed)
Patch Set: sync to position 442664 Created 3 years, 11 months 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
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/google_update_util.h" 5 #include "chrome/installer/util/google_update_util.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 return success; 145 return success;
146 } 146 }
147 147
148 void ElevateIfNeededToReenableUpdates() { 148 void ElevateIfNeededToReenableUpdates() {
149 base::FilePath chrome_exe; 149 base::FilePath chrome_exe;
150 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) { 150 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) {
151 NOTREACHED(); 151 NOTREACHED();
152 return; 152 return;
153 } 153 }
154 installer::ProductState product_state; 154 installer::ProductState product_state;
155 BrowserDistribution* dist = BrowserDistribution::GetDistribution();
156 const bool system_install = !InstallUtil::IsPerUserInstall(chrome_exe); 155 const bool system_install = !InstallUtil::IsPerUserInstall(chrome_exe);
157 if (!product_state.Initialize(system_install, dist)) 156 if (!product_state.Initialize(system_install))
158 return; 157 return;
159 base::FilePath exe_path(product_state.GetSetupPath()); 158 base::FilePath exe_path(product_state.GetSetupPath());
160 if (exe_path.empty() || !base::PathExists(exe_path)) { 159 if (exe_path.empty() || !base::PathExists(exe_path)) {
161 LOG(ERROR) << "Could not find setup.exe to reenable updates."; 160 LOG(ERROR) << "Could not find setup.exe to reenable updates.";
162 return; 161 return;
163 } 162 }
164 163
165 base::CommandLine cmd(exe_path); 164 base::CommandLine cmd(exe_path);
166 cmd.AppendSwitch(installer::switches::kReenableAutoupdates); 165 cmd.AppendSwitch(installer::switches::kReenableAutoupdates);
167 installer::Product product(dist); 166 installer::Product product(BrowserDistribution::GetDistribution());
168 product.InitializeFromUninstallCommand(product_state.uninstall_command()); 167 product.InitializeFromUninstallCommand(product_state.uninstall_command());
169 product.AppendProductFlags(&cmd); 168 product.AppendProductFlags(&cmd);
170 if (system_install) 169 if (system_install)
171 cmd.AppendSwitch(installer::switches::kSystemLevel); 170 cmd.AppendSwitch(installer::switches::kSystemLevel);
172 if (product_state.uninstall_command().HasSwitch( 171 if (product_state.uninstall_command().HasSwitch(
173 installer::switches::kVerboseLogging)) { 172 installer::switches::kVerboseLogging)) {
174 cmd.AppendSwitch(installer::switches::kVerboseLogging); 173 cmd.AppendSwitch(installer::switches::kVerboseLogging);
175 } 174 }
176 175
177 base::LaunchOptions launch_options; 176 base::LaunchOptions launch_options;
178 launch_options.force_breakaway_from_job_ = true; 177 launch_options.force_breakaway_from_job_ = true;
179 178
180 if (base::win::UserAccountControlIsEnabled()) 179 if (base::win::UserAccountControlIsEnabled())
181 base::LaunchElevatedProcess(cmd, launch_options); 180 base::LaunchElevatedProcess(cmd, launch_options);
182 else 181 else
183 base::LaunchProcess(cmd, launch_options); 182 base::LaunchProcess(cmd, launch_options);
184 } 183 }
185 184
186 } // namespace google_update 185 } // namespace google_update
OLDNEW
« no previous file with comments | « chrome/installer/util/google_update_settings_unittest.cc ('k') | chrome/installer/util/helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698