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

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

Issue 2286483002: Serialize Google Update state as part of the recovery component update checks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove unused Created 4 years, 3 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 | components/component_updater.gypi » ('j') | 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 8
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
11 11
12 #include "base/base_paths.h" 12 #include "base/base_paths.h"
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/command_line.h" 14 #include "base/command_line.h"
15 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
16 #include "base/files/file_util.h" 16 #include "base/files/file_util.h"
17 #include "base/json/json_file_value_serializer.h" 17 #include "base/json/json_file_value_serializer.h"
18 #include "base/logging.h" 18 #include "base/logging.h"
19 #include "base/metrics/histogram.h" 19 #include "base/metrics/histogram.h"
20 #include "base/path_service.h" 20 #include "base/path_service.h"
21 #include "base/process/kill.h" 21 #include "base/process/kill.h"
22 #include "base/process/launch.h" 22 #include "base/process/launch.h"
23 #include "base/process/process.h" 23 #include "base/process/process.h"
24 #include "base/threading/worker_pool.h" 24 #include "base/threading/worker_pool.h"
25 #include "build/build_config.h" 25 #include "build/build_config.h"
26 #include "chrome/common/chrome_switches.h" 26 #include "chrome/common/chrome_switches.h"
27 #include "chrome/common/pref_names.h" 27 #include "chrome/common/pref_names.h"
28 #if defined(OS_WIN)
29 #include "chrome/installer/util/install_util.h"
30 #endif // OS_WIN
28 #include "components/component_updater/component_updater_paths.h" 31 #include "components/component_updater/component_updater_paths.h"
29 #include "components/component_updater/component_updater_service.h" 32 #include "components/component_updater/component_updater_service.h"
30 #include "components/component_updater/pref_names.h" 33 #include "components/component_updater/pref_names.h"
31 #include "components/prefs/pref_registry_simple.h" 34 #include "components/prefs/pref_registry_simple.h"
32 #include "components/prefs/pref_service.h" 35 #include "components/prefs/pref_service.h"
33 #include "components/update_client/update_client.h" 36 #include "components/update_client/update_client.h"
34 #include "content/public/browser/browser_thread.h" 37 #include "content/public/browser/browser_thread.h"
35 38
36 using content::BrowserThread; 39 using content::BrowserThread;
37 40
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 } 223 }
221 224
222 void RecoveryRegisterHelper(ComponentUpdateService* cus, PrefService* prefs) { 225 void RecoveryRegisterHelper(ComponentUpdateService* cus, PrefService* prefs) {
223 DCHECK_CURRENTLY_ON(BrowserThread::UI); 226 DCHECK_CURRENTLY_ON(BrowserThread::UI);
224 base::Version version(prefs->GetString(prefs::kRecoveryComponentVersion)); 227 base::Version version(prefs->GetString(prefs::kRecoveryComponentVersion));
225 if (!version.IsValid()) { 228 if (!version.IsValid()) {
226 NOTREACHED(); 229 NOTREACHED();
227 return; 230 return;
228 } 231 }
229 232
233 update_client::InstallerAttributes installer_attributes;
234 #if defined(OS_WIN)
235 base::FilePath exe_path;
236 PathService::Get(base::FILE_EXE, &exe_path);
237 installer_attributes["ismachine"] =
238 InstallUtil::IsPerUserInstall(exe_path) ? "0" : "1";
239 #endif // OS_WIN
240
230 update_client::CrxComponent recovery; 241 update_client::CrxComponent recovery;
231 recovery.name = "recovery"; 242 recovery.name = "recovery";
232 recovery.installer = new RecoveryComponentInstaller(version, prefs); 243 recovery.installer = new RecoveryComponentInstaller(version, prefs);
233 recovery.version = version; 244 recovery.version = version;
234 recovery.pk_hash.assign(kSha2Hash, &kSha2Hash[sizeof(kSha2Hash)]); 245 recovery.pk_hash.assign(kSha2Hash, &kSha2Hash[sizeof(kSha2Hash)]);
235 recovery.supports_group_policy_enable_component_updates = true; 246 recovery.supports_group_policy_enable_component_updates = true;
236 recovery.requires_network_encryption = false; 247 recovery.requires_network_encryption = false;
248 recovery.installer_attributes = installer_attributes;
237 if (!cus->RegisterComponent(recovery)) { 249 if (!cus->RegisterComponent(recovery)) {
238 NOTREACHED() << "Recovery component registration failed."; 250 NOTREACHED() << "Recovery component registration failed.";
239 } 251 }
240 } 252 }
241 253
242 void RecoveryUpdateVersionHelper( 254 void RecoveryUpdateVersionHelper(
243 const base::Version& version, PrefService* prefs) { 255 const base::Version& version, PrefService* prefs) {
244 DCHECK_CURRENTLY_ON(BrowserThread::UI); 256 DCHECK_CURRENTLY_ON(BrowserThread::UI);
245 prefs->SetString(prefs::kRecoveryComponentVersion, version.GetString()); 257 prefs->SetString(prefs::kRecoveryComponentVersion, version.GetString());
246 } 258 }
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 #endif // OS_WIN 455 #endif // OS_WIN
444 prefs->SetBoolean(prefs::kRecoveryComponentNeedsElevation, false); 456 prefs->SetBoolean(prefs::kRecoveryComponentNeedsElevation, false);
445 } 457 }
446 458
447 void DeclinedElevatedRecoveryInstall(PrefService* prefs) { 459 void DeclinedElevatedRecoveryInstall(PrefService* prefs) {
448 DCHECK_CURRENTLY_ON(BrowserThread::UI); 460 DCHECK_CURRENTLY_ON(BrowserThread::UI);
449 prefs->SetBoolean(prefs::kRecoveryComponentNeedsElevation, false); 461 prefs->SetBoolean(prefs::kRecoveryComponentNeedsElevation, false);
450 } 462 }
451 463
452 } // namespace component_updater 464 } // namespace component_updater
OLDNEW
« no previous file with comments | « no previous file | components/component_updater.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698