OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/android/offline_pages/request_coordinator_factory.h" | 5 #include "chrome/browser/android/offline_pages/request_coordinator_factory.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
10 #include "chrome/browser/android/offline_pages/background_scheduler_bridge.h" | 10 #include "chrome/browser/android/offline_pages/background_scheduler_bridge.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 } | 38 } |
39 | 39 |
40 KeyedService* RequestCoordinatorFactory::BuildServiceInstanceFor( | 40 KeyedService* RequestCoordinatorFactory::BuildServiceInstanceFor( |
41 content::BrowserContext* context) const { | 41 content::BrowserContext* context) const { |
42 std::unique_ptr<OfflinerPolicy> policy(new OfflinerPolicy()); | 42 std::unique_ptr<OfflinerPolicy> policy(new OfflinerPolicy()); |
43 std::unique_ptr<OfflinerFactory> prerenderer_offliner( | 43 std::unique_ptr<OfflinerFactory> prerenderer_offliner( |
44 new PrerenderingOfflinerFactory(context)); | 44 new PrerenderingOfflinerFactory(context)); |
45 std::unique_ptr<RequestQueueInMemoryStore> store( | 45 std::unique_ptr<RequestQueueInMemoryStore> store( |
46 new RequestQueueInMemoryStore()); | 46 new RequestQueueInMemoryStore()); |
47 std::unique_ptr<RequestQueue> queue(new RequestQueue(std::move(store))); | 47 std::unique_ptr<RequestQueue> queue(new RequestQueue(std::move(store))); |
48 // TODO(petewil) Add support for server based offliner when it is ready. | |
49 | |
50 std::unique_ptr<Scheduler> | 48 std::unique_ptr<Scheduler> |
51 scheduler(new android::BackgroundSchedulerBridge()); | 49 scheduler(new android::BackgroundSchedulerBridge()); |
52 // TODO(petewil) Add support for server based offliner when it is ready. | |
53 | 50 |
54 return new RequestCoordinator(std::move(policy), | 51 return new RequestCoordinator(std::move(policy), |
55 std::move(prerenderer_offliner), | 52 std::move(prerenderer_offliner), |
56 std::move(queue), | 53 std::move(queue), |
57 std::move(scheduler)); | 54 std::move(scheduler)); |
58 } | 55 } |
59 | 56 |
60 content::BrowserContext* RequestCoordinatorFactory::GetBrowserContextToUse( | 57 content::BrowserContext* RequestCoordinatorFactory::GetBrowserContextToUse( |
61 content::BrowserContext* context) const { | 58 content::BrowserContext* context) const { |
62 // TODO(petewil): Make sure we support incognito properly. | 59 // TODO(petewil): Make sure we support incognito properly. |
63 return context; | 60 return context; |
64 } | 61 } |
65 | 62 |
66 } // namespace offline_pages | 63 } // namespace offline_pages |
OLD | NEW |