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

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

Issue 11570009: Split PrefService into PrefService, PrefServiceSimple and PrefServiceSyncable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments. Created 8 years 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 | Annotate | Revision Log
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 "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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 virtual void OnUpdateError(int error) OVERRIDE; 53 virtual void OnUpdateError(int error) OVERRIDE;
54 54
55 virtual bool Install(base::DictionaryValue* manifest, 55 virtual bool Install(base::DictionaryValue* manifest,
56 const FilePath& unpack_path) OVERRIDE; 56 const FilePath& unpack_path) OVERRIDE;
57 57
58 private: 58 private:
59 Version current_version_; 59 Version current_version_;
60 PrefService* prefs_; 60 PrefService* prefs_;
61 }; 61 };
62 62
63 void RecoveryRegisterHelper(ComponentUpdateService* cus, PrefService* prefs) { 63 void RecoveryRegisterHelper(ComponentUpdateService* cus,
64 PrefServiceSimple* prefs) {
64 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 65 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
66 // TODO(joi): Registrations for local state prefs shouldn't happen
67 // like this, they should be done via
68 // browser_prefs::RegisterLocalState.
65 prefs->RegisterStringPref(prefs::kRecoveryComponentVersion, "0.0.0.0"); 69 prefs->RegisterStringPref(prefs::kRecoveryComponentVersion, "0.0.0.0");
66 Version version(prefs->GetString(prefs::kRecoveryComponentVersion)); 70 Version version(prefs->GetString(prefs::kRecoveryComponentVersion));
67 if (!version.IsValid()) { 71 if (!version.IsValid()) {
68 NOTREACHED(); 72 NOTREACHED();
69 return; 73 return;
70 } 74 }
71 75
72 CrxComponent recovery; 76 CrxComponent recovery;
73 recovery.name = "recovery"; 77 recovery.name = "recovery";
74 recovery.installer = new RecoveryComponentInstaller(version, prefs); 78 recovery.installer = new RecoveryComponentInstaller(version, prefs);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 } 127 }
124 current_version_ = version; 128 current_version_ = version;
125 if (prefs_) { 129 if (prefs_) {
126 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 130 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
127 base::Bind(&RecoveryUpdateVersionHelper, version, prefs_)); 131 base::Bind(&RecoveryUpdateVersionHelper, version, prefs_));
128 } 132 }
129 return base::LaunchProcess(cmdline, base::LaunchOptions(), NULL); 133 return base::LaunchProcess(cmdline, base::LaunchOptions(), NULL);
130 } 134 }
131 135
132 void RegisterRecoveryComponent(ComponentUpdateService* cus, 136 void RegisterRecoveryComponent(ComponentUpdateService* cus,
133 PrefService* prefs) { 137 PrefServiceSimple* prefs) {
134 #if !defined(OS_CHROMEOS) 138 #if !defined(OS_CHROMEOS)
135 // We delay execute the registration because we are not required in 139 // We delay execute the registration because we are not required in
136 // the critical path during browser startup. 140 // the critical path during browser startup.
137 BrowserThread::PostDelayedTask( 141 BrowserThread::PostDelayedTask(
138 BrowserThread::UI, 142 BrowserThread::UI,
139 FROM_HERE, 143 FROM_HERE,
140 base::Bind(&RecoveryRegisterHelper, cus, prefs), 144 base::Bind(&RecoveryRegisterHelper, cus, prefs),
141 base::TimeDelta::FromSeconds(6)); 145 base::TimeDelta::FromSeconds(6));
142 #endif 146 #endif
143 } 147 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698