OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |