Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/android/offline_pages/request_coordinator_factory.h" | |
| 6 | |
| 7 #include "base/memory/singleton.h" | |
| 8 #include "chrome/browser/android/offline_pages/prerendering_offliner_factory.h" | |
| 9 #include "components/keyed_service/content/browser_context_dependency_manager.h" | |
| 10 #include "components/keyed_service/content/browser_context_dependency_manager.h" | |
|
dougarnett
2016/05/03 22:30:44
dupe
Pete Williamson
2016/05/04 00:39:21
Done.
| |
| 11 #include "components/offline_pages/background/offliner_factory.h" | |
| 12 #include "components/offline_pages/background/offliner_policy.h" | |
| 13 #include "components/offline_pages/background/request_coordinator.h" | |
| 14 | |
| 15 namespace offline_pages { | |
| 16 | |
| 17 RequestCoordinatorFactory::RequestCoordinatorFactory() | |
| 18 : BrowserContextKeyedServiceFactory( | |
| 19 "RequestCoordinator", | |
|
fgorski
2016/05/03 22:48:16
Can we include the offline in the name?
request is
Pete Williamson
2016/05/04 00:39:21
Done.
| |
| 20 BrowserContextDependencyManager::GetInstance()) { | |
| 21 } | |
| 22 | |
| 23 // static | |
| 24 RequestCoordinatorFactory* RequestCoordinatorFactory::GetInstance() { | |
| 25 return base::Singleton<RequestCoordinatorFactory>::get(); | |
| 26 } | |
| 27 | |
| 28 // static | |
| 29 RequestCoordinator* RequestCoordinatorFactory::GetForBrowserContext( | |
| 30 content::BrowserContext* context) { | |
| 31 return static_cast<RequestCoordinator*>( | |
| 32 GetInstance()->GetServiceForBrowserContext(context, true)); | |
| 33 } | |
| 34 | |
| 35 KeyedService* RequestCoordinatorFactory::BuildServiceInstanceFor( | |
| 36 content::BrowserContext* context) const { | |
| 37 OfflinerPolicy* policy = new OfflinerPolicy(); | |
| 38 OfflinerFactory* prerendererOffliner = | |
| 39 new PrerenderingOfflinerFactory(context); | |
| 40 // TODO(petewil) Add support for server based offliner when it is ready. | |
| 41 | |
| 42 return new RequestCoordinator(policy, prerendererOffliner); | |
| 43 } | |
| 44 | |
| 45 content::BrowserContext* RequestCoordinatorFactory::GetBrowserContextToUse( | |
| 46 content::BrowserContext* context) const { | |
| 47 // TODO(petewil): Implement. | |
| 48 return nullptr; | |
| 49 } | |
| 50 | |
| 51 } // namespace offline_pages | |
| OLD | NEW |