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

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: Ready for review. 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));
65 prefs->RegisterStringPref(prefs::kRecoveryComponentVersion, "0.0.0.0"); 66 prefs->RegisterStringPref(prefs::kRecoveryComponentVersion, "0.0.0.0");
Mattias Nissler (ping if slow) 2012/12/19 19:50:22 random note: This shouldn't be registered here but
Jói 2012/12/20 16:30:31 Agreed. Added a TODO to fix it.
66 Version version(prefs->GetString(prefs::kRecoveryComponentVersion)); 67 Version version(prefs->GetString(prefs::kRecoveryComponentVersion));
67 if (!version.IsValid()) { 68 if (!version.IsValid()) {
68 NOTREACHED(); 69 NOTREACHED();
69 return; 70 return;
70 } 71 }
71 72
72 CrxComponent recovery; 73 CrxComponent recovery;
73 recovery.name = "recovery"; 74 recovery.name = "recovery";
74 recovery.installer = new RecoveryComponentInstaller(version, prefs); 75 recovery.installer = new RecoveryComponentInstaller(version, prefs);
75 recovery.version = version; 76 recovery.version = version;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 } 124 }
124 current_version_ = version; 125 current_version_ = version;
125 if (prefs_) { 126 if (prefs_) {
126 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 127 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
127 base::Bind(&RecoveryUpdateVersionHelper, version, prefs_)); 128 base::Bind(&RecoveryUpdateVersionHelper, version, prefs_));
128 } 129 }
129 return base::LaunchProcess(cmdline, base::LaunchOptions(), NULL); 130 return base::LaunchProcess(cmdline, base::LaunchOptions(), NULL);
130 } 131 }
131 132
132 void RegisterRecoveryComponent(ComponentUpdateService* cus, 133 void RegisterRecoveryComponent(ComponentUpdateService* cus,
133 PrefService* prefs) { 134 PrefServiceSimple* prefs) {
134 #if !defined(OS_CHROMEOS) 135 #if !defined(OS_CHROMEOS)
135 // We delay execute the registration because we are not required in 136 // We delay execute the registration because we are not required in
136 // the critical path during browser startup. 137 // the critical path during browser startup.
137 BrowserThread::PostDelayedTask( 138 BrowserThread::PostDelayedTask(
138 BrowserThread::UI, 139 BrowserThread::UI,
139 FROM_HERE, 140 FROM_HERE,
140 base::Bind(&RecoveryRegisterHelper, cus, prefs), 141 base::Bind(&RecoveryRegisterHelper, cus, prefs),
141 base::TimeDelta::FromSeconds(6)); 142 base::TimeDelta::FromSeconds(6));
142 #endif 143 #endif
143 } 144 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698