Chromium Code Reviews| Index: chrome/browser/download/notification/download_notification_item.h |
| diff --git a/chrome/browser/download/notification/download_notification_item.h b/chrome/browser/download/notification/download_notification_item.h |
| index 76fb48b9e5a7e4c9d8b96d5f6850b98f4ec504be..710efe5580b14436ae1ba6ba8d26a66efa5441a7 100644 |
| --- a/chrome/browser/download/notification/download_notification_item.h |
| +++ b/chrome/browser/download/notification/download_notification_item.h |
| @@ -9,11 +9,13 @@ |
| #include "base/strings/string_number_conversions.h" |
| #include "chrome/browser/download/download_commands.h" |
| +#include "chrome/browser/image_decoder.h" |
| #include "chrome/browser/notifications/notification.h" |
| #include "chrome/browser/notifications/notification_delegate.h" |
| #include "chrome/browser/notifications/notification_test_util.h" |
| #include "content/public/browser/download_item.h" |
| #include "grit/theme_resources.h" |
| +#include "third_party/skia/include/core/SkBitmap.h" |
| #include "ui/message_center/message_center.h" |
| #include "ui/message_center/message_center_observer.h" |
| @@ -21,7 +23,8 @@ namespace test { |
| class DownloadNotificationItemTest; |
| } |
| -class DownloadNotificationItem : public content::DownloadItem::Observer { |
| +class DownloadNotificationItem : public content::DownloadItem::Observer, |
| + public ImageDecoder::ImageRequest { |
| public: |
| class Delegate { |
| public: |
| @@ -47,6 +50,14 @@ class DownloadNotificationItem : public content::DownloadItem::Observer { |
| UPDATE_EXISTING |
| }; |
| + enum ImageDecodeStatus { |
| + NOT_STARTED, |
| + IN_PROGRESS, |
| + DONE, |
| + FAILED, |
| + NOT_IMAGE |
| + }; |
| + |
| class NotificationWatcher : public NotificationDelegate { |
| public: |
| explicit NotificationWatcher(DownloadNotificationItem* item); |
| @@ -76,6 +87,7 @@ class DownloadNotificationItem : public content::DownloadItem::Observer { |
| // Methods called from NotificationWatcher. |
| void OnNotificationClick(); |
| void OnNotificationButtonClick(int button_index); |
| + void OnNotificationClose(bool by_user); |
| // DownloadItem::Observer overrides: |
| void OnDownloadUpdated(content::DownloadItem* item) override; |
| @@ -86,7 +98,16 @@ class DownloadNotificationItem : public content::DownloadItem::Observer { |
| void CloseNotificationByUser(); |
| void CloseNotificationByNonUser(); |
| void UpdateNotificationData(NotificationUpdateType type); |
| - void SetNotificationImage(int resource_id); |
| + |
| + // Set icon of the notification. |
| + void SetNotificationIcon(int resource_id); |
| + |
| + // Set preview image of the notification. Must be called on IO thread. |
| + void OnImageLoaded(std::string image_data); |
|
Lei Zhang
2015/06/12 07:26:37
pass by const ref.
yoshiki
2015/06/12 08:00:20
Done.
|
| + |
| + // ImageDecoder::ImageRequest overrides: |
| + void OnImageDecoded(const SkBitmap& decoded_image) override; |
| + void OnDecodeImageFailed() override; |
| NotificationUIManager* notification_ui_manager() const; |
| @@ -115,6 +136,11 @@ class DownloadNotificationItem : public content::DownloadItem::Observer { |
| scoped_ptr<std::vector<DownloadCommands::Command>> button_actions_; |
| Delegate* const delegate_; |
| + // Status of the preview image decode. |
| + ImageDecodeStatus image_decode_status_ = NOT_STARTED; |
| + |
| + base::WeakPtrFactory<DownloadNotificationItem> weak_factory_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(DownloadNotificationItem); |
| }; |