OLD | NEW |
1 // Copyright (c) 2011 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. |
11 // | 11 // |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 96 |
97 // ButtonListener implementation. | 97 // ButtonListener implementation. |
98 virtual void ButtonPressed(views::Button* sender, | 98 virtual void ButtonPressed(views::Button* sender, |
99 const views::Event& event) OVERRIDE; | 99 const views::Event& event) OVERRIDE; |
100 | 100 |
101 // ui::AnimationDelegate implementation. | 101 // ui::AnimationDelegate implementation. |
102 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 102 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
103 | 103 |
104 protected: | 104 protected: |
105 // Overridden from views::View: | 105 // Overridden from views::View: |
106 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; | 106 virtual void OnPaint(gfx::CanvasSkia* canvas) OVERRIDE; |
107 | 107 |
108 private: | 108 private: |
109 enum State { | 109 enum State { |
110 NORMAL = 0, | 110 NORMAL = 0, |
111 HOT, | 111 HOT, |
112 PUSHED | 112 PUSHED |
113 }; | 113 }; |
114 | 114 |
115 enum Mode { | 115 enum Mode { |
116 NORMAL_MODE = 0, // Showing download item. | 116 NORMAL_MODE = 0, // Showing download item. |
(...skipping 21 matching lines...) Expand all Loading... |
138 SkBitmap* bottom; | 138 SkBitmap* 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 bitmaps (bottom, middle, top) |
147 // that form the background. | 147 // that form the background. |
148 void PaintBitmaps(gfx::Canvas* canvas, | 148 void PaintBitmaps(gfx::CanvasSkia* canvas, |
149 const SkBitmap* top_bitmap, | 149 const SkBitmap* top_bitmap, |
150 const SkBitmap* center_bitmap, | 150 const SkBitmap* center_bitmap, |
151 const SkBitmap* bottom_bitmap, | 151 const SkBitmap* bottom_bitmap, |
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); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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__ |
OLD | NEW |