| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 kPrecacheFieldTrialName, kDataReductionProxyParam).empty(); | 116 kPrecacheFieldTrialName, kDataReductionProxyParam).empty(); |
| 117 if (disable_if_proxy && | 117 if (disable_if_proxy && |
| 118 (!data_reduction_proxy_settings_ || | 118 (!data_reduction_proxy_settings_ || |
| 119 data_reduction_proxy_settings_->IsDataReductionProxyEnabled())) | 119 data_reduction_proxy_settings_->IsDataReductionProxyEnabled())) |
| 120 return AllowedType::DISALLOWED; | 120 return AllowedType::DISALLOWED; |
| 121 | 121 |
| 122 if (!(sync_service_ && sync_service_->IsEngineInitialized())) | 122 if (!(sync_service_ && sync_service_->IsEngineInitialized())) |
| 123 return AllowedType::PENDING; | 123 return AllowedType::PENDING; |
| 124 | 124 |
| 125 // SyncService delegates to SyncPrefs, which must be called on the UI thread. | 125 // SyncService delegates to SyncPrefs, which must be called on the UI thread. |
| 126 if (history_service_ && | 126 if (history_service_ && !sync_service_->IsLocalSyncEnabled() && |
| 127 sync_service_->GetActiveDataTypes().Has(syncer::SESSIONS) && | 127 sync_service_->GetActiveDataTypes().Has(syncer::SESSIONS) && |
| 128 !sync_service_->GetEncryptedDataTypes().Has(syncer::SESSIONS)) | 128 !sync_service_->GetEncryptedDataTypes().Has(syncer::SESSIONS)) { |
| 129 return AllowedType::ALLOWED; | 129 return AllowedType::ALLOWED; |
| 130 } |
| 130 | 131 |
| 131 return AllowedType::DISALLOWED; | 132 return AllowedType::DISALLOWED; |
| 132 } | 133 } |
| 133 | 134 |
| 134 void PrecacheManager::OnCacheBackendReceived(int net_error_code) { | 135 void PrecacheManager::OnCacheBackendReceived(int net_error_code) { |
| 135 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 136 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 136 if (net_error_code != net::OK) { | 137 if (net_error_code != net::OK) { |
| 137 // Assume there is no cache. | 138 // Assume there is no cache. |
| 138 cache_backend_ = nullptr; | 139 cache_backend_ = nullptr; |
| 139 OnCacheSizeReceived(0); | 140 OnCacheSizeReceived(0); |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 this)); | 482 this)); |
| 482 precache_fetcher_->Start(); | 483 precache_fetcher_->Start(); |
| 483 } | 484 } |
| 484 | 485 |
| 485 void PrecacheManager::OnHostsReceivedThenDone( | 486 void PrecacheManager::OnHostsReceivedThenDone( |
| 486 const history::TopHostsList& host_counts) { | 487 const history::TopHostsList& host_counts) { |
| 487 OnDone(); | 488 OnDone(); |
| 488 } | 489 } |
| 489 | 490 |
| 490 } // namespace precache | 491 } // namespace precache |
| OLD | NEW |