OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 DownloadShelfView* parent, | 55 DownloadShelfView* parent, |
56 BaseDownloadItemModel* model); | 56 BaseDownloadItemModel* model); |
57 virtual ~DownloadItemView(); | 57 virtual ~DownloadItemView(); |
58 | 58 |
59 // DownloadObserver method | 59 // DownloadObserver method |
60 virtual void OnDownloadUpdated(DownloadItem* download); | 60 virtual void OnDownloadUpdated(DownloadItem* download); |
61 | 61 |
62 // View overrides | 62 // View overrides |
63 virtual void Layout(); | 63 virtual void Layout(); |
64 virtual void Paint(ChromeCanvas* canvas); | 64 virtual void Paint(ChromeCanvas* canvas); |
65 virtual void GetPreferredSize(CSize *out); | 65 virtual gfx::Size GetPreferredSize(); |
66 virtual void OnMouseExited(const ChromeViews::MouseEvent& event); | 66 virtual void OnMouseExited(const ChromeViews::MouseEvent& event); |
67 virtual void OnMouseMoved(const ChromeViews::MouseEvent& event); | 67 virtual void OnMouseMoved(const ChromeViews::MouseEvent& event); |
68 virtual bool OnMousePressed(const ChromeViews::MouseEvent& event); | 68 virtual bool OnMousePressed(const ChromeViews::MouseEvent& event); |
69 virtual void OnMouseReleased(const ChromeViews::MouseEvent& event, | 69 virtual void OnMouseReleased(const ChromeViews::MouseEvent& event, |
70 bool canceled); | 70 bool canceled); |
71 virtual bool OnMouseDragged(const ChromeViews::MouseEvent& event); | 71 virtual bool OnMouseDragged(const ChromeViews::MouseEvent& event); |
72 virtual void DidChangeBounds(const CRect& previous, const CRect& current); | 72 virtual void DidChangeBounds(const CRect& previous, const CRect& current); |
73 | 73 |
74 // NativeButton::Listener implementation. | 74 // NativeButton::Listener implementation. |
75 virtual void ButtonPressed(ChromeViews::NativeButton* sender); | 75 virtual void ButtonPressed(ChromeViews::NativeButton* sender); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 void SetState(State body_state, State drop_down_state); | 132 void SetState(State body_state, State drop_down_state); |
133 | 133 |
134 // Whether we are in the dangerous mode. | 134 // Whether we are in the dangerous mode. |
135 bool IsDangerousMode() { return body_state_ == DANGEROUS; } | 135 bool IsDangerousMode() { return body_state_ == DANGEROUS; } |
136 | 136 |
137 // Reverts from dangerous mode to normal download mode. | 137 // Reverts from dangerous mode to normal download mode. |
138 void ClearDangerousMode(); | 138 void ClearDangerousMode(); |
139 | 139 |
140 // Sets |size| with the size of the Save and Discard buttons (they have the | 140 // Sets |size| with the size of the Save and Discard buttons (they have the |
141 // same size). | 141 // same size). |
142 void GetButtonSize(CSize* size); | 142 gfx::Size GetButtonSize(); |
143 | 143 |
144 // Sizes the dangerous download label to a minimum width available using 2 | 144 // Sizes the dangerous download label to a minimum width available using 2 |
145 // lines. The size is computed only the first time this method is invoked | 145 // lines. The size is computed only the first time this method is invoked |
146 // and simply returned on subsequent calls. | 146 // and simply returned on subsequent calls. |
147 void SizeLabelToMinWidth(); | 147 void SizeLabelToMinWidth(); |
148 | 148 |
149 // The different images used for the background. | 149 // The different images used for the background. |
150 BodyImageSet normal_body_image_set_; | 150 BodyImageSet normal_body_image_set_; |
151 BodyImageSet hot_body_image_set_; | 151 BodyImageSet hot_body_image_set_; |
152 BodyImageSet pushed_body_image_set_; | 152 BodyImageSet pushed_body_image_set_; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 ChromeViews::NativeButton* save_button_; | 221 ChromeViews::NativeButton* save_button_; |
222 ChromeViews::NativeButton* discard_button_; | 222 ChromeViews::NativeButton* discard_button_; |
223 | 223 |
224 // Dangerous mode label. | 224 // Dangerous mode label. |
225 ChromeViews::Label* dangerous_download_label_; | 225 ChromeViews::Label* dangerous_download_label_; |
226 | 226 |
227 // Whether the dangerous mode label has been sized yet. | 227 // Whether the dangerous mode label has been sized yet. |
228 bool dangerous_download_label_sized_; | 228 bool dangerous_download_label_sized_; |
229 | 229 |
230 // The size of the buttons. Cached so animation works when hidden. | 230 // The size of the buttons. Cached so animation works when hidden. |
231 CSize cached_button_size_; | 231 gfx::Size cached_button_size_; |
232 | 232 |
233 DISALLOW_EVIL_CONSTRUCTORS(DownloadItemView); | 233 DISALLOW_EVIL_CONSTRUCTORS(DownloadItemView); |
234 }; | 234 }; |
235 | 235 |
236 #endif // CHROME_BROWSER_VIEWS_DOWNLOAD_ITEM_VIEW_H__ | 236 #endif // CHROME_BROWSER_VIEWS_DOWNLOAD_ITEM_VIEW_H__ |
237 | 237 |
OLD | NEW |