| 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/downloads/offline_page_download_b
ridge.h" | 5 #include "chrome/browser/android/offline_pages/downloads/offline_page_download_b
ridge.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 RequestCoordinatorFactory::GetForBrowserContext(browser_context_); | 433 RequestCoordinatorFactory::GetForBrowserContext(browser_context_); |
| 434 | 434 |
| 435 if (coordinator) { | 435 if (coordinator) { |
| 436 coordinator->GetAllRequests( | 436 coordinator->GetAllRequests( |
| 437 base::Bind(&ResumeRequestsContinuation, browser_context_, guid)); | 437 base::Bind(&ResumeRequestsContinuation, browser_context_, guid)); |
| 438 } else { | 438 } else { |
| 439 LOG(WARNING) << "ResumeDownload has no valid coordinator."; | 439 LOG(WARNING) << "ResumeDownload has no valid coordinator."; |
| 440 } | 440 } |
| 441 } | 441 } |
| 442 | 442 |
| 443 void OfflinePageDownloadBridge::ResumePendingRequestImmediately( |
| 444 JNIEnv* env, |
| 445 const JavaParamRef<jobject>& obj) { |
| 446 RequestCoordinator* coordinator = |
| 447 RequestCoordinatorFactory::GetForBrowserContext(browser_context_); |
| 448 if (coordinator) |
| 449 coordinator->StartImmediateProcessing(base::Bind([](bool result) {})); |
| 450 else |
| 451 LOG(WARNING) << "ResumePendingRequestImmediately has no valid coordinator."; |
| 452 } |
| 453 |
| 443 void OfflinePageDownloadBridge::ItemsLoaded() { | 454 void OfflinePageDownloadBridge::ItemsLoaded() { |
| 444 JNIEnv* env = AttachCurrentThread(); | 455 JNIEnv* env = AttachCurrentThread(); |
| 445 ScopedJavaLocalRef<jobject> obj = weak_java_ref_.get(env); | 456 ScopedJavaLocalRef<jobject> obj = weak_java_ref_.get(env); |
| 446 if (obj.is_null()) | 457 if (obj.is_null()) |
| 447 return; | 458 return; |
| 448 Java_OfflinePageDownloadBridge_downloadItemsLoaded(env, obj); | 459 Java_OfflinePageDownloadBridge_downloadItemsLoaded(env, obj); |
| 449 } | 460 } |
| 450 | 461 |
| 451 void OfflinePageDownloadBridge::ItemAdded(const DownloadUIItem& item) { | 462 void OfflinePageDownloadBridge::ItemAdded(const DownloadUIItem& item) { |
| 452 JNIEnv* env = AttachCurrentThread(); | 463 JNIEnv* env = AttachCurrentThread(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 base::MakeUnique<DownloadUIAdapterDelegate>(offline_page_model)); | 508 base::MakeUnique<DownloadUIAdapterDelegate>(offline_page_model)); |
| 498 DownloadUIAdapter::AttachToOfflinePageModel(adapter, offline_page_model); | 509 DownloadUIAdapter::AttachToOfflinePageModel(adapter, offline_page_model); |
| 499 } | 510 } |
| 500 | 511 |
| 501 return reinterpret_cast<jlong>( | 512 return reinterpret_cast<jlong>( |
| 502 new OfflinePageDownloadBridge(env, obj, adapter, browser_context)); | 513 new OfflinePageDownloadBridge(env, obj, adapter, browser_context)); |
| 503 } | 514 } |
| 504 | 515 |
| 505 } // namespace android | 516 } // namespace android |
| 506 } // namespace offline_pages | 517 } // namespace offline_pages |
| OLD | NEW |