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

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

Issue 2624523003: [Offline Pages] Remove need for OfflinePolicy when constructing an Offliner. (Closed)
Patch Set: 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"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
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<Offliner> prerenderer_offliner(new PrerenderingOffliner( 169 std::unique_ptr<Offliner> prerenderer_offliner(new PrerenderingOffliner(
170 context, policy.get(), 170 context, OfflinePageModelFactory::GetForBrowserContext(context)));
171 OfflinePageModelFactory::GetForBrowserContext(context)));
172 171
173 scoped_refptr<base::SequencedTaskRunner> background_task_runner = 172 scoped_refptr<base::SequencedTaskRunner> background_task_runner =
174 content::BrowserThread::GetBlockingPool()->GetSequencedTaskRunner( 173 content::BrowserThread::GetBlockingPool()->GetSequencedTaskRunner(
175 content::BrowserThread::GetBlockingPool()->GetSequenceToken()); 174 content::BrowserThread::GetBlockingPool()->GetSequenceToken());
176 Profile* profile = Profile::FromBrowserContext(context); 175 Profile* profile = Profile::FromBrowserContext(context);
177 base::FilePath queue_store_path = 176 base::FilePath queue_store_path =
178 profile->GetPath().Append(chrome::kOfflinePageRequestQueueDirname); 177 profile->GetPath().Append(chrome::kOfflinePageRequestQueueDirname);
179 178
180 std::unique_ptr<RequestQueueStoreSQL> queue_store( 179 std::unique_ptr<RequestQueueStoreSQL> queue_store(
181 new RequestQueueStoreSQL(background_task_runner, queue_store_path)); 180 new RequestQueueStoreSQL(background_task_runner, queue_store_path));
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 339
341 void OfflinePageEvaluationBridge::NotifyIfDoneLoading() const { 340 void OfflinePageEvaluationBridge::NotifyIfDoneLoading() const {
342 if (!offline_page_model_->is_loaded()) 341 if (!offline_page_model_->is_loaded())
343 return; 342 return;
344 JNIEnv* env = base::android::AttachCurrentThread(); 343 JNIEnv* env = base::android::AttachCurrentThread();
345 Java_OfflinePageEvaluationBridge_offlinePageModelLoaded(env, java_ref_); 344 Java_OfflinePageEvaluationBridge_offlinePageModelLoaded(env, java_ref_);
346 } 345 }
347 346
348 } // namespace android 347 } // namespace android
349 } // namespace offline_pages 348 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698