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

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

Issue 2657673004: Add shutdown notification and service refs to SyncServiceObserver. (Closed)
Patch Set: Add SyncService* to OnStateChanged Created 3 years, 11 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 browser_sync::ProfileSyncService* service =
skym 2017/01/26 23:43:22 This variable can be replaced by |sync|.
Steven Holte 2017/01/27 02:27:19 Done.
159 ProfileSyncServiceFactory::GetForProfile(profile_); 159 ProfileSyncServiceFactory::GetForProfile(profile_);
160 DCHECK(service); 160 DCHECK(service);
skym 2017/01/26 23:43:23 I'd remove the DCHECK as well while you're in here
Steven Holte 2017/01/27 02:27:19 Done.
161 if (!service->CanSyncStart()) { 161 if (!service->CanSyncStart()) {
162 PostLoadAndRemoveObservers(); 162 PostLoadAndRemoveObservers();
163 } 163 }
164 } 164 }
165 165
166 bool ExternalPrefLoader::PostLoadIfPrioritySyncReady() { 166 bool ExternalPrefLoader::PostLoadIfPrioritySyncReady() {
167 DCHECK(options_ & DELAY_LOAD_UNTIL_PRIORITY_SYNC); 167 DCHECK(options_ & DELAY_LOAD_UNTIL_PRIORITY_SYNC);
168 DCHECK(profile_); 168 DCHECK(profile_);
169 169
170 sync_preferences::PrefServiceSyncable* prefs = 170 sync_preferences::PrefServiceSyncable* prefs =
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 LoadFinished(); 330 LoadFinished();
331 } 331 }
332 332
333 ExternalTestingLoader::~ExternalTestingLoader() {} 333 ExternalTestingLoader::~ExternalTestingLoader() {}
334 334
335 const base::FilePath ExternalTestingLoader::GetBaseCrxFilePath() { 335 const base::FilePath ExternalTestingLoader::GetBaseCrxFilePath() {
336 return fake_base_path_; 336 return fake_base_path_;
337 } 337 }
338 338
339 } // namespace extensions 339 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698