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 "chrome/browser/download/download_item_model.h" | 5 #include "chrome/browser/download/download_item_model.h" |
6 | 6 |
7 #include "base/i18n/number_formatting.h" | 7 #include "base/i18n/number_formatting.h" |
8 #include "base/i18n/rtl.h" | 8 #include "base/i18n/rtl.h" |
9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
526 // If the download completed, then rely on GetAutoOpened() to check for | 526 // If the download completed, then rely on GetAutoOpened() to check for |
527 // opening behavior. This should accurately reflect whether the download | 527 // opening behavior. This should accurately reflect whether the download |
528 // was successfully opened. Extensions, for example, may fail to open. | 528 // was successfully opened. Extensions, for example, may fail to open. |
529 return download_->GetAutoOpened() || download_->IsTemporary(); | 529 return download_->GetAutoOpened() || download_->IsTemporary(); |
530 | 530 |
531 case DownloadItem::CANCELLED: | 531 case DownloadItem::CANCELLED: |
532 case DownloadItem::INTERRUPTED: | 532 case DownloadItem::INTERRUPTED: |
533 // Interrupted or cancelled downloads should remain on the shelf. | 533 // Interrupted or cancelled downloads should remain on the shelf. |
534 return false; | 534 return false; |
535 | 535 |
536 case DownloadItem::REMOVED: | |
benjhayden
2014/11/13 18:01:59
How do you ensure that this isn't reached?
| |
536 case DownloadItem::MAX_DOWNLOAD_STATE: | 537 case DownloadItem::MAX_DOWNLOAD_STATE: |
537 NOTREACHED(); | 538 NOTREACHED(); |
538 } | 539 } |
539 | 540 |
540 NOTREACHED(); | 541 NOTREACHED(); |
541 return false; | 542 return false; |
542 } | 543 } |
543 | 544 |
544 bool DownloadItemModel::ShouldShowDownloadStartedAnimation() const { | 545 bool DownloadItemModel::ShouldShowDownloadStartedAnimation() const { |
545 return !download_->IsSavePackageDownload() && | 546 return !download_->IsSavePackageDownload() && |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
693 if (!download_service) | 694 if (!download_service) |
694 return; | 695 return; |
695 | 696 |
696 ChromeDownloadManagerDelegate* delegate = | 697 ChromeDownloadManagerDelegate* delegate = |
697 download_service->GetDownloadManagerDelegate(); | 698 download_service->GetDownloadManagerDelegate(); |
698 if (!delegate) | 699 if (!delegate) |
699 return; | 700 return; |
700 delegate->OpenDownloadUsingPlatformHandler(download_); | 701 delegate->OpenDownloadUsingPlatformHandler(download_); |
701 RecordDownloadOpenMethod(DOWNLOAD_OPEN_METHOD_USER_PLATFORM); | 702 RecordDownloadOpenMethod(DOWNLOAD_OPEN_METHOD_USER_PLATFORM); |
702 } | 703 } |
OLD | NEW |