| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 base::Bind(base::IgnoreResult(&PrecacheDatabase::Init), | 43 base::Bind(base::IgnoreResult(&PrecacheDatabase::Init), |
| 44 precache_database_, db_path)); | 44 precache_database_, db_path)); |
| 45 } | 45 } |
| 46 | 46 |
| 47 PrecacheManager::~PrecacheManager() {} | 47 PrecacheManager::~PrecacheManager() {} |
| 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 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 54 switches::kEnablePrecache); |
| 54 } | 55 } |
| 55 | 56 |
| 56 bool PrecacheManager::IsPrecachingAllowed() { | 57 bool PrecacheManager::IsPrecachingAllowed() { |
| 57 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 58 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 58 return user_prefs::UserPrefs::Get(browser_context_)->GetBoolean( | 59 return user_prefs::UserPrefs::Get(browser_context_)->GetBoolean( |
| 59 data_reduction_proxy::prefs::kDataReductionProxyEnabled); | 60 data_reduction_proxy::prefs::kDataReductionProxyEnabled); |
| 60 } | 61 } |
| 61 | 62 |
| 62 void PrecacheManager::StartPrecaching( | 63 void PrecacheManager::StartPrecaching( |
| 63 const PrecacheCompletionCallback& precache_completion_callback, | 64 const PrecacheCompletionCallback& precache_completion_callback, |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 return; | 164 return; |
| 164 } | 165 } |
| 165 | 166 |
| 166 // Start precaching. | 167 // Start precaching. |
| 167 precache_fetcher_.reset( | 168 precache_fetcher_.reset( |
| 168 new PrecacheFetcher(urls, browser_context_->GetRequestContext(), this)); | 169 new PrecacheFetcher(urls, browser_context_->GetRequestContext(), this)); |
| 169 precache_fetcher_->Start(); | 170 precache_fetcher_->Start(); |
| 170 } | 171 } |
| 171 | 172 |
| 172 } // namespace precache | 173 } // namespace precache |
| OLD | NEW |