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

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

Issue 2657673004: Add shutdown notification and service refs to SyncServiceObserver. (Closed)
Patch Set: Chromeos fix 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())
159 ProfileSyncServiceFactory::GetForProfile(profile_);
160 DCHECK(service);
161 if (!service->CanSyncStart()) {
162 PostLoadAndRemoveObservers(); 159 PostLoadAndRemoveObservers();
163 }
164 } 160 }
165 161
166 bool ExternalPrefLoader::PostLoadIfPrioritySyncReady() { 162 bool ExternalPrefLoader::PostLoadIfPrioritySyncReady() {
167 DCHECK(options_ & DELAY_LOAD_UNTIL_PRIORITY_SYNC); 163 DCHECK(options_ & DELAY_LOAD_UNTIL_PRIORITY_SYNC);
168 DCHECK(profile_); 164 DCHECK(profile_);
169 165
170 sync_preferences::PrefServiceSyncable* prefs = 166 sync_preferences::PrefServiceSyncable* prefs =
171 PrefServiceSyncableFromProfile(profile_); 167 PrefServiceSyncableFromProfile(profile_);
172 DCHECK(prefs); 168 DCHECK(prefs);
173 if (prefs->IsPrioritySyncing()) { 169 if (prefs->IsPrioritySyncing()) {
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 LoadFinished(); 326 LoadFinished();
331 } 327 }
332 328
333 ExternalTestingLoader::~ExternalTestingLoader() {} 329 ExternalTestingLoader::~ExternalTestingLoader() {}
334 330
335 const base::FilePath ExternalTestingLoader::GetBaseCrxFilePath() { 331 const base::FilePath ExternalTestingLoader::GetBaseCrxFilePath() {
336 return fake_base_path_; 332 return fake_base_path_;
337 } 333 }
338 334
339 } // namespace extensions 335 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/external_pref_loader.h ('k') | chrome/browser/history/browsing_history_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698