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

Side by Side Diff: chrome/browser/ui/views/download/download_item_view.h

Issue 10453101: Convert most of the rest of chrome to ImageSkia (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // A ChromeView that implements one download on the Download shelf. 5 // A ChromeView that implements one download on the Download shelf.
6 // Each DownloadItemView contains an application icon, a text label 6 // Each DownloadItemView contains an application icon, a text label
7 // indicating the download's file name, a text label indicating the 7 // indicating the download's file name, a text label indicating the
8 // download's status (such as the number of bytes downloaded so far) 8 // download's status (such as the number of bytes downloaded so far)
9 // and a button for canceling an in progress download, or opening 9 // and a button for canceling an in progress download, or opening
10 // the completed download. 10 // the completed download.
(...skipping 19 matching lines...) Expand all
30 #include "content/public/browser/download_item.h" 30 #include "content/public/browser/download_item.h"
31 #include "content/public/browser/download_manager.h" 31 #include "content/public/browser/download_manager.h"
32 #include "ui/base/animation/animation_delegate.h" 32 #include "ui/base/animation/animation_delegate.h"
33 #include "ui/gfx/font.h" 33 #include "ui/gfx/font.h"
34 #include "ui/views/controls/button/button.h" 34 #include "ui/views/controls/button/button.h"
35 #include "ui/views/events/event.h" 35 #include "ui/views/events/event.h"
36 #include "ui/views/view.h" 36 #include "ui/views/view.h"
37 37
38 class BaseDownloadItemModel; 38 class BaseDownloadItemModel;
39 class DownloadShelfView; 39 class DownloadShelfView;
40 class SkBitmap;
41 class DownloadShelfContextMenuView; 40 class DownloadShelfContextMenuView;
42 41
43 namespace gfx { 42 namespace gfx {
44 class Image; 43 class Image;
44 class ImageSkia;
45 } 45 }
46 46
47 namespace ui { 47 namespace ui {
48 class SlideAnimation; 48 class SlideAnimation;
49 } 49 }
50 50
51 namespace views { 51 namespace views {
52 class Label; 52 class Label;
53 class TextButton; 53 class TextButton;
54 } 54 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 }; 113 };
114 114
115 enum Mode { 115 enum Mode {
116 NORMAL_MODE = 0, // Showing download item. 116 NORMAL_MODE = 0, // Showing download item.
117 DANGEROUS_MODE, // Displaying the dangerous download warning. 117 DANGEROUS_MODE, // Displaying the dangerous download warning.
118 MALICIOUS_MODE // Displaying the malicious download warning. 118 MALICIOUS_MODE // Displaying the malicious download warning.
119 }; 119 };
120 120
121 // The image set associated with the part containing the icon and text. 121 // The image set associated with the part containing the icon and text.
122 struct BodyImageSet { 122 struct BodyImageSet {
123 SkBitmap* top_left; 123 gfx::ImageSkia* top_left;
124 SkBitmap* left; 124 gfx::ImageSkia* left;
125 SkBitmap* bottom_left; 125 gfx::ImageSkia* bottom_left;
126 SkBitmap* top; 126 gfx::ImageSkia* top;
127 SkBitmap* center; 127 gfx::ImageSkia* center;
128 SkBitmap* bottom; 128 gfx::ImageSkia* bottom;
129 SkBitmap* top_right; 129 gfx::ImageSkia* top_right;
130 SkBitmap* right; 130 gfx::ImageSkia* right;
131 SkBitmap* bottom_right; 131 gfx::ImageSkia* bottom_right;
132 }; 132 };
133 133
134 // The image set associated with the drop-down button on the right. 134 // The image set associated with the drop-down button on the right.
135 struct DropDownImageSet { 135 struct DropDownImageSet {
136 SkBitmap* top; 136 gfx::ImageSkia* top;
137 SkBitmap* center; 137 gfx::ImageSkia* center;
138 SkBitmap* bottom; 138 gfx::ImageSkia* bottom;
139 }; 139 };
140 140
141 void OpenDownload(); 141 void OpenDownload();
142 142
143 void LoadIcon(); 143 void LoadIcon();
144 void LoadIconIfItemPathChanged(); 144 void LoadIconIfItemPathChanged();
145 145
146 // Convenience method to paint the 3 vertical bitmaps (bottom, middle, top) 146 // Convenience method to paint the 3 vertical images (bottom, middle, top)
147 // that form the background. 147 // that form the background.
148 void PaintBitmaps(gfx::Canvas* canvas, 148 void PaintImages(gfx::Canvas* canvas,
149 const SkBitmap* top_bitmap, 149 const gfx::ImageSkia* top_image,
150 const SkBitmap* center_bitmap, 150 const gfx::ImageSkia* center_image,
151 const SkBitmap* bottom_bitmap, 151 const gfx::ImageSkia* bottom_image,
152 int x, 152 int x,
153 int y, 153 int y,
154 int height, 154 int height,
155 int width); 155 int width);
156 156
157 // Sets the state and triggers a repaint. 157 // Sets the state and triggers a repaint.
158 void SetState(State body_state, State drop_down_state); 158 void SetState(State body_state, State drop_down_state);
159 159
160 // Whether we are in the dangerous mode. 160 // Whether we are in the dangerous mode.
161 bool IsShowingWarningDialog() const { 161 bool IsShowingWarningDialog() const {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 BodyImageSet normal_body_image_set_; 201 BodyImageSet normal_body_image_set_;
202 BodyImageSet hot_body_image_set_; 202 BodyImageSet hot_body_image_set_;
203 BodyImageSet pushed_body_image_set_; 203 BodyImageSet pushed_body_image_set_;
204 BodyImageSet dangerous_mode_body_image_set_; 204 BodyImageSet dangerous_mode_body_image_set_;
205 BodyImageSet malicious_mode_body_image_set_; 205 BodyImageSet malicious_mode_body_image_set_;
206 DropDownImageSet normal_drop_down_image_set_; 206 DropDownImageSet normal_drop_down_image_set_;
207 DropDownImageSet hot_drop_down_image_set_; 207 DropDownImageSet hot_drop_down_image_set_;
208 DropDownImageSet pushed_drop_down_image_set_; 208 DropDownImageSet pushed_drop_down_image_set_;
209 209
210 // The warning icon showns for dangerous downloads. 210 // The warning icon showns for dangerous downloads.
211 const SkBitmap* warning_icon_; 211 const gfx::ImageSkia* warning_icon_;
212 212
213 // The model we query for display information 213 // The model we query for display information
214 content::DownloadItem* download_; 214 content::DownloadItem* download_;
215 215
216 // Our parent view that owns us. 216 // Our parent view that owns us.
217 DownloadShelfView* parent_; 217 DownloadShelfView* parent_;
218 218
219 // Elements of our particular download 219 // Elements of our particular download
220 string16 status_text_; 220 string16 status_text_;
221 221
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 306
307 // The icon loaded in the download shelf is based on the file path of the 307 // The icon loaded in the download shelf is based on the file path of the
308 // item. Store the path used, so that we can detect a change in the path 308 // item. Store the path used, so that we can detect a change in the path
309 // and reload the icon. 309 // and reload the icon.
310 FilePath last_download_item_path_; 310 FilePath last_download_item_path_;
311 311
312 DISALLOW_COPY_AND_ASSIGN(DownloadItemView); 312 DISALLOW_COPY_AND_ASSIGN(DownloadItemView);
313 }; 313 };
314 314
315 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_ITEM_VIEW_H__ 315 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_ITEM_VIEW_H__
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/detachable_toolbar_view.cc ('k') | chrome/browser/ui/views/download/download_item_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698