Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: chrome/browser/download/notification/download_item_notification.h

Issue 2685683004: Move more vector icons to more appropriate directories. (Closed)
Patch Set: rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_ITEM_NOTIFICATION_H_ 5 #ifndef CHROME_BROWSER_DOWNLOAD_NOTIFICATION_DOWNLOAD_ITEM_NOTIFICATION_H_
6 #define CHROME_BROWSER_DOWNLOAD_NOTIFICATION_DOWNLOAD_ITEM_NOTIFICATION_H_ 6 #define CHROME_BROWSER_DOWNLOAD_NOTIFICATION_DOWNLOAD_ITEM_NOTIFICATION_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "chrome/browser/download/download_commands.h" 10 #include "chrome/browser/download/download_commands.h"
11 #include "chrome/browser/download/notification/download_notification.h" 11 #include "chrome/browser/download/notification/download_notification.h"
12 #include "chrome/browser/image_decoder.h" 12 #include "chrome/browser/image_decoder.h"
13 #include "chrome/browser/notifications/notification.h" 13 #include "chrome/browser/notifications/notification.h"
14 #include "chrome/browser/notifications/notification_delegate.h" 14 #include "chrome/browser/notifications/notification_delegate.h"
15 #include "chrome/browser/notifications/notification_test_util.h" 15 #include "chrome/browser/notifications/notification_test_util.h"
16 #include "content/public/browser/download_item.h" 16 #include "content/public/browser/download_item.h"
17 #include "third_party/skia/include/core/SkColor.h" 17 #include "third_party/skia/include/core/SkColor.h"
18 #include "ui/message_center/message_center.h" 18 #include "ui/message_center/message_center.h"
19 #include "ui/message_center/message_center_observer.h" 19 #include "ui/message_center/message_center_observer.h"
20 #include "ui/native_theme/native_theme.h" 20 #include "ui/native_theme/native_theme.h"
21 21
22 class SkBitmap; 22 class SkBitmap;
23 23
24 namespace test { 24 namespace test {
25 class DownloadItemNotificationTest; 25 class DownloadItemNotificationTest;
26 } 26 }
27 27
28 namespace gfx { 28 namespace gfx {
29 enum class VectorIconId; 29 struct VectorIcon;
30 } 30 }
31 31
32 class DownloadNotificationManagerForProfile; 32 class DownloadNotificationManagerForProfile;
33 33
34 class DownloadItemNotification : public DownloadNotification, 34 class DownloadItemNotification : public DownloadNotification,
35 public ImageDecoder::ImageRequest { 35 public ImageDecoder::ImageRequest {
36 public: 36 public:
37 DownloadItemNotification(content::DownloadItem* item, 37 DownloadItemNotification(content::DownloadItem* item,
38 DownloadNotificationManagerForProfile* manager); 38 DownloadNotificationManagerForProfile* manager);
39 39
(...skipping 23 matching lines...) Expand all
63 }; 63 };
64 64
65 void CloseNotificationByUser(); 65 void CloseNotificationByUser();
66 void CloseNotificationByNonUser(); 66 void CloseNotificationByNonUser();
67 void Update(); 67 void Update();
68 void UpdateNotificationData(NotificationUpdateType type); 68 void UpdateNotificationData(NotificationUpdateType type);
69 void UpdateNotificationIcon(); 69 void UpdateNotificationIcon();
70 70
71 // Set icon of the notification. 71 // Set icon of the notification.
72 void SetNotificationIcon(int resource_id); 72 void SetNotificationIcon(int resource_id);
73 void SetNotificationVectorIcon(gfx::VectorIconId id, SkColor color); 73 void SetNotificationVectorIcon(const gfx::VectorIcon& icon, SkColor color);
74 74
75 // Set preview image of the notification. Must be called on IO thread. 75 // Set preview image of the notification. Must be called on IO thread.
76 void OnImageLoaded(const std::string& image_data); 76 void OnImageLoaded(const std::string& image_data);
77 void OnImageCropped(const SkBitmap& image); 77 void OnImageCropped(const SkBitmap& image);
78 78
79 // ImageDecoder::ImageRequest overrides: 79 // ImageDecoder::ImageRequest overrides:
80 void OnImageDecoded(const SkBitmap& decoded_image) override; 80 void OnImageDecoded(const SkBitmap& decoded_image) override;
81 void OnDecodeImageFailed() override; 81 void OnDecodeImageFailed() override;
82 82
83 // Returns a short one-line status string for the download. 83 // Returns a short one-line status string for the download.
(...skipping 23 matching lines...) Expand all
107 const; 107 const;
108 108
109 // Flag to show the notification on next update. If true, the notification 109 // Flag to show the notification on next update. If true, the notification
110 // goes visible. The initial value is true so it gets shown on initial update. 110 // goes visible. The initial value is true so it gets shown on initial update.
111 bool show_next_ = true; 111 bool show_next_ = true;
112 112
113 // Flag if the notification has been closed or not. Setting this flag 113 // Flag if the notification has been closed or not. Setting this flag
114 // prevents updates after close. 114 // prevents updates after close.
115 bool closed_ = false; 115 bool closed_ = false;
116 116
117 int image_resource_id_ = 0;
118 std::pair<gfx::VectorIconId, SkColor> vector_icon_params_;
119 content::DownloadItem::DownloadState previous_download_state_ = 117 content::DownloadItem::DownloadState previous_download_state_ =
120 content::DownloadItem::MAX_DOWNLOAD_STATE; // As uninitialized state 118 content::DownloadItem::MAX_DOWNLOAD_STATE; // As uninitialized state
121 bool previous_dangerous_state_ = false; 119 bool previous_dangerous_state_ = false;
122 std::unique_ptr<Notification> notification_; 120 std::unique_ptr<Notification> notification_;
123 content::DownloadItem* item_; 121 content::DownloadItem* item_;
124 std::unique_ptr<std::vector<DownloadCommands::Command>> button_actions_; 122 std::unique_ptr<std::vector<DownloadCommands::Command>> button_actions_;
125 123
126 // Status of the preview image decode. 124 // Status of the preview image decode.
127 ImageDecodeStatus image_decode_status_ = NOT_STARTED; 125 ImageDecodeStatus image_decode_status_ = NOT_STARTED;
128 126
129 // Pointer to the message center instance. 127 // Pointer to the message center instance.
130 message_center::MessageCenter* message_center_; 128 message_center::MessageCenter* message_center_;
131 129
132 void SetMessageCenterForTest( 130 void SetMessageCenterForTest(
133 message_center::MessageCenter* message_center); 131 message_center::MessageCenter* message_center);
134 132
135 base::WeakPtrFactory<DownloadItemNotification> weak_factory_; 133 base::WeakPtrFactory<DownloadItemNotification> weak_factory_;
136 134
137 DISALLOW_COPY_AND_ASSIGN(DownloadItemNotification); 135 DISALLOW_COPY_AND_ASSIGN(DownloadItemNotification);
138 }; 136 };
139 137
140 #endif // CHROME_BROWSER_DOWNLOAD_NOTIFICATION_DOWNLOAD_ITEM_NOTIFICATION_H_ 138 #endif // CHROME_BROWSER_DOWNLOAD_NOTIFICATION_DOWNLOAD_ITEM_NOTIFICATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698