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" | |
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", | |
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) 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
| |
41 // the prerender argument into an array, and add a size counter. | |
42 | |
43 return new RequestCoordinator(policy, prerendererOffliner); | |
44 } | |
45 | |
46 content::BrowserContext* RequestCoordinatorFactory::GetBrowserContextToUse( | |
47 content::BrowserContext* context) const { | |
48 // TODO(petewil): Implement. | |
49 return nullptr; | |
50 } | |
51 | |
52 } // namespace offline_pages | |
OLD | NEW |