Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: components/offline_pages/background/request_coordinator_factory.cc

Issue 1929223002: Add skeletons for the factories to create the request coordinator and (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Manual merge of changes in the base changelist. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 "components/offline_pages/background/request_coordinator_factory.h"
6
7 #include "base/memory/singleton.h"
8 #include "components/keyed_service/content/browser_context_dependency_manager.h"
9 #include "components/keyed_service/content/browser_context_dependency_manager.h"
10 #include "components/offline_pages/background/offliner_policy.h"
11 #include "components/offline_pages/background/prerenderer_offliner_factory.h"
12 #include "components/offline_pages/background/request_coordinator.h"
13
14 namespace offline_pages {
15
16 RequestCoordinatorFactory::RequestCoordinatorFactory()
17 : BrowserContextKeyedServiceFactory(
18 "RequestCoordinator",
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 = new PrerendererOfflinerFactory();
fgorski 2016/04/29 04:16:46 because I am not sure about having this one in com
38 // TODO(petewil) When we add another prerenderer type for the server, expand
39 // the prerender argument into an array, and add a size counter.
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698