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

Unified 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: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/component_updater/recovery_component_installer.cc
diff --git a/chrome/browser/component_updater/recovery_component_installer.cc b/chrome/browser/component_updater/recovery_component_installer.cc
index 2563b103c3d256df62194efce880ff9ca1433ee5..0b901e6073475777698b896a14fe0ed768dbce3a 100644
--- a/chrome/browser/component_updater/recovery_component_installer.cc
+++ b/chrome/browser/component_updater/recovery_component_installer.cc
@@ -88,6 +88,32 @@ bool SimulatingElevatedRecovery() {
}
#endif // !defined(OS_CHROMEOS)
+base::CommandLine GetRecoveryInstallCommandLine(
+ const base::FilePath& command,
+ const base::DictionaryValue& manifest,
+ bool is_deferred_run,
+ const Version& version) {
+ base::CommandLine command_line(command);
+
+ // Add a flag to for re-attempted install with elevated privilege so that the
+ // recovery executable can report back accordingly.
+ if (is_deferred_run)
+ command_line.AppendArg("/deferredrun");
+
+ std::string arguments;
+ if (manifest.GetStringASCII("x-recovery-args", &arguments))
+ command_line.AppendArg(arguments);
+ std::string add_version;
+ if (manifest.GetStringASCII("x-recovery-add-version", &add_version) &&
+ add_version == "yes") {
+ std::string version_string = "/version ";
+ version_string += version.GetString();
+ command_line.AppendArg(version_string);
+ }
+
+ return command_line;
+}
+
#if defined(OS_WIN)
scoped_ptr<base::DictionaryValue> ReadManifest(const base::FilePath& manifest) {
JSONFileValueDeserializer deserializer(manifest);
@@ -132,15 +158,9 @@ void DoElevatedInstallRecoveryComponent(const base::FilePath& path) {
if (!version.IsValid())
return;
- base::CommandLine cmdline(main_file);
- std::string arguments;
- if (manifest->GetStringASCII("x-recovery-args", &arguments))
- cmdline.AppendArg(arguments);
- std::string add_version;
- if (manifest->GetStringASCII("x-recovery-add-version", &add_version) &&
- add_version == "yes") {
- cmdline.AppendSwitchASCII("version", version.GetString());
- }
+ const bool is_deferred_run = true;
+ const auto cmdline = GetRecoveryInstallCommandLine(
+ main_file, *manifest, is_deferred_run, version);
RecordRecoveryComponentUMAEvent(RCE_RUNNING_ELEVATED);
@@ -331,16 +351,11 @@ bool RecoveryComponentInstaller::Install(const base::DictionaryValue& manifest,
base::FilePath main_file = path.Append(kRecoveryFileName);
if (!base::PathExists(main_file))
return false;
+
// Run the recovery component.
- base::CommandLine cmdline(main_file);
- std::string arguments;
- if (manifest.GetStringASCII("x-recovery-args", &arguments))
- cmdline.AppendArg(arguments);
- std::string add_version;
- if (manifest.GetStringASCII("x-recovery-add-version", &add_version) &&
- add_version == "yes") {
- cmdline.AppendSwitchASCII("version", current_version_.GetString());
- }
+ const bool is_deferred_run = false;
+ const auto cmdline = GetRecoveryInstallCommandLine(
+ main_file, manifest, is_deferred_run, current_version_);
if (!RunInstallCommand(cmdline, path)) {
return false;
« 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