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

Side by Side Diff: chrome/browser/android/offline_pages/evaluation/offline_page_evaluation_bridge.cc

Issue 2609713002: [Offline pages] Completely remove offliner factory. (Closed)
Patch Set: add TODO Created 3 years, 11 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
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/evaluation/offline_page_evaluatio n_bridge.h" 5 #include "chrome/browser/android/offline_pages/evaluation/offline_page_evaluatio n_bridge.h"
6 6
7 #include "base/android/callback_android.h" 7 #include "base/android/callback_android.h"
8 #include "base/android/jni_android.h" 8 #include "base/android/jni_android.h"
9 #include "base/android/jni_array.h" 9 #include "base/android/jni_array.h"
10 #include "base/android/jni_string.h" 10 #include "base/android/jni_string.h"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/sequenced_task_runner.h" 12 #include "base/sequenced_task_runner.h"
13 #include "chrome/browser/android/offline_pages/background_scheduler_bridge.h" 13 #include "chrome/browser/android/offline_pages/background_scheduler_bridge.h"
14 #include "chrome/browser/android/offline_pages/downloads/offline_page_notificati on_bridge.h" 14 #include "chrome/browser/android/offline_pages/downloads/offline_page_notificati on_bridge.h"
15 #include "chrome/browser/android/offline_pages/evaluation/evaluation_test_schedu ler.h" 15 #include "chrome/browser/android/offline_pages/evaluation/evaluation_test_schedu ler.h"
16 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h" 16 #include "chrome/browser/android/offline_pages/offline_page_model_factory.h"
17 #include "chrome/browser/android/offline_pages/prerendering_offliner_factory.h" 17 #include "chrome/browser/android/offline_pages/prerendering_offliner.h"
18 #include "chrome/browser/android/offline_pages/request_coordinator_factory.h" 18 #include "chrome/browser/android/offline_pages/request_coordinator_factory.h"
19 #include "chrome/browser/net/nqe/ui_network_quality_estimator_service.h" 19 #include "chrome/browser/net/nqe/ui_network_quality_estimator_service.h"
20 #include "chrome/browser/net/nqe/ui_network_quality_estimator_service_factory.h" 20 #include "chrome/browser/net/nqe/ui_network_quality_estimator_service_factory.h"
21 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
22 #include "chrome/browser/profiles/profile_android.h" 22 #include "chrome/browser/profiles/profile_android.h"
23 #include "chrome/common/chrome_constants.h" 23 #include "chrome/common/chrome_constants.h"
24 #include "components/offline_pages/core/background/offliner_factory.h" 24 #include "components/offline_pages/core/background/offliner.h"
25 #include "components/offline_pages/core/background/offliner_policy.h" 25 #include "components/offline_pages/core/background/offliner_policy.h"
26 #include "components/offline_pages/core/background/request_coordinator.h" 26 #include "components/offline_pages/core/background/request_coordinator.h"
27 #include "components/offline_pages/core/background/request_notifier.h" 27 #include "components/offline_pages/core/background/request_notifier.h"
28 #include "components/offline_pages/core/background/request_queue.h" 28 #include "components/offline_pages/core/background/request_queue.h"
29 #include "components/offline_pages/core/background/request_queue_store.h" 29 #include "components/offline_pages/core/background/request_queue_store.h"
30 #include "components/offline_pages/core/background/request_queue_store_sql.h" 30 #include "components/offline_pages/core/background/request_queue_store_sql.h"
31 #include "components/offline_pages/core/background/save_page_request.h" 31 #include "components/offline_pages/core/background/save_page_request.h"
32 #include "components/offline_pages/core/downloads/download_notifying_observer.h" 32 #include "components/offline_pages/core/downloads/download_notifying_observer.h"
33 #include "components/offline_pages/core/offline_page_item.h" 33 #include "components/offline_pages/core/offline_page_item.h"
34 #include "components/offline_pages/core/offline_page_model.h" 34 #include "components/offline_pages/core/offline_page_model.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 // static 159 // static
160 bool OfflinePageEvaluationBridge::Register(JNIEnv* env) { 160 bool OfflinePageEvaluationBridge::Register(JNIEnv* env) {
161 return RegisterNativesImpl(env); 161 return RegisterNativesImpl(env);
162 } 162 }
163 163
164 // static 164 // static
165 std::unique_ptr<KeyedService> 165 std::unique_ptr<KeyedService>
166 OfflinePageEvaluationBridge::GetTestingRequestCoordinator( 166 OfflinePageEvaluationBridge::GetTestingRequestCoordinator(
167 content::BrowserContext* context) { 167 content::BrowserContext* context) {
168 std::unique_ptr<OfflinerPolicy> policy(new OfflinerPolicy()); 168 std::unique_ptr<OfflinerPolicy> policy(new OfflinerPolicy());
169 std::unique_ptr<OfflinerFactory> prerenderer_offliner( 169 std::unique_ptr<Offliner> prerenderer_offliner(new PrerenderingOffliner(
170 new PrerenderingOfflinerFactory(context)); 170 context, policy.get(),
171 OfflinePageModelFactory::GetForBrowserContext(context)));
171 172
172 scoped_refptr<base::SequencedTaskRunner> background_task_runner = 173 scoped_refptr<base::SequencedTaskRunner> background_task_runner =
173 content::BrowserThread::GetBlockingPool()->GetSequencedTaskRunner( 174 content::BrowserThread::GetBlockingPool()->GetSequencedTaskRunner(
174 content::BrowserThread::GetBlockingPool()->GetSequenceToken()); 175 content::BrowserThread::GetBlockingPool()->GetSequenceToken());
175 Profile* profile = Profile::FromBrowserContext(context); 176 Profile* profile = Profile::FromBrowserContext(context);
176 base::FilePath queue_store_path = 177 base::FilePath queue_store_path =
177 profile->GetPath().Append(chrome::kOfflinePageRequestQueueDirname); 178 profile->GetPath().Append(chrome::kOfflinePageRequestQueueDirname);
178 179
179 std::unique_ptr<RequestQueueStoreSQL> queue_store( 180 std::unique_ptr<RequestQueueStoreSQL> queue_store(
180 new RequestQueueStoreSQL(background_task_runner, queue_store_path)); 181 new RequestQueueStoreSQL(background_task_runner, queue_store_path));
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 340
340 void OfflinePageEvaluationBridge::NotifyIfDoneLoading() const { 341 void OfflinePageEvaluationBridge::NotifyIfDoneLoading() const {
341 if (!offline_page_model_->is_loaded()) 342 if (!offline_page_model_->is_loaded())
342 return; 343 return;
343 JNIEnv* env = base::android::AttachCurrentThread(); 344 JNIEnv* env = base::android::AttachCurrentThread();
344 Java_OfflinePageEvaluationBridge_offlinePageModelLoaded(env, java_ref_); 345 Java_OfflinePageEvaluationBridge_offlinePageModelLoaded(env, java_ref_);
345 } 346 }
346 347
347 } // namespace android 348 } // namespace android
348 } // namespace offline_pages 349 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698