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/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 Loading... |
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, OfflinePageModelFactory::GetForBrowserContext(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 Loading... |
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 |
OLD | NEW |