| 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 "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/download/download_crx_util.h" | 10 #include "chrome/browser/download/download_crx_util.h" |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 void DownloadItemNotification::UpdateNotificationIcon() { | 490 void DownloadItemNotification::UpdateNotificationIcon() { |
| 491 if (item_->IsDangerous()) { | 491 if (item_->IsDangerous()) { |
| 492 DownloadItemModel model(item_); | 492 DownloadItemModel model(item_); |
| 493 #if defined(OS_MACOSX) | 493 #if defined(OS_MACOSX) |
| 494 SetNotificationIcon(model.MightBeMalicious() | 494 SetNotificationIcon(model.MightBeMalicious() |
| 495 ? IDR_DOWNLOAD_NOTIFICATION_WARNING_BAD | 495 ? IDR_DOWNLOAD_NOTIFICATION_WARNING_BAD |
| 496 : IDR_DOWNLOAD_NOTIFICATION_WARNING_UNWANTED); | 496 : IDR_DOWNLOAD_NOTIFICATION_WARNING_UNWANTED); |
| 497 #else | 497 #else |
| 498 SetNotificationVectorIcon( | 498 SetNotificationVectorIcon( |
| 499 gfx::VectorIconId::WARNING, | 499 gfx::VectorIconId::WARNING, |
| 500 model.MightBeMalicious() ? gfx::kErrorRed : gfx::kAmber); | 500 model.MightBeMalicious() ? gfx::kGoogleRed700 : gfx::kAmber); |
| 501 #endif | 501 #endif |
| 502 return; | 502 return; |
| 503 } | 503 } |
| 504 | 504 |
| 505 bool is_off_the_record = item_->GetBrowserContext() && | 505 bool is_off_the_record = item_->GetBrowserContext() && |
| 506 item_->GetBrowserContext()->IsOffTheRecord(); | 506 item_->GetBrowserContext()->IsOffTheRecord(); |
| 507 switch (item_->GetState()) { | 507 switch (item_->GetState()) { |
| 508 case content::DownloadItem::IN_PROGRESS: | 508 case content::DownloadItem::IN_PROGRESS: |
| 509 case content::DownloadItem::COMPLETE: | 509 case content::DownloadItem::COMPLETE: |
| 510 if (is_off_the_record) { | 510 if (is_off_the_record) { |
| 511 #if defined(OS_MACOSX) | 511 #if defined(OS_MACOSX) |
| 512 SetNotificationIcon(IDR_DOWNLOAD_NOTIFICATION_INCOGNITO); | 512 SetNotificationIcon(IDR_DOWNLOAD_NOTIFICATION_INCOGNITO); |
| 513 #else | 513 #else |
| 514 SetNotificationVectorIcon(gfx::VectorIconId::FILE_DOWNLOAD_INCOGNITO, | 514 SetNotificationVectorIcon(gfx::VectorIconId::FILE_DOWNLOAD_INCOGNITO, |
| 515 gfx::kChromeIconGrey); | 515 gfx::kChromeIconGrey); |
| 516 #endif | 516 #endif |
| 517 } else { | 517 } else { |
| 518 SetNotificationVectorIcon(gfx::VectorIconId::FILE_DOWNLOAD, | 518 SetNotificationVectorIcon(gfx::VectorIconId::FILE_DOWNLOAD, |
| 519 gfx::kGoogleBlue); | 519 gfx::kGoogleBlue); |
| 520 } | 520 } |
| 521 break; | 521 break; |
| 522 | 522 |
| 523 case content::DownloadItem::INTERRUPTED: | 523 case content::DownloadItem::INTERRUPTED: |
| 524 #if defined(OS_MACOSX) | 524 #if defined(OS_MACOSX) |
| 525 SetNotificationIcon(IDR_DOWNLOAD_NOTIFICATION_ERROR); | 525 SetNotificationIcon(IDR_DOWNLOAD_NOTIFICATION_ERROR); |
| 526 #else | 526 #else |
| 527 SetNotificationVectorIcon(gfx::VectorIconId::ERROR_CIRCLE, | 527 SetNotificationVectorIcon(gfx::VectorIconId::ERROR_CIRCLE, |
| 528 gfx::kErrorRed); | 528 gfx::kGoogleRed700); |
| 529 #endif | 529 #endif |
| 530 break; | 530 break; |
| 531 | 531 |
| 532 case content::DownloadItem::CANCELLED: | 532 case content::DownloadItem::CANCELLED: |
| 533 break; | 533 break; |
| 534 | 534 |
| 535 case content::DownloadItem::MAX_DOWNLOAD_STATE: | 535 case content::DownloadItem::MAX_DOWNLOAD_STATE: |
| 536 NOTREACHED(); | 536 NOTREACHED(); |
| 537 break; | 537 break; |
| 538 } | 538 } |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 906 profile_id); | 906 profile_id); |
| 907 | 907 |
| 908 message_center::NotificationList::Notifications visible_notifications = | 908 message_center::NotificationList::Notifications visible_notifications = |
| 909 g_browser_process->message_center()->GetVisibleNotifications(); | 909 g_browser_process->message_center()->GetVisibleNotifications(); |
| 910 for (const auto& notification : visible_notifications) { | 910 for (const auto& notification : visible_notifications) { |
| 911 if (notification->id() == notification_id_in_message_center) | 911 if (notification->id() == notification_id_in_message_center) |
| 912 return true; | 912 return true; |
| 913 } | 913 } |
| 914 return false; | 914 return false; |
| 915 } | 915 } |
| OLD | NEW |