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

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

Issue 2657673004: Add shutdown notification and service refs to SyncServiceObserver. (Closed)
Patch Set: Use parameter Created 3 years, 10 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 BrowserThread::PostTask( 147 BrowserThread::PostTask(
148 BrowserThread::FILE, FROM_HERE, 148 BrowserThread::FILE, FROM_HERE,
149 base::Bind(&ExternalPrefLoader::LoadOnFileThread, this)); 149 base::Bind(&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() { 157 void ExternalPrefLoader::OnStateChanged(syncer::SyncService* sync) {
158 browser_sync::ProfileSyncService* service = 158 if (!sync->CanSyncStart()) {
sky 2017/01/27 16:29:44 remove {}
Steven Holte 2017/01/27 20:11:45 Done.
159 ProfileSyncServiceFactory::GetForProfile(profile_);
160 DCHECK(service);
161 if (!service->CanSyncStart()) {
162 PostLoadAndRemoveObservers(); 159 PostLoadAndRemoveObservers();
163 } 160 }
164 } 161 }
165 162
166 bool ExternalPrefLoader::PostLoadIfPrioritySyncReady() { 163 bool ExternalPrefLoader::PostLoadIfPrioritySyncReady() {
167 DCHECK(options_ & DELAY_LOAD_UNTIL_PRIORITY_SYNC); 164 DCHECK(options_ & DELAY_LOAD_UNTIL_PRIORITY_SYNC);
168 DCHECK(profile_); 165 DCHECK(profile_);
169 166
170 sync_preferences::PrefServiceSyncable* prefs = 167 sync_preferences::PrefServiceSyncable* prefs =
171 PrefServiceSyncableFromProfile(profile_); 168 PrefServiceSyncableFromProfile(profile_);
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 LoadFinished(); 327 LoadFinished();
331 } 328 }
332 329
333 ExternalTestingLoader::~ExternalTestingLoader() {} 330 ExternalTestingLoader::~ExternalTestingLoader() {}
334 331
335 const base::FilePath ExternalTestingLoader::GetBaseCrxFilePath() { 332 const base::FilePath ExternalTestingLoader::GetBaseCrxFilePath() {
336 return fake_base_path_; 333 return fake_base_path_;
337 } 334 }
338 335
339 } // namespace extensions 336 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698