| 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 #ifndef CHROME_BROWSER_DOWNLOAD_NOTIFICATION_DOWNLOAD_NOTIFICATION_ITEM_H_ | 5 #ifndef CHROME_BROWSER_DOWNLOAD_NOTIFICATION_DOWNLOAD_NOTIFICATION_ITEM_H_ |
| 6 #define CHROME_BROWSER_DOWNLOAD_NOTIFICATION_DOWNLOAD_NOTIFICATION_ITEM_H_ | 6 #define CHROME_BROWSER_DOWNLOAD_NOTIFICATION_DOWNLOAD_NOTIFICATION_ITEM_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/download/notification/download_notification_item.h" | 8 #include "chrome/browser/download/notification/download_notification_item.h" |
| 9 | 9 |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 79 |
| 80 // DownloadItem::Observer overrides: | 80 // DownloadItem::Observer overrides: |
| 81 void OnDownloadUpdated(content::DownloadItem* item) override; | 81 void OnDownloadUpdated(content::DownloadItem* item) override; |
| 82 void OnDownloadOpened(content::DownloadItem* item) override; | 82 void OnDownloadOpened(content::DownloadItem* item) override; |
| 83 void OnDownloadRemoved(content::DownloadItem* item) override; | 83 void OnDownloadRemoved(content::DownloadItem* item) override; |
| 84 void OnDownloadDestroyed(content::DownloadItem* item) override; | 84 void OnDownloadDestroyed(content::DownloadItem* item) override; |
| 85 | 85 |
| 86 void CloseNotificationByUser(); | 86 void CloseNotificationByUser(); |
| 87 void CloseNotificationByNonUser(); | 87 void CloseNotificationByNonUser(); |
| 88 void UpdateNotificationData(NotificationUpdateType type); | 88 void UpdateNotificationData(NotificationUpdateType type); |
| 89 void SetNotificationImage(int resource_id); | 89 |
| 90 // Set icon of the notification. |
| 91 void SetNotificationIcon(int resource_id); |
| 92 |
| 93 // Set preview image of the notification. Must be called on IO thread. |
| 94 void SetNotificationImage(gfx::Image image); |
| 90 | 95 |
| 91 NotificationUIManager* notification_ui_manager() const; | 96 NotificationUIManager* notification_ui_manager() const; |
| 92 | 97 |
| 93 // Returns a short one-line status string for the download. | 98 // Returns a short one-line status string for the download. |
| 94 base::string16 GetTitle() const; | 99 base::string16 GetTitle() const; |
| 95 | 100 |
| 96 // Returns a short one-line status string for a download command. | 101 // Returns a short one-line status string for a download command. |
| 97 base::string16 GetCommandLabel(DownloadCommands::Command command) const; | 102 base::string16 GetCommandLabel(DownloadCommands::Command command) const; |
| 98 | 103 |
| 99 // Get the warning test to notify a dangerous download. Should only be called | 104 // Get the warning test to notify a dangerous download. Should only be called |
| 100 // if IsDangerous() is true. | 105 // if IsDangerous() is true. |
| 101 base::string16 GetWarningText() const; | 106 base::string16 GetWarningText() const; |
| 102 | 107 |
| 103 Browser* GetBrowser(); | 108 Browser* GetBrowser(); |
| 104 | 109 |
| 105 // Returns the list of possible extra (all except the default) actions. | 110 // Returns the list of possible extra (all except the default) actions. |
| 106 scoped_ptr<std::vector<DownloadCommands::Command>> GetExtraActions() const; | 111 scoped_ptr<std::vector<DownloadCommands::Command>> GetExtraActions() const; |
| 107 | 112 |
| 108 int image_resource_id_ = 0; | 113 int image_resource_id_ = 0; |
| 109 content::DownloadItem::DownloadState previous_download_state_ = | 114 content::DownloadItem::DownloadState previous_download_state_ = |
| 110 content::DownloadItem::MAX_DOWNLOAD_STATE; // As uninitialized state | 115 content::DownloadItem::MAX_DOWNLOAD_STATE; // As uninitialized state |
| 111 Profile* profile_; | 116 Profile* profile_; |
| 112 scoped_refptr<NotificationWatcher> watcher_; | 117 scoped_refptr<NotificationWatcher> watcher_; |
| 113 scoped_ptr<Notification> notification_; | 118 scoped_ptr<Notification> notification_; |
| 114 content::DownloadItem* item_; | 119 content::DownloadItem* item_; |
| 115 scoped_ptr<std::vector<DownloadCommands::Command>> button_actions_; | 120 scoped_ptr<std::vector<DownloadCommands::Command>> button_actions_; |
| 116 Delegate* const delegate_; | 121 Delegate* const delegate_; |
| 117 | 122 |
| 123 // Whether the preview image been has set or not. |
| 124 bool set_image_ = false; |
| 125 |
| 126 base::WeakPtrFactory<DownloadNotificationItem> weak_factory_; |
| 127 |
| 118 DISALLOW_COPY_AND_ASSIGN(DownloadNotificationItem); | 128 DISALLOW_COPY_AND_ASSIGN(DownloadNotificationItem); |
| 119 }; | 129 }; |
| 120 | 130 |
| 121 #endif // CHROME_BROWSER_DOWNLOAD_NOTIFICATION_DOWNLOAD_NOTIFICATION_ITEM_H_ | 131 #endif // CHROME_BROWSER_DOWNLOAD_NOTIFICATION_DOWNLOAD_NOTIFICATION_ITEM_H_ |
| OLD | NEW |