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/offline_pages/background/offliner_factory.h" |
| 11 #include "components/offline_pages/background/offliner_policy.h" |
| 12 #include "components/offline_pages/background/request_coordinator.h" |
| 13 |
| 14 namespace offline_pages { |
| 15 |
| 16 RequestCoordinatorFactory::RequestCoordinatorFactory() |
| 17 : BrowserContextKeyedServiceFactory( |
| 18 "OfflineRequestCoordinator", |
| 19 BrowserContextDependencyManager::GetInstance()) { |
| 20 } |
| 21 |
| 22 // static |
| 23 RequestCoordinatorFactory* RequestCoordinatorFactory::GetInstance() { |
| 24 return base::Singleton<RequestCoordinatorFactory>::get(); |
| 25 } |
| 26 |
| 27 // static |
| 28 RequestCoordinator* RequestCoordinatorFactory::GetForBrowserContext( |
| 29 content::BrowserContext* context) { |
| 30 return static_cast<RequestCoordinator*>( |
| 31 GetInstance()->GetServiceForBrowserContext(context, true)); |
| 32 } |
| 33 |
| 34 KeyedService* RequestCoordinatorFactory::BuildServiceInstanceFor( |
| 35 content::BrowserContext* context) const { |
| 36 OfflinerPolicy* policy = new OfflinerPolicy(); |
| 37 OfflinerFactory* prerendererOffliner = |
| 38 new PrerenderingOfflinerFactory(context); |
| 39 // TODO(petewil) Add support for server based offliner when it is ready. |
| 40 |
| 41 return new RequestCoordinator(policy, prerendererOffliner); |
| 42 } |
| 43 |
| 44 content::BrowserContext* RequestCoordinatorFactory::GetBrowserContextToUse( |
| 45 content::BrowserContext* context) const { |
| 46 // TODO(petewil): Implement. |
| 47 return nullptr; |
| 48 } |
| 49 |
| 50 } // namespace offline_pages |
OLD | NEW |