| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/precache/content/precache_manager.h" | 5 #include "components/precache/content/precache_manager.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 96 |
| 97 bool PrecacheManager::IsPrecachingAllowed() const { | 97 bool PrecacheManager::IsPrecachingAllowed() const { |
| 98 return PrecachingAllowed() == AllowedType::ALLOWED; | 98 return PrecachingAllowed() == AllowedType::ALLOWED; |
| 99 } | 99 } |
| 100 | 100 |
| 101 PrecacheManager::AllowedType PrecacheManager::PrecachingAllowed() const { | 101 PrecacheManager::AllowedType PrecacheManager::PrecachingAllowed() const { |
| 102 if (!(sync_service_ && sync_service_->IsEngineInitialized())) | 102 if (!(sync_service_ && sync_service_->IsEngineInitialized())) |
| 103 return AllowedType::PENDING; | 103 return AllowedType::PENDING; |
| 104 | 104 |
| 105 // SyncService delegates to SyncPrefs, which must be called on the UI thread. | 105 // SyncService delegates to SyncPrefs, which must be called on the UI thread. |
| 106 if (history_service_ && | 106 if (history_service_ && !sync_service_->IsLocalSyncEnabled() && |
| 107 sync_service_->GetActiveDataTypes().Has(syncer::SESSIONS) && | 107 sync_service_->GetActiveDataTypes().Has(syncer::SESSIONS) && |
| 108 !sync_service_->GetEncryptedDataTypes().Has(syncer::SESSIONS)) | 108 !sync_service_->GetEncryptedDataTypes().Has(syncer::SESSIONS)) { |
| 109 return AllowedType::ALLOWED; | 109 return AllowedType::ALLOWED; |
| 110 } |
| 110 | 111 |
| 111 return AllowedType::DISALLOWED; | 112 return AllowedType::DISALLOWED; |
| 112 } | 113 } |
| 113 | 114 |
| 114 void PrecacheManager::StartPrecaching( | 115 void PrecacheManager::StartPrecaching( |
| 115 const PrecacheCompletionCallback& precache_completion_callback) { | 116 const PrecacheCompletionCallback& precache_completion_callback) { |
| 116 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 117 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 117 | 118 |
| 118 if (is_precaching_) { | 119 if (is_precaching_) { |
| 119 DLOG(WARNING) << "Cannot start precaching because precaching is already " | 120 DLOG(WARNING) << "Cannot start precaching because precaching is already " |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 this)); | 356 this)); |
| 356 precache_fetcher_->Start(); | 357 precache_fetcher_->Start(); |
| 357 } | 358 } |
| 358 | 359 |
| 359 void PrecacheManager::OnHostsReceivedThenDone( | 360 void PrecacheManager::OnHostsReceivedThenDone( |
| 360 const history::TopHostsList& host_counts) { | 361 const history::TopHostsList& host_counts) { |
| 361 OnDone(); | 362 OnDone(); |
| 362 } | 363 } |
| 363 | 364 |
| 364 } // namespace precache | 365 } // namespace precache |
| OLD | NEW |