Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(484)

Side by Side Diff: content/browser/android/download_controller_android_impl.cc

Issue 1993873003: deprecate notificationId for downloads (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/android/context_utils.h" 10 #include "base/android/context_utils.h"
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 ScopedJavaLocalRef<jstring> jreferrer_url = 470 ScopedJavaLocalRef<jstring> jreferrer_url =
471 ConvertUTF8ToJavaString(env, item->GetReferrerUrl().spec()); 471 ConvertUTF8ToJavaString(env, item->GetReferrerUrl().spec());
472 472
473 switch (item->GetState()) { 473 switch (item->GetState()) {
474 case DownloadItem::IN_PROGRESS: { 474 case DownloadItem::IN_PROGRESS: {
475 base::TimeDelta time_delta; 475 base::TimeDelta time_delta;
476 item->TimeRemaining(&time_delta); 476 item->TimeRemaining(&time_delta);
477 Java_DownloadController_onDownloadUpdated( 477 Java_DownloadController_onDownloadUpdated(
478 env, GetJavaObject()->Controller(env).obj(), jurl.obj(), 478 env, GetJavaObject()->Controller(env).obj(), jurl.obj(),
479 jmime_type.obj(), jfilename.obj(), jpath.obj(), 479 jmime_type.obj(), jfilename.obj(), jpath.obj(),
480 item->GetReceivedBytes(), item->GetId(), jguid.obj(), 480 item->GetReceivedBytes(), jguid.obj(),
481 item->PercentComplete(), time_delta.InMilliseconds(), 481 item->PercentComplete(), time_delta.InMilliseconds(),
482 item->HasUserGesture(), item->IsPaused(), 482 item->HasUserGesture(), item->IsPaused(),
483 item->GetBrowserContext()->IsOffTheRecord()); 483 item->GetBrowserContext()->IsOffTheRecord());
484 break; 484 break;
485 } 485 }
486 case DownloadItem::COMPLETE: 486 case DownloadItem::COMPLETE:
487 // Multiple OnDownloadUpdated() notifications may be issued while the 487 // Multiple OnDownloadUpdated() notifications may be issued while the
488 // download is in the COMPLETE state. Only handle one. 488 // download is in the COMPLETE state. Only handle one.
489 item->RemoveObserver(this); 489 item->RemoveObserver(this);
490 490
491 // Call onDownloadCompleted 491 // Call onDownloadCompleted
492 Java_DownloadController_onDownloadCompleted( 492 Java_DownloadController_onDownloadCompleted(
493 env, GetJavaObject()->Controller(env).obj(), jurl.obj(), 493 env, GetJavaObject()->Controller(env).obj(), jurl.obj(),
494 jmime_type.obj(), jfilename.obj(), jpath.obj(), 494 jmime_type.obj(), jfilename.obj(), jpath.obj(),
495 item->GetReceivedBytes(), item->GetId(), jguid.obj(), 495 item->GetReceivedBytes(), jguid.obj(),
496 joriginal_url.obj(), jreferrer_url.obj(), item->HasUserGesture()); 496 joriginal_url.obj(), jreferrer_url.obj(), item->HasUserGesture());
497 break; 497 break;
498 case DownloadItem::CANCELLED: 498 case DownloadItem::CANCELLED:
499 Java_DownloadController_onDownloadCancelled( 499 Java_DownloadController_onDownloadCancelled(
500 env, GetJavaObject()->Controller(env).obj(), item->GetId(), 500 env, GetJavaObject()->Controller(env).obj(), jguid.obj());
501 jguid.obj());
502 break; 501 break;
503 case DownloadItem::INTERRUPTED: 502 case DownloadItem::INTERRUPTED:
504 // When device loses/changes network, we get a NETWORK_TIMEOUT, 503 // When device loses/changes network, we get a NETWORK_TIMEOUT,
505 // NETWORK_FAILED or NETWORK_DISCONNECTED error. Download should auto 504 // NETWORK_FAILED or NETWORK_DISCONNECTED error. Download should auto
506 // resume in this case. 505 // resume in this case.
507 Java_DownloadController_onDownloadInterrupted( 506 Java_DownloadController_onDownloadInterrupted(
508 env, GetJavaObject()->Controller(env).obj(), jurl.obj(), 507 env, GetJavaObject()->Controller(env).obj(), jurl.obj(),
509 jmime_type.obj(), jfilename.obj(), jpath.obj(), 508 jmime_type.obj(), jfilename.obj(), jpath.obj(),
510 item->GetReceivedBytes(), item->GetId(), jguid.obj(), 509 item->GetReceivedBytes(), jguid.obj(),
511 item->CanResume(), IsInterruptedDownloadAutoResumable(item), 510 item->CanResume(), IsInterruptedDownloadAutoResumable(item),
512 item->GetBrowserContext()->IsOffTheRecord()); 511 item->GetBrowserContext()->IsOffTheRecord());
513 item->RemoveObserver(this); 512 item->RemoveObserver(this);
514 break; 513 break;
515 case DownloadItem::MAX_DOWNLOAD_STATE: 514 case DownloadItem::MAX_DOWNLOAD_STATE:
516 NOTREACHED(); 515 NOTREACHED();
517 } 516 }
518 } 517 }
519 518
520 void DownloadControllerAndroidImpl::OnDangerousDownload(DownloadItem* item) { 519 void DownloadControllerAndroidImpl::OnDangerousDownload(DownloadItem* item) {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 if (info) 607 if (info)
609 has_user_gesture = info->HasUserGesture(); 608 has_user_gesture = info->HasUserGesture();
610 } 609 }
611 610
612 DownloadControllerAndroidImpl::DownloadInfoAndroid::DownloadInfoAndroid( 611 DownloadControllerAndroidImpl::DownloadInfoAndroid::DownloadInfoAndroid(
613 const DownloadInfoAndroid& other) = default; 612 const DownloadInfoAndroid& other) = default;
614 613
615 DownloadControllerAndroidImpl::DownloadInfoAndroid::~DownloadInfoAndroid() {} 614 DownloadControllerAndroidImpl::DownloadInfoAndroid::~DownloadInfoAndroid() {}
616 615
617 } // namespace content 616 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698