Chromium Code Reviews| 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 167 OfflinePageModelFactory::GetForBrowserContext(context))); | 167 OfflinePageModelFactory::GetForBrowserContext(context))); |
| 168 return GetTestingRequestCoordinator(context, std::move(policy), | 168 return GetTestingRequestCoordinator(context, std::move(policy), |
| 169 std::move(offliner)); | 169 std::move(offliner)); |
| 170 } | 170 } |
| 171 | 171 |
| 172 std::unique_ptr<KeyedService> GetTestBackgroundLoaderRequestCoordinator( | 172 std::unique_ptr<KeyedService> GetTestBackgroundLoaderRequestCoordinator( |
| 173 content::BrowserContext* context) { | 173 content::BrowserContext* context) { |
| 174 std::unique_ptr<OfflinerPolicy> policy(new OfflinerPolicy()); | 174 std::unique_ptr<OfflinerPolicy> policy(new OfflinerPolicy()); |
| 175 std::unique_ptr<Offliner> offliner(new BackgroundLoaderOffliner( | 175 std::unique_ptr<Offliner> offliner(new BackgroundLoaderOffliner( |
| 176 context, policy.get(), | 176 context, policy.get(), |
| 177 OfflinePageModelFactory::GetForBrowserContext(context))); | 177 OfflinePageModelFactory::GetForBrowserContext(context), |
| 178 nullptr)); // no need to connect LoadTerminatorListener for harness. | |
|
dewittj
2017/05/24 23:24:39
nit: LoadTerminationListener
Dmitry Titov
2017/05/25 23:24:12
Done in followup CL
| |
| 178 return GetTestingRequestCoordinator(context, std::move(policy), | 179 return GetTestingRequestCoordinator(context, std::move(policy), |
| 179 std::move(offliner)); | 180 std::move(offliner)); |
| 180 } | 181 } |
| 181 | 182 |
| 182 RequestCoordinator* GetRequestCoordinator(Profile* profile, | 183 RequestCoordinator* GetRequestCoordinator(Profile* profile, |
| 183 bool use_evaluation_scheduler, | 184 bool use_evaluation_scheduler, |
| 184 bool use_background_loader) { | 185 bool use_background_loader) { |
| 185 if (!use_evaluation_scheduler) { | 186 if (!use_evaluation_scheduler) { |
| 186 return RequestCoordinatorFactory::GetForBrowserContext(profile); | 187 return RequestCoordinatorFactory::GetForBrowserContext(profile); |
| 187 } | 188 } |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 382 return; | 383 return; |
| 383 JNIEnv* env = base::android::AttachCurrentThread(); | 384 JNIEnv* env = base::android::AttachCurrentThread(); |
| 384 ScopedJavaLocalRef<jobject> obj = weak_java_ref_.get(env); | 385 ScopedJavaLocalRef<jobject> obj = weak_java_ref_.get(env); |
| 385 if (obj.is_null()) | 386 if (obj.is_null()) |
| 386 return; | 387 return; |
| 387 Java_OfflinePageEvaluationBridge_offlinePageModelLoaded(env, obj); | 388 Java_OfflinePageEvaluationBridge_offlinePageModelLoaded(env, obj); |
| 388 } | 389 } |
| 389 | 390 |
| 390 } // namespace android | 391 } // namespace android |
| 391 } // namespace offline_pages | 392 } // namespace offline_pages |
| OLD | NEW |