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

Side by Side Diff: chrome/browser/android/offline_pages/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: Attempt gypi file fix. 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 "chrome/browser/android/offline_pages/request_coordinator_factory.h"
6
7 #include <memory>
8
9 #include "base/memory/singleton.h"
10 #include "chrome/browser/android/offline_pages/prerendering_offliner_factory.h"
11 #include "components/keyed_service/content/browser_context_dependency_manager.h"
12 #include "components/offline_pages/background/offliner_factory.h"
13 #include "components/offline_pages/background/offliner_policy.h"
14 #include "components/offline_pages/background/request_coordinator.h"
15
16 namespace offline_pages {
17
18 RequestCoordinatorFactory::RequestCoordinatorFactory()
19 : BrowserContextKeyedServiceFactory(
20 "OfflineRequestCoordinator",
21 BrowserContextDependencyManager::GetInstance()) {}
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 std::unique_ptr<OfflinerPolicy> policy(new OfflinerPolicy());
38 std::unique_ptr<OfflinerFactory> prerendererOffliner(
39 new PrerenderingOfflinerFactory(context));
40 // TODO(petewil) Add support for server based offliner when it is ready.
41
42 return new RequestCoordinator(std::move(policy),
43 std::move(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698