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

Side by Side Diff: chrome/browser/extensions/external_pref_loader.cc

Issue 2825963003: Rewrite base::Bind to base::BindOnce with base_bind_rewriters in //chrome/browser/extensions (Closed)
Patch Set: Created 3 years, 8 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
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/extensions/external_pref_loader.h" 5 #include "chrome/browser/extensions/external_pref_loader.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_enumerator.h" 10 #include "base/files/file_enumerator.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 if (service->CanSyncStart() && (service->IsFirstSetupComplete() || 139 if (service->CanSyncStart() && (service->IsFirstSetupComplete() ||
140 browser_defaults::kSyncAutoStarts)) { 140 browser_defaults::kSyncAutoStarts)) {
141 service->AddObserver(this); 141 service->AddObserver(this);
142 } else { 142 } else {
143 PostLoadAndRemoveObservers(); 143 PostLoadAndRemoveObservers();
144 } 144 }
145 } 145 }
146 } else { 146 } else {
147 BrowserThread::PostTask( 147 BrowserThread::PostTask(
148 BrowserThread::FILE, FROM_HERE, 148 BrowserThread::FILE, FROM_HERE,
149 base::Bind(&ExternalPrefLoader::LoadOnFileThread, this)); 149 base::BindOnce(&ExternalPrefLoader::LoadOnFileThread, this));
150 } 150 }
151 } 151 }
152 152
153 void ExternalPrefLoader::OnIsSyncingChanged() { 153 void ExternalPrefLoader::OnIsSyncingChanged() {
154 PostLoadIfPrioritySyncReady(); 154 PostLoadIfPrioritySyncReady();
155 } 155 }
156 156
157 void ExternalPrefLoader::OnStateChanged(syncer::SyncService* sync) { 157 void ExternalPrefLoader::OnStateChanged(syncer::SyncService* sync) {
158 if (!sync->CanSyncStart()) 158 if (!sync->CanSyncStart())
159 PostLoadAndRemoveObservers(); 159 PostLoadAndRemoveObservers();
(...skipping 20 matching lines...) Expand all
180 DCHECK(prefs); 180 DCHECK(prefs);
181 syncable_pref_observer_.Remove(prefs); 181 syncable_pref_observer_.Remove(prefs);
182 182
183 browser_sync::ProfileSyncService* service = 183 browser_sync::ProfileSyncService* service =
184 ProfileSyncServiceFactory::GetForProfile(profile_); 184 ProfileSyncServiceFactory::GetForProfile(profile_);
185 DCHECK(service); 185 DCHECK(service);
186 service->RemoveObserver(this); 186 service->RemoveObserver(this);
187 187
188 BrowserThread::PostTask( 188 BrowserThread::PostTask(
189 BrowserThread::FILE, FROM_HERE, 189 BrowserThread::FILE, FROM_HERE,
190 base::Bind(&ExternalPrefLoader::LoadOnFileThread, this)); 190 base::BindOnce(&ExternalPrefLoader::LoadOnFileThread, this));
191 } 191 }
192 192
193 void ExternalPrefLoader::LoadOnFileThread() { 193 void ExternalPrefLoader::LoadOnFileThread() {
194 CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 194 CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
195 195
196 std::unique_ptr<base::DictionaryValue> prefs(new base::DictionaryValue); 196 std::unique_ptr<base::DictionaryValue> prefs(new base::DictionaryValue);
197 197
198 // TODO(skerner): Some values of base_path_id_ will cause 198 // TODO(skerner): Some values of base_path_id_ will cause
199 // PathService::Get() to return false, because the path does 199 // PathService::Get() to return false, because the path does
200 // not exist. Find and fix the build/install scripts so that 200 // not exist. Find and fix the build/install scripts so that
(...skipping 20 matching lines...) Expand all
221 } 221 }
222 222
223 // If we have any records to process, then we must have 223 // If we have any records to process, then we must have
224 // read at least one .json file. If so, then we should have 224 // read at least one .json file. If so, then we should have
225 // set |base_path_|. 225 // set |base_path_|.
226 if (!prefs_->empty()) 226 if (!prefs_->empty())
227 CHECK(!base_path_.empty()); 227 CHECK(!base_path_.empty());
228 228
229 BrowserThread::PostTask( 229 BrowserThread::PostTask(
230 BrowserThread::UI, FROM_HERE, 230 BrowserThread::UI, FROM_HERE,
231 base::Bind(&ExternalPrefLoader::LoadFinished, this)); 231 base::BindOnce(&ExternalPrefLoader::LoadFinished, this));
232 } 232 }
233 233
234 void ExternalPrefLoader::ReadExternalExtensionPrefFile( 234 void ExternalPrefLoader::ReadExternalExtensionPrefFile(
235 base::DictionaryValue* prefs) { 235 base::DictionaryValue* prefs) {
236 CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 236 CHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
237 CHECK(NULL != prefs); 237 CHECK(NULL != prefs);
238 238
239 base::FilePath json_file = base_path_.Append(kExternalExtensionJson); 239 base::FilePath json_file = base_path_.Append(kExternalExtensionJson);
240 240
241 if (!base::PathExists(json_file)) { 241 if (!base::PathExists(json_file)) {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 LoadFinished(); 326 LoadFinished();
327 } 327 }
328 328
329 ExternalTestingLoader::~ExternalTestingLoader() {} 329 ExternalTestingLoader::~ExternalTestingLoader() {}
330 330
331 const base::FilePath ExternalTestingLoader::GetBaseCrxFilePath() { 331 const base::FilePath ExternalTestingLoader::GetBaseCrxFilePath() {
332 return fake_base_path_; 332 return fake_base_path_;
333 } 333 }
334 334
335 } // namespace extensions 335 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/external_install_error.cc ('k') | chrome/browser/extensions/fake_safe_browsing_database_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698