| OLD | NEW |
| 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 "base/base_paths.h" | 7 #include "base/base_paths.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 if (name != kRecoveryManifestName) | 105 if (name != kRecoveryManifestName) |
| 106 return false; | 106 return false; |
| 107 std::string proposed_version; | 107 std::string proposed_version; |
| 108 manifest.GetStringASCII("version", &proposed_version); | 108 manifest.GetStringASCII("version", &proposed_version); |
| 109 Version version(proposed_version.c_str()); | 109 Version version(proposed_version.c_str()); |
| 110 if (!version.IsValid()) | 110 if (!version.IsValid()) |
| 111 return false; | 111 return false; |
| 112 if (current_version_.CompareTo(version) >= 0) | 112 if (current_version_.CompareTo(version) >= 0) |
| 113 return false; | 113 return false; |
| 114 base::FilePath main_file = unpack_path.Append(kRecoveryFileName); | 114 base::FilePath main_file = unpack_path.Append(kRecoveryFileName); |
| 115 if (!file_util::PathExists(main_file)) | 115 if (!base::PathExists(main_file)) |
| 116 return false; | 116 return false; |
| 117 // Passed the basic tests. The installation continues with the | 117 // Passed the basic tests. The installation continues with the |
| 118 // recovery component itself running from the temp directory. | 118 // recovery component itself running from the temp directory. |
| 119 CommandLine cmdline(main_file); | 119 CommandLine cmdline(main_file); |
| 120 std::string arguments; | 120 std::string arguments; |
| 121 if (manifest.GetStringASCII("x-recovery-args", &arguments)) | 121 if (manifest.GetStringASCII("x-recovery-args", &arguments)) |
| 122 cmdline.AppendArg(arguments); | 122 cmdline.AppendArg(arguments); |
| 123 std::string add_version; | 123 std::string add_version; |
| 124 if (manifest.GetStringASCII("x-recovery-add-version", &add_version)) { | 124 if (manifest.GetStringASCII("x-recovery-add-version", &add_version)) { |
| 125 if (add_version == "yes") | 125 if (add_version == "yes") |
| (...skipping 21 matching lines...) Expand all Loading... |
| 147 BrowserThread::UI, | 147 BrowserThread::UI, |
| 148 FROM_HERE, | 148 FROM_HERE, |
| 149 base::Bind(&RecoveryRegisterHelper, cus, prefs), | 149 base::Bind(&RecoveryRegisterHelper, cus, prefs), |
| 150 base::TimeDelta::FromSeconds(6)); | 150 base::TimeDelta::FromSeconds(6)); |
| 151 #endif | 151 #endif |
| 152 } | 152 } |
| 153 | 153 |
| 154 void RegisterPrefsForRecoveryComponent(PrefRegistrySimple* registry) { | 154 void RegisterPrefsForRecoveryComponent(PrefRegistrySimple* registry) { |
| 155 registry->RegisterStringPref(prefs::kRecoveryComponentVersion, "0.0.0.0"); | 155 registry->RegisterStringPref(prefs::kRecoveryComponentVersion, "0.0.0.0"); |
| 156 } | 156 } |
| OLD | NEW |