| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/notification/download_item_notification.h" | 5 #include "chrome/browser/download/notification/download_item_notification.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 837 | 837 |
| 838 // "Starting..." | 838 // "Starting..." |
| 839 return l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_STARTING); | 839 return l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_STARTING); |
| 840 } | 840 } |
| 841 | 841 |
| 842 base::string16 DownloadItemNotification::GetStatusString() const { | 842 base::string16 DownloadItemNotification::GetStatusString() const { |
| 843 if (item_->IsDangerous()) | 843 if (item_->IsDangerous()) |
| 844 return GetWarningStatusString(); | 844 return GetWarningStatusString(); |
| 845 | 845 |
| 846 // The hostname. (E.g.:"example.com" or "127.0.0.1") | 846 // The hostname. (E.g.:"example.com" or "127.0.0.1") |
| 847 base::string16 host_name = | 847 base::string16 host_name = url_formatter::FormatUrlForSecurityDisplay( |
| 848 url_formatter::FormatUrlForSecurityDisplayOmitScheme(item_->GetURL()); | 848 item_->GetURL(), url_formatter::SchemeDisplay::OMIT_HTTP_AND_HTTPS); |
| 849 | 849 |
| 850 DownloadItemModel model(item_); | 850 DownloadItemModel model(item_); |
| 851 base::string16 sub_status_text; | 851 base::string16 sub_status_text; |
| 852 bool show_size_ratio = true; | 852 bool show_size_ratio = true; |
| 853 switch (item_->GetState()) { | 853 switch (item_->GetState()) { |
| 854 case content::DownloadItem::IN_PROGRESS: | 854 case content::DownloadItem::IN_PROGRESS: |
| 855 // The download is a CRX (app, extension, theme, ...) and it is being | 855 // The download is a CRX (app, extension, theme, ...) and it is being |
| 856 // unpacked and validated. | 856 // unpacked and validated. |
| 857 if (item_->AllDataSaved() && | 857 if (item_->AllDataSaved() && |
| 858 download_crx_util::IsExtensionDownload(*item_)) { | 858 download_crx_util::IsExtensionDownload(*item_)) { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 935 const std::string notification_id_in_message_center = notification->id(); | 935 const std::string notification_id_in_message_center = notification->id(); |
| 936 | 936 |
| 937 message_center::NotificationList::Notifications visible_notifications = | 937 message_center::NotificationList::Notifications visible_notifications = |
| 938 message_center_->GetVisibleNotifications(); | 938 message_center_->GetVisibleNotifications(); |
| 939 for (const auto& notification : visible_notifications) { | 939 for (const auto& notification : visible_notifications) { |
| 940 if (notification->id() == notification_id_in_message_center) | 940 if (notification->id() == notification_id_in_message_center) |
| 941 return true; | 941 return true; |
| 942 } | 942 } |
| 943 return false; | 943 return false; |
| 944 } | 944 } |
| OLD | NEW |