Chromium Code Reviews| Index: chrome/browser/android/offline_pages/request_coordinator_factory.cc |
| diff --git a/chrome/browser/android/offline_pages/request_coordinator_factory.cc b/chrome/browser/android/offline_pages/request_coordinator_factory.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e89318f7871aae8e9ade25c6be34f4a2e35faa02 |
| --- /dev/null |
| +++ b/chrome/browser/android/offline_pages/request_coordinator_factory.cc |
| @@ -0,0 +1,52 @@ |
| +// Copyright 2016 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/request_coordinator_factory.h" |
| + |
| +#include "base/memory/singleton.h" |
| +#include "chrome/browser/android/offline_pages/prerendering_offliner_factory.h" |
| +#include "components/keyed_service/content/browser_context_dependency_manager.h" |
| +#include "components/keyed_service/content/browser_context_dependency_manager.h" |
| +#include "components/offline_pages/background/offliner_factory.h" |
| +#include "components/offline_pages/background/offliner_policy.h" |
| +#include "components/offline_pages/background/request_coordinator.h" |
| + |
| +namespace offline_pages { |
| + |
| +RequestCoordinatorFactory::RequestCoordinatorFactory() |
| + : BrowserContextKeyedServiceFactory( |
| + "RequestCoordinator", |
| + BrowserContextDependencyManager::GetInstance()) { |
| +} |
| + |
| +// static |
| +RequestCoordinatorFactory* RequestCoordinatorFactory::GetInstance() { |
| + return base::Singleton<RequestCoordinatorFactory>::get(); |
| +} |
| + |
| +// static |
| +RequestCoordinator* RequestCoordinatorFactory::GetForBrowserContext( |
| + content::BrowserContext* context) { |
| + return static_cast<RequestCoordinator*>( |
| + GetInstance()->GetServiceForBrowserContext(context, true)); |
| +} |
| + |
| +KeyedService* RequestCoordinatorFactory::BuildServiceInstanceFor( |
| + content::BrowserContext* context) const { |
| + OfflinerPolicy* policy = new OfflinerPolicy(); |
| + OfflinerFactory* prerendererOffliner = |
| + new PrerenderingOfflinerFactory(context); |
| + // TODO(petewil) When we add another prerenderer type for the server, expand |
|
dougarnett
2016/05/03 18:32:40
might just say: Add support for multiple offliner
|
| + // the prerender argument into an array, and add a size counter. |
| + |
| + return new RequestCoordinator(policy, prerendererOffliner); |
| +} |
| + |
| +content::BrowserContext* RequestCoordinatorFactory::GetBrowserContextToUse( |
| + content::BrowserContext* context) const { |
| + // TODO(petewil): Implement. |
| + return nullptr; |
| +} |
| + |
| +} // namespace offline_pages |