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/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 KeyedService* RequestCoordinatorFactory::BuildServiceInstanceFor( | 53 KeyedService* RequestCoordinatorFactory::BuildServiceInstanceFor( |
54 content::BrowserContext* context) const { | 54 content::BrowserContext* context) const { |
55 std::unique_ptr<OfflinerPolicy> policy(new OfflinerPolicy()); | 55 std::unique_ptr<OfflinerPolicy> policy(new OfflinerPolicy()); |
56 std::unique_ptr<Offliner> offliner; | 56 std::unique_ptr<Offliner> offliner; |
57 OfflinePageModel* model = | 57 OfflinePageModel* model = |
58 OfflinePageModelFactory::GetInstance()->GetForBrowserContext(context); | 58 OfflinePageModelFactory::GetInstance()->GetForBrowserContext(context); |
59 | 59 |
60 // Determines which offliner to use based on flag. | 60 // Determines which offliner to use based on flag. |
61 if (ShouldUseNewBackgroundLoader()) { | 61 if (ShouldUseNewBackgroundLoader()) { |
62 offliner.reset(new BackgroundLoaderOffliner(context, model)); | 62 offliner.reset(new BackgroundLoaderOffliner(context, policy.get(), model)); |
63 } else { | 63 } else { |
64 offliner.reset(new PrerenderingOffliner(context, model)); | 64 offliner.reset(new PrerenderingOffliner(context, policy.get(), model)); |
65 } | 65 } |
66 | 66 |
67 scoped_refptr<base::SequencedTaskRunner> background_task_runner = | 67 scoped_refptr<base::SequencedTaskRunner> background_task_runner = |
68 content::BrowserThread::GetBlockingPool()->GetSequencedTaskRunner( | 68 content::BrowserThread::GetBlockingPool()->GetSequencedTaskRunner( |
69 content::BrowserThread::GetBlockingPool()->GetSequenceToken()); | 69 content::BrowserThread::GetBlockingPool()->GetSequenceToken()); |
70 Profile* profile = Profile::FromBrowserContext(context); | 70 Profile* profile = Profile::FromBrowserContext(context); |
71 base::FilePath queue_store_path = | 71 base::FilePath queue_store_path = |
72 profile->GetPath().Append(chrome::kOfflinePageRequestQueueDirname); | 72 profile->GetPath().Append(chrome::kOfflinePageRequestQueueDirname); |
73 | 73 |
74 std::unique_ptr<RequestQueueStoreSQL> queue_store( | 74 std::unique_ptr<RequestQueueStoreSQL> queue_store( |
(...skipping 11 matching lines...) Expand all Loading... |
86 std::move(scheduler), network_quality_estimator); | 86 std::move(scheduler), network_quality_estimator); |
87 | 87 |
88 DownloadNotifyingObserver::CreateAndStartObserving( | 88 DownloadNotifyingObserver::CreateAndStartObserving( |
89 request_coordinator, | 89 request_coordinator, |
90 base::MakeUnique<android::OfflinePageNotificationBridge>()); | 90 base::MakeUnique<android::OfflinePageNotificationBridge>()); |
91 | 91 |
92 return request_coordinator; | 92 return request_coordinator; |
93 } | 93 } |
94 | 94 |
95 } // namespace offline_pages | 95 } // namespace offline_pages |
OLD | NEW |