Chromium Code Reviews| Index: chrome/browser/android/offline_pages/prefetch_service_factory.cc |
| diff --git a/chrome/browser/android/offline_pages/prefetch_service_factory.cc b/chrome/browser/android/offline_pages/prefetch_service_factory.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..edb9af50bd12038ed46a31636a0a83fa7e0c5e2b |
| --- /dev/null |
| +++ b/chrome/browser/android/offline_pages/prefetch_service_factory.cc |
| @@ -0,0 +1,48 @@ |
| +// Copyright 2017 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/android/offline_pages/prefetch_service_factory.h" |
| + |
| +#include <utility> |
| + |
| +#include "base/files/file_path.h" |
| +#include "base/memory/singleton.h" |
| +#include "base/sequenced_task_runner.h" |
| +#include "base/threading/sequenced_worker_pool.h" |
| +#include "chrome/browser/profiles/incognito_helpers.h" |
| +#include "chrome/browser/profiles/profile.h" |
| +#include "chrome/common/chrome_constants.h" |
| +#include "components/keyed_service/content/browser_context_dependency_manager.h" |
| +#include "components/offline_pages/core/offline_page_metadata_store_sql.h" |
| +#include "components/offline_pages/core/prefetch/prefetch_service_impl.h" |
| +#include "content/public/browser/browser_thread.h" |
| + |
| +namespace offline_pages { |
| + |
| +PrefetchServiceFactory::PrefetchServiceFactory() |
| + : BrowserContextKeyedServiceFactory( |
| + "OfflinePagePrefetchService", |
| + BrowserContextDependencyManager::GetInstance()) {} |
| + |
| +// static |
| +PrefetchServiceFactory* PrefetchServiceFactory::GetInstance() { |
| + return base::Singleton<PrefetchServiceFactory>::get(); |
| +} |
| + |
| +// static |
| +PrefetchService* PrefetchServiceFactory::GetForBrowserContext( |
| + content::BrowserContext* context) { |
| + return static_cast<PrefetchService*>( |
| + GetInstance()->GetServiceForBrowserContext(context, true)); |
| +} |
| + |
| +KeyedService* PrefetchServiceFactory::BuildServiceInstanceFor( |
| + content::BrowserContext* context) const { |
| + scoped_refptr<base::SequencedTaskRunner> background_task_runner = |
|
Dmitry Titov
2017/04/11 01:17:13
this seems not used...
dewittj
2017/04/11 21:25:48
Done.
|
| + content::BrowserThread::GetBlockingPool()->GetSequencedTaskRunner( |
| + content::BrowserThread::GetBlockingPool()->GetSequenceToken()); |
| + return new PrefetchServiceImpl(); |
| +} |
| + |
| +} // namespace offline_pages |