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

Side by Side Diff: chrome/browser/component_updater/recovery_component_installer.cc

Issue 1136943004: add flags to recovery executable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed executable bit Created 5 years, 7 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
« no previous file with comments | « no previous file | 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/browser/component_updater/recovery_component_installer.h" 5 #include "chrome/browser/component_updater/recovery_component_installer.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <string> 8 #include <string>
9 9
10 #include "base/base_paths.h" 10 #include "base/base_paths.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 manifest->GetStringASCII("name", &name); 126 manifest->GetStringASCII("name", &name);
127 if (name != kRecoveryManifestName) 127 if (name != kRecoveryManifestName)
128 return; 128 return;
129 std::string proposed_version; 129 std::string proposed_version;
130 manifest->GetStringASCII("version", &proposed_version); 130 manifest->GetStringASCII("version", &proposed_version);
131 const Version version(proposed_version.c_str()); 131 const Version version(proposed_version.c_str());
132 if (!version.IsValid()) 132 if (!version.IsValid())
133 return; 133 return;
134 134
135 base::CommandLine cmdline(main_file); 135 base::CommandLine cmdline(main_file);
136
137 // Add a flag to indicate this is a re-attempted install so that the recovery
138 // executable can report back accordingly.
139 cmdline.AppendArg("/deferredrun");
140
136 std::string arguments; 141 std::string arguments;
137 if (manifest->GetStringASCII("x-recovery-args", &arguments)) 142 if (manifest->GetStringASCII("x-recovery-args", &arguments))
138 cmdline.AppendArg(arguments); 143 cmdline.AppendArg(arguments);
139 std::string add_version; 144 std::string add_version;
140 if (manifest->GetStringASCII("x-recovery-add-version", &add_version) && 145 if (manifest->GetStringASCII("x-recovery-add-version", &add_version) &&
141 add_version == "yes") { 146 add_version == "yes") {
142 cmdline.AppendSwitchASCII("version", version.GetString()); 147 std::string version_string = "/version ";
148 version_string += version.GetString();
149 cmdline.AppendArg(version_string);
143 } 150 }
144 151
145 RecordRecoveryComponentUMAEvent(RCE_RUNNING_ELEVATED); 152 RecordRecoveryComponentUMAEvent(RCE_RUNNING_ELEVATED);
146 153
147 base::LaunchOptions options; 154 base::LaunchOptions options;
148 options.start_hidden = true; 155 options.start_hidden = true;
149 base::Process process = base::LaunchElevatedProcess(cmdline, options); 156 base::Process process = base::LaunchElevatedProcess(cmdline, options);
150 157
151 base::WorkerPool::PostTask( 158 base::WorkerPool::PostTask(
152 FROM_HERE, 159 FROM_HERE,
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 if (!base::PathExists(main_file)) 339 if (!base::PathExists(main_file))
333 return false; 340 return false;
334 // Run the recovery component. 341 // Run the recovery component.
335 base::CommandLine cmdline(main_file); 342 base::CommandLine cmdline(main_file);
336 std::string arguments; 343 std::string arguments;
337 if (manifest.GetStringASCII("x-recovery-args", &arguments)) 344 if (manifest.GetStringASCII("x-recovery-args", &arguments))
338 cmdline.AppendArg(arguments); 345 cmdline.AppendArg(arguments);
339 std::string add_version; 346 std::string add_version;
340 if (manifest.GetStringASCII("x-recovery-add-version", &add_version) && 347 if (manifest.GetStringASCII("x-recovery-add-version", &add_version) &&
341 add_version == "yes") { 348 add_version == "yes") {
342 cmdline.AppendSwitchASCII("version", current_version_.GetString()); 349 std::string version_string = "/version ";
Sorin Jianu 2015/05/16 00:19:11 As discussed, we could factor this out as a functi
xiaoling 2015/05/16 01:20:09 Done.
350 version_string += current_version_.GetString();
351 cmdline.AppendArg(version_string);
343 } 352 }
344 353
345 if (!RunInstallCommand(cmdline, path)) { 354 if (!RunInstallCommand(cmdline, path)) {
346 return false; 355 return false;
347 } 356 }
348 357
349 current_version_ = version; 358 current_version_ = version;
350 if (prefs_) { 359 if (prefs_) {
351 BrowserThread::PostTask( 360 BrowserThread::PostTask(
352 BrowserThread::UI, 361 BrowserThread::UI,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 #endif // OS_WIN 411 #endif // OS_WIN
403 prefs->SetBoolean(prefs::kRecoveryComponentNeedsElevation, false); 412 prefs->SetBoolean(prefs::kRecoveryComponentNeedsElevation, false);
404 } 413 }
405 414
406 void DeclinedElevatedRecoveryInstall(PrefService* prefs) { 415 void DeclinedElevatedRecoveryInstall(PrefService* prefs) {
407 DCHECK_CURRENTLY_ON(BrowserThread::UI); 416 DCHECK_CURRENTLY_ON(BrowserThread::UI);
408 prefs->SetBoolean(prefs::kRecoveryComponentNeedsElevation, false); 417 prefs->SetBoolean(prefs::kRecoveryComponentNeedsElevation, false);
409 } 418 }
410 419
411 } // namespace component_updater 420 } // namespace component_updater
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698