| 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" |
| 11 #include "base/metrics/field_trial.h" | 11 #include "base/metrics/field_trial.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "components/precache/core/precache_database.h" | 13 #include "components/precache/core/precache_database.h" |
| 14 #include "components/precache/core/precache_switches.h" | 14 #include "components/precache/core/precache_switches.h" |
| 15 #include "components/precache/core/url_list_provider.h" | 15 #include "components/precache/core/url_list_provider.h" |
| 16 #include "content/public/browser/browser_context.h" | 16 #include "content/public/browser/browser_context.h" |
| 17 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
| 18 #include "net/base/network_change_notifier.h" | 18 #include "net/base/network_change_notifier.h" |
| 19 | 19 |
| 20 using content::BrowserThread; | 20 using content::BrowserThread; |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 const char kPrecacheFieldTrialName[] = "Precache"; | 24 const char kPrecacheFieldTrialName[] = "Precache"; |
| 25 const char kPrecacheFieldTrialEnabledGroup[] = "PrecacheEnabled"; | 25 const char kPrecacheFieldTrialEnabledGroup[] = "Enabled"; |
| 26 | 26 |
| 27 } // namespace | 27 } // namespace |
| 28 | 28 |
| 29 namespace precache { | 29 namespace precache { |
| 30 | 30 |
| 31 PrecacheManager::PrecacheManager(content::BrowserContext* browser_context) | 31 PrecacheManager::PrecacheManager(content::BrowserContext* browser_context) |
| 32 : browser_context_(browser_context), | 32 : browser_context_(browser_context), |
| 33 precache_database_(new PrecacheDatabase()), | 33 precache_database_(new PrecacheDatabase()), |
| 34 is_precaching_(false) { | 34 is_precaching_(false) { |
| 35 base::FilePath db_path(browser_context_->GetPath().Append( | 35 base::FilePath db_path(browser_context_->GetPath().Append( |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 return; | 154 return; |
| 155 } | 155 } |
| 156 | 156 |
| 157 // Start precaching. | 157 // Start precaching. |
| 158 precache_fetcher_.reset( | 158 precache_fetcher_.reset( |
| 159 new PrecacheFetcher(urls, browser_context_->GetRequestContext(), this)); | 159 new PrecacheFetcher(urls, browser_context_->GetRequestContext(), this)); |
| 160 precache_fetcher_->Start(); | 160 precache_fetcher_->Start(); |
| 161 } | 161 } |
| 162 | 162 |
| 163 } // namespace precache | 163 } // namespace precache |
| OLD | NEW |