Chromium Code Reviews| Index: components/offline_pages/background/request_coordinator_factory.cc |
| diff --git a/components/offline_pages/background/request_coordinator_factory.cc b/components/offline_pages/background/request_coordinator_factory.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..2b0a0f269ed8f617d5b8bf62a990bac47044d6df |
| --- /dev/null |
| +++ b/components/offline_pages/background/request_coordinator_factory.cc |
| @@ -0,0 +1,50 @@ |
| +// 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 "components/offline_pages/background/request_coordinator_factory.h" |
| + |
| +#include "base/memory/singleton.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_policy.h" |
| +#include "components/offline_pages/background/prerenderer_offliner_factory.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 PrerendererOfflinerFactory(); |
|
fgorski
2016/04/29 04:16:46
because I am not sure about having this one in com
|
| + // TODO(petewil) When we add another prerenderer type for the server, expand |
| + // 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 |