| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/android/download_controller_android_impl.h" | 5 #include "content/browser/android/download_controller_android_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/android/context_utils.h" | 9 #include "base/android/context_utils.h" |
| 10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 | 444 |
| 445 switch (item->GetState()) { | 445 switch (item->GetState()) { |
| 446 case DownloadItem::IN_PROGRESS: { | 446 case DownloadItem::IN_PROGRESS: { |
| 447 base::TimeDelta time_delta; | 447 base::TimeDelta time_delta; |
| 448 item->TimeRemaining(&time_delta); | 448 item->TimeRemaining(&time_delta); |
| 449 Java_DownloadController_onDownloadUpdated( | 449 Java_DownloadController_onDownloadUpdated( |
| 450 env, GetJavaObject()->Controller(env).obj(), | 450 env, GetJavaObject()->Controller(env).obj(), |
| 451 base::android::GetApplicationContext(), jurl.obj(), jmime_type.obj(), | 451 base::android::GetApplicationContext(), jurl.obj(), jmime_type.obj(), |
| 452 jfilename.obj(), jpath.obj(), item->GetReceivedBytes(), true, | 452 jfilename.obj(), jpath.obj(), item->GetReceivedBytes(), true, |
| 453 item->GetId(), item->PercentComplete(), time_delta.InMilliseconds(), | 453 item->GetId(), item->PercentComplete(), time_delta.InMilliseconds(), |
| 454 item->HasUserGesture(), | 454 item->HasUserGesture(), item->IsPaused(), |
| 455 // Get all requirements that allows a download to be resumable. | 455 // Get all requirements that allows a download to be resumable. |
| 456 !item->GetBrowserContext()->IsOffTheRecord()); | 456 !item->GetBrowserContext()->IsOffTheRecord()); |
| 457 break; | 457 break; |
| 458 } | 458 } |
| 459 case DownloadItem::COMPLETE: | 459 case DownloadItem::COMPLETE: |
| 460 // Multiple OnDownloadUpdated() notifications may be issued while the | 460 // Multiple OnDownloadUpdated() notifications may be issued while the |
| 461 // download is in the COMPLETE state. Only handle one. | 461 // download is in the COMPLETE state. Only handle one. |
| 462 item->RemoveObserver(this); | 462 item->RemoveObserver(this); |
| 463 | 463 |
| 464 // Call onDownloadCompleted | 464 // Call onDownloadCompleted |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 } | 569 } |
| 570 | 570 |
| 571 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); | 571 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); |
| 572 if (info) | 572 if (info) |
| 573 has_user_gesture = info->HasUserGesture(); | 573 has_user_gesture = info->HasUserGesture(); |
| 574 } | 574 } |
| 575 | 575 |
| 576 DownloadControllerAndroidImpl::DownloadInfoAndroid::~DownloadInfoAndroid() {} | 576 DownloadControllerAndroidImpl::DownloadInfoAndroid::~DownloadInfoAndroid() {} |
| 577 | 577 |
| 578 } // namespace content | 578 } // namespace content |
| OLD | NEW |