| 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 // static | 49 // static |
| 50 bool PrecacheManager::IsPrecachingEnabled() { | 50 bool PrecacheManager::IsPrecachingEnabled() { |
| 51 return base::FieldTrialList::FindFullName(kPrecacheFieldTrialName) == | 51 return base::FieldTrialList::FindFullName(kPrecacheFieldTrialName) == |
| 52 kPrecacheFieldTrialEnabledGroup || | 52 kPrecacheFieldTrialEnabledGroup || |
| 53 CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnablePrecache); | 53 CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnablePrecache); |
| 54 } | 54 } |
| 55 | 55 |
| 56 bool PrecacheManager::IsPrecachingAllowed() { | 56 bool PrecacheManager::IsPrecachingAllowed() { |
| 57 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 57 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 58 #if defined(SPDY_PROXY_AUTH_ORIGIN) | |
| 59 return user_prefs::UserPrefs::Get(browser_context_)->GetBoolean( | 58 return user_prefs::UserPrefs::Get(browser_context_)->GetBoolean( |
| 60 data_reduction_proxy::prefs::kDataReductionProxyEnabled); | 59 data_reduction_proxy::prefs::kDataReductionProxyEnabled); |
| 61 #else | |
| 62 return false; | |
| 63 #endif | |
| 64 } | 60 } |
| 65 | 61 |
| 66 void PrecacheManager::StartPrecaching( | 62 void PrecacheManager::StartPrecaching( |
| 67 const PrecacheCompletionCallback& precache_completion_callback, | 63 const PrecacheCompletionCallback& precache_completion_callback, |
| 68 URLListProvider* url_list_provider) { | 64 URLListProvider* url_list_provider) { |
| 69 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 65 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 70 | 66 |
| 71 if (is_precaching_) { | 67 if (is_precaching_) { |
| 72 DLOG(WARNING) << "Cannot start precaching because precaching is already " | 68 DLOG(WARNING) << "Cannot start precaching because precaching is already " |
| 73 "in progress."; | 69 "in progress."; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 return; | 163 return; |
| 168 } | 164 } |
| 169 | 165 |
| 170 // Start precaching. | 166 // Start precaching. |
| 171 precache_fetcher_.reset( | 167 precache_fetcher_.reset( |
| 172 new PrecacheFetcher(urls, browser_context_->GetRequestContext(), this)); | 168 new PrecacheFetcher(urls, browser_context_->GetRequestContext(), this)); |
| 173 precache_fetcher_->Start(); | 169 precache_fetcher_->Start(); |
| 174 } | 170 } |
| 175 | 171 |
| 176 } // namespace precache | 172 } // namespace precache |
| OLD | NEW |