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) { | |
fgorski
2017/03/03 17:44:37
nit: braces not needed.
romax
2017/03/03 18:53:17
Done.
| |
449 coordinator->StartImmediateProcessing(base::Bind([](bool result) {})); | |
450 } else { | |
451 LOG(WARNING) << "ResumePendingRequestImmediately has no valid coordinator."; | |
452 } | |
453 } | |
454 | |
443 void OfflinePageDownloadBridge::ItemsLoaded() { | 455 void OfflinePageDownloadBridge::ItemsLoaded() { |
444 JNIEnv* env = AttachCurrentThread(); | 456 JNIEnv* env = AttachCurrentThread(); |
445 ScopedJavaLocalRef<jobject> obj = weak_java_ref_.get(env); | 457 ScopedJavaLocalRef<jobject> obj = weak_java_ref_.get(env); |
446 if (obj.is_null()) | 458 if (obj.is_null()) |
447 return; | 459 return; |
448 Java_OfflinePageDownloadBridge_downloadItemsLoaded(env, obj); | 460 Java_OfflinePageDownloadBridge_downloadItemsLoaded(env, obj); |
449 } | 461 } |
450 | 462 |
451 void OfflinePageDownloadBridge::ItemAdded(const DownloadUIItem& item) { | 463 void OfflinePageDownloadBridge::ItemAdded(const DownloadUIItem& item) { |
452 JNIEnv* env = AttachCurrentThread(); | 464 JNIEnv* env = AttachCurrentThread(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
497 base::MakeUnique<DownloadUIAdapterDelegate>(offline_page_model)); | 509 base::MakeUnique<DownloadUIAdapterDelegate>(offline_page_model)); |
498 DownloadUIAdapter::AttachToOfflinePageModel(adapter, offline_page_model); | 510 DownloadUIAdapter::AttachToOfflinePageModel(adapter, offline_page_model); |
499 } | 511 } |
500 | 512 |
501 return reinterpret_cast<jlong>( | 513 return reinterpret_cast<jlong>( |
502 new OfflinePageDownloadBridge(env, obj, adapter, browser_context)); | 514 new OfflinePageDownloadBridge(env, obj, adapter, browser_context)); |
503 } | 515 } |
504 | 516 |
505 } // namespace android | 517 } // namespace android |
506 } // namespace offline_pages | 518 } // namespace offline_pages |
OLD | NEW |