OLD | NEW |
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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 virtual bool GetTooltipText(const gfx::Point& p, | 91 virtual bool GetTooltipText(const gfx::Point& p, |
92 string16* tooltip) const OVERRIDE; | 92 string16* tooltip) const OVERRIDE; |
93 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 93 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
94 virtual void OnThemeChanged() OVERRIDE; | 94 virtual void OnThemeChanged() OVERRIDE; |
95 | 95 |
96 // Overridden from ui::EventHandler: | 96 // Overridden from ui::EventHandler: |
97 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 97 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
98 | 98 |
99 // Overridden from views::ContextMenuController. | 99 // Overridden from views::ContextMenuController. |
100 virtual void ShowContextMenuForView(View* source, | 100 virtual void ShowContextMenuForView(View* source, |
101 const gfx::Point& point) OVERRIDE; | 101 const gfx::Point& point, |
| 102 ui::MenuSourceType source_type) OVERRIDE; |
102 | 103 |
103 // ButtonListener implementation. | 104 // ButtonListener implementation. |
104 virtual void ButtonPressed(views::Button* sender, | 105 virtual void ButtonPressed(views::Button* sender, |
105 const ui::Event& event) OVERRIDE; | 106 const ui::Event& event) OVERRIDE; |
106 | 107 |
107 // ui::AnimationDelegate implementation. | 108 // ui::AnimationDelegate implementation. |
108 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; | 109 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
109 | 110 |
110 protected: | 111 protected: |
111 // Overridden from views::View: | 112 // Overridden from views::View: |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 bool BeginDownloadFeedback(); | 153 bool BeginDownloadFeedback(); |
153 | 154 |
154 void LoadIcon(); | 155 void LoadIcon(); |
155 void LoadIconIfItemPathChanged(); | 156 void LoadIconIfItemPathChanged(); |
156 | 157 |
157 // Update the button colors based on the current theme. | 158 // Update the button colors based on the current theme. |
158 void UpdateColorsFromTheme(); | 159 void UpdateColorsFromTheme(); |
159 | 160 |
160 // Shows the context menu at the specified location. |point| is in the view's | 161 // Shows the context menu at the specified location. |point| is in the view's |
161 // coordinate system. | 162 // coordinate system. |
162 void ShowContextMenuImpl(const gfx::Point& point, bool is_mouse_gesture); | 163 void ShowContextMenuImpl(const gfx::Point& point, |
| 164 ui::MenuSourceType source_type); |
163 | 165 |
164 // Common code for handling pointer events (i.e. mouse or gesture). | 166 // Common code for handling pointer events (i.e. mouse or gesture). |
165 void HandlePressEvent(const ui::LocatedEvent& event, bool active_event); | 167 void HandlePressEvent(const ui::LocatedEvent& event, bool active_event); |
166 void HandleClickEvent(const ui::LocatedEvent& event, bool active_event); | 168 void HandleClickEvent(const ui::LocatedEvent& event, bool active_event); |
167 | 169 |
168 // Convenience method to paint the 3 vertical images (bottom, middle, top) | 170 // Convenience method to paint the 3 vertical images (bottom, middle, top) |
169 // that form the background. | 171 // that form the background. |
170 void PaintImages(gfx::Canvas* canvas, | 172 void PaintImages(gfx::Canvas* canvas, |
171 const gfx::ImageSkia* top_image, | 173 const gfx::ImageSkia* top_image, |
172 const gfx::ImageSkia* center_image, | 174 const gfx::ImageSkia* center_image, |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 | 330 |
329 // The icon loaded in the download shelf is based on the file path of the | 331 // The icon loaded in the download shelf is based on the file path of the |
330 // item. Store the path used, so that we can detect a change in the path | 332 // item. Store the path used, so that we can detect a change in the path |
331 // and reload the icon. | 333 // and reload the icon. |
332 base::FilePath last_download_item_path_; | 334 base::FilePath last_download_item_path_; |
333 | 335 |
334 DISALLOW_COPY_AND_ASSIGN(DownloadItemView); | 336 DISALLOW_COPY_AND_ASSIGN(DownloadItemView); |
335 }; | 337 }; |
336 | 338 |
337 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_ITEM_VIEW_H__ | 339 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_ITEM_VIEW_H__ |
OLD | NEW |