| 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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 | 354 |
| 355 base::string16 DownloadItemModel::GetTooltipText(const gfx::FontList& font_list, | 355 base::string16 DownloadItemModel::GetTooltipText(const gfx::FontList& font_list, |
| 356 int max_width) const { | 356 int max_width) const { |
| 357 base::string16 tooltip = gfx::ElideFilename( | 357 base::string16 tooltip = gfx::ElideFilename( |
| 358 download_->GetFileNameToReportUser(), font_list, max_width); | 358 download_->GetFileNameToReportUser(), font_list, max_width); |
| 359 content::DownloadInterruptReason reason = download_->GetLastReason(); | 359 content::DownloadInterruptReason reason = download_->GetLastReason(); |
| 360 if (download_->GetState() == DownloadItem::INTERRUPTED && | 360 if (download_->GetState() == DownloadItem::INTERRUPTED && |
| 361 reason != content::DOWNLOAD_INTERRUPT_REASON_USER_CANCELED) { | 361 reason != content::DOWNLOAD_INTERRUPT_REASON_USER_CANCELED) { |
| 362 tooltip += base::ASCIIToUTF16("\n"); | 362 tooltip += base::ASCIIToUTF16("\n"); |
| 363 tooltip += gfx::ElideText(InterruptReasonStatusMessage(reason), | 363 tooltip += gfx::ElideText(InterruptReasonStatusMessage(reason), |
| 364 font_list, max_width, gfx::ELIDE_AT_END); | 364 font_list, max_width, gfx::ELIDE_TAIL); |
| 365 } | 365 } |
| 366 return tooltip; | 366 return tooltip; |
| 367 } | 367 } |
| 368 | 368 |
| 369 base::string16 DownloadItemModel::GetWarningText(const gfx::FontList& font_list, | 369 base::string16 DownloadItemModel::GetWarningText(const gfx::FontList& font_list, |
| 370 int base_width) const { | 370 int base_width) const { |
| 371 // Should only be called if IsDangerous(). | 371 // Should only be called if IsDangerous(). |
| 372 DCHECK(IsDangerous()); | 372 DCHECK(IsDangerous()); |
| 373 base::string16 elided_filename = | 373 base::string16 elided_filename = |
| 374 gfx::ElideFilename(download_->GetFileNameToReportUser(), font_list, | 374 gfx::ElideFilename(download_->GetFileNameToReportUser(), font_list, |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 if (!download_service) | 683 if (!download_service) |
| 684 return; | 684 return; |
| 685 | 685 |
| 686 ChromeDownloadManagerDelegate* delegate = | 686 ChromeDownloadManagerDelegate* delegate = |
| 687 download_service->GetDownloadManagerDelegate(); | 687 download_service->GetDownloadManagerDelegate(); |
| 688 if (!delegate) | 688 if (!delegate) |
| 689 return; | 689 return; |
| 690 delegate->OpenDownloadUsingPlatformHandler(download_); | 690 delegate->OpenDownloadUsingPlatformHandler(download_); |
| 691 RecordDownloadOpenMethod(DOWNLOAD_OPEN_METHOD_USER_PLATFORM); | 691 RecordDownloadOpenMethod(DOWNLOAD_OPEN_METHOD_USER_PLATFORM); |
| 692 } | 692 } |
| OLD | NEW |