| 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 28 matching lines...) Expand all Loading... |
| 39 #include "ui/base/text/bytes_formatting.h" | 39 #include "ui/base/text/bytes_formatting.h" |
| 40 #include "ui/gfx/codec/jpeg_codec.h" | 40 #include "ui/gfx/codec/jpeg_codec.h" |
| 41 #include "ui/gfx/color_palette.h" | 41 #include "ui/gfx/color_palette.h" |
| 42 #include "ui/gfx/image/image.h" | 42 #include "ui/gfx/image/image.h" |
| 43 #include "ui/gfx/paint_vector_icon.h" | 43 #include "ui/gfx/paint_vector_icon.h" |
| 44 #include "ui/gfx/vector_icons_public.h" | 44 #include "ui/gfx/vector_icons_public.h" |
| 45 #include "ui/message_center/message_center.h" | 45 #include "ui/message_center/message_center.h" |
| 46 #include "ui/message_center/message_center_style.h" | 46 #include "ui/message_center/message_center_style.h" |
| 47 | 47 |
| 48 #if defined(OS_CHROMEOS) | 48 #if defined(OS_CHROMEOS) |
| 49 #include "chrome/browser/chromeos/note_taking_app_utils.h" | 49 #include "chrome/browser/chromeos/note_taking_helper.h" |
| 50 #endif // defined(OS_CHROMEOS) | 50 #endif // defined(OS_CHROMEOS) |
| 51 | 51 |
| 52 using base::UserMetricsAction; | 52 using base::UserMetricsAction; |
| 53 | 53 |
| 54 namespace { | 54 namespace { |
| 55 | 55 |
| 56 const char kDownloadNotificationNotifierId[] = | 56 const char kDownloadNotificationNotifierId[] = |
| 57 "chrome://downloads/notification/id-notifier"; | 57 "chrome://downloads/notification/id-notifier"; |
| 58 | 58 |
| 59 // Background color of the preview images | 59 // Background color of the preview images |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 case content::DownloadItem::CANCELLED: | 648 case content::DownloadItem::CANCELLED: |
| 649 case content::DownloadItem::INTERRUPTED: | 649 case content::DownloadItem::INTERRUPTED: |
| 650 if (item_->CanResume()) | 650 if (item_->CanResume()) |
| 651 actions->push_back(DownloadCommands::RESUME); | 651 actions->push_back(DownloadCommands::RESUME); |
| 652 break; | 652 break; |
| 653 case content::DownloadItem::COMPLETE: | 653 case content::DownloadItem::COMPLETE: |
| 654 actions->push_back(DownloadCommands::SHOW_IN_FOLDER); | 654 actions->push_back(DownloadCommands::SHOW_IN_FOLDER); |
| 655 if (!notification_->image().IsEmpty()) { | 655 if (!notification_->image().IsEmpty()) { |
| 656 actions->push_back(DownloadCommands::COPY_TO_CLIPBOARD); | 656 actions->push_back(DownloadCommands::COPY_TO_CLIPBOARD); |
| 657 #if defined(OS_CHROMEOS) | 657 #if defined(OS_CHROMEOS) |
| 658 if (chromeos::IsNoteTakingAppAvailable(profile())) | 658 if (chromeos::NoteTakingHelper::Get()->IsAppAvailable(profile())) |
| 659 actions->push_back(DownloadCommands::ANNOTATE); | 659 actions->push_back(DownloadCommands::ANNOTATE); |
| 660 #endif // defined(OS_CHROMEOS) | 660 #endif // defined(OS_CHROMEOS) |
| 661 } | 661 } |
| 662 break; | 662 break; |
| 663 case content::DownloadItem::MAX_DOWNLOAD_STATE: | 663 case content::DownloadItem::MAX_DOWNLOAD_STATE: |
| 664 NOTREACHED(); | 664 NOTREACHED(); |
| 665 } | 665 } |
| 666 return actions; | 666 return actions; |
| 667 } | 667 } |
| 668 | 668 |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 936 const std::string notification_id_in_message_center = notification->id(); | 936 const std::string notification_id_in_message_center = notification->id(); |
| 937 | 937 |
| 938 message_center::NotificationList::Notifications visible_notifications = | 938 message_center::NotificationList::Notifications visible_notifications = |
| 939 message_center_->GetVisibleNotifications(); | 939 message_center_->GetVisibleNotifications(); |
| 940 for (auto* notification : visible_notifications) { | 940 for (auto* notification : visible_notifications) { |
| 941 if (notification->id() == notification_id_in_message_center) | 941 if (notification->id() == notification_id_in_message_center) |
| 942 return true; | 942 return true; |
| 943 } | 943 } |
| 944 return false; | 944 return false; |
| 945 } | 945 } |
| OLD | NEW |