OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_UI_VIEWS_DOWNLOAD_SHELF_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_DOWNLOAD_SHELF_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_DOWNLOAD_SHELF_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_DOWNLOAD_SHELF_VIEW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "app/animation_delegate.h" | |
10 #include "chrome/browser/download/download_shelf.h" | 9 #include "chrome/browser/download/download_shelf.h" |
11 #include "chrome/browser/views/accessible_pane_view.h" | 10 #include "chrome/browser/views/accessible_pane_view.h" |
| 11 #include "ui/base/animation/animation_delegate.h" |
12 #include "views/controls/button/button.h" | 12 #include "views/controls/button/button.h" |
13 #include "views/controls/link.h" | 13 #include "views/controls/link.h" |
14 #include "views/mouse_watcher.h" | 14 #include "views/mouse_watcher.h" |
15 | 15 |
16 namespace views { | |
17 class ImageButton; | |
18 class ImageView; | |
19 } | |
20 | |
21 class BaseDownloadItemModel; | 16 class BaseDownloadItemModel; |
22 class Browser; | 17 class Browser; |
23 class BrowserView; | 18 class BrowserView; |
24 class DownloadAnimation; | 19 class DownloadAnimation; |
25 class DownloadItemView; | 20 class DownloadItemView; |
| 21 |
| 22 namespace ui { |
26 class SlideAnimation; | 23 class SlideAnimation; |
| 24 } |
| 25 |
| 26 namespace views { |
| 27 class ImageButton; |
| 28 class ImageView; |
| 29 } |
27 | 30 |
28 // DownloadShelfView is a view that contains individual views for each download, | 31 // DownloadShelfView is a view that contains individual views for each download, |
29 // as well as a close button and a link to show all downloads. | 32 // as well as a close button and a link to show all downloads. |
30 // | 33 // |
31 // DownloadShelfView does not hold an infinite number of download views, rather | 34 // DownloadShelfView does not hold an infinite number of download views, rather |
32 // it'll automatically remove views once a certain point is reached. | 35 // it'll automatically remove views once a certain point is reached. |
33 class DownloadShelfView : public AccessiblePaneView, | 36 class DownloadShelfView : public AccessiblePaneView, |
34 public AnimationDelegate, | 37 public ui::AnimationDelegate, |
35 public DownloadShelf, | 38 public DownloadShelf, |
36 public views::ButtonListener, | 39 public views::ButtonListener, |
37 public views::LinkController, | 40 public views::LinkController, |
38 public views::MouseWatcherListener { | 41 public views::MouseWatcherListener { |
39 public: | 42 public: |
40 DownloadShelfView(Browser* browser, BrowserView* parent); | 43 DownloadShelfView(Browser* browser, BrowserView* parent); |
41 virtual ~DownloadShelfView(); | 44 virtual ~DownloadShelfView(); |
42 | 45 |
43 // Sent from the DownloadItemView when the user opens an item. | 46 // Sent from the DownloadItemView when the user opens an item. |
44 void OpenedDownload(DownloadItemView* view); | 47 void OpenedDownload(DownloadItemView* view); |
45 | 48 |
46 // Implementation of View. | 49 // Implementation of View. |
47 virtual gfx::Size GetPreferredSize(); | 50 virtual gfx::Size GetPreferredSize(); |
48 virtual void Layout(); | 51 virtual void Layout(); |
49 virtual void Paint(gfx::Canvas* canvas); | 52 virtual void Paint(gfx::Canvas* canvas); |
50 | 53 |
51 // Implementation of AnimationDelegate. | 54 // Implementation of ui::AnimationDelegate. |
52 virtual void AnimationProgressed(const Animation* animation); | 55 virtual void AnimationProgressed(const ui::Animation* animation); |
53 virtual void AnimationEnded(const Animation* animation); | 56 virtual void AnimationEnded(const ui::Animation* animation); |
54 | 57 |
55 // Implementation of LinkController. | 58 // Implementation of LinkController. |
56 // Invoked when the user clicks the 'show all downloads' link button. | 59 // Invoked when the user clicks the 'show all downloads' link button. |
57 virtual void LinkActivated(views::Link* source, int event_flags); | 60 virtual void LinkActivated(views::Link* source, int event_flags); |
58 | 61 |
59 // Implementation of ButtonListener. | 62 // Implementation of ButtonListener. |
60 // Invoked when the user clicks the close button. Asks the browser to | 63 // Invoked when the user clicks the close button. Asks the browser to |
61 // hide the download shelf. | 64 // hide the download shelf. |
62 virtual void ButtonPressed(views::Button* button, const views::Event& event); | 65 virtual void ButtonPressed(views::Button* button, const views::Event& event); |
63 | 66 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 void SchedulePaintForDownloadItem(views::View* view); | 120 void SchedulePaintForDownloadItem(views::View* view); |
118 | 121 |
119 // Get the rect that perfectly surrounds a DownloadItemView so we can | 122 // Get the rect that perfectly surrounds a DownloadItemView so we can |
120 // draw a focus rect around it. | 123 // draw a focus rect around it. |
121 gfx::Rect GetFocusRectBounds(const DownloadItemView* download_item_view); | 124 gfx::Rect GetFocusRectBounds(const DownloadItemView* download_item_view); |
122 | 125 |
123 // The browser for this shelf. | 126 // The browser for this shelf. |
124 Browser* browser_; | 127 Browser* browser_; |
125 | 128 |
126 // The animation for adding new items to the shelf. | 129 // The animation for adding new items to the shelf. |
127 scoped_ptr<SlideAnimation> new_item_animation_; | 130 scoped_ptr<ui::SlideAnimation> new_item_animation_; |
128 | 131 |
129 // The show/hide animation for the shelf itself. | 132 // The show/hide animation for the shelf itself. |
130 scoped_ptr<SlideAnimation> shelf_animation_; | 133 scoped_ptr<ui::SlideAnimation> shelf_animation_; |
131 | 134 |
132 // The download views. These are also child Views, and deleted when | 135 // The download views. These are also child Views, and deleted when |
133 // the DownloadShelfView is deleted. | 136 // the DownloadShelfView is deleted. |
134 std::vector<DownloadItemView*> download_views_; | 137 std::vector<DownloadItemView*> download_views_; |
135 | 138 |
136 // An image displayed on the right of the "Show all downloads..." link. | 139 // An image displayed on the right of the "Show all downloads..." link. |
137 views::ImageView* arrow_image_; | 140 views::ImageView* arrow_image_; |
138 | 141 |
139 // Link for showing all downloads. This is contained as a child, and deleted | 142 // Link for showing all downloads. This is contained as a child, and deleted |
140 // by View. | 143 // by View. |
141 views::Link* show_all_view_; | 144 views::Link* show_all_view_; |
142 | 145 |
143 // Button for closing the downloads. This is contained as a child, and | 146 // Button for closing the downloads. This is contained as a child, and |
144 // deleted by View. | 147 // deleted by View. |
145 views::ImageButton* close_button_; | 148 views::ImageButton* close_button_; |
146 | 149 |
147 // The window this shelf belongs to. | 150 // The window this shelf belongs to. |
148 BrowserView* parent_; | 151 BrowserView* parent_; |
149 | 152 |
150 views::MouseWatcher mouse_watcher_; | 153 views::MouseWatcher mouse_watcher_; |
151 | 154 |
152 DISALLOW_COPY_AND_ASSIGN(DownloadShelfView); | 155 DISALLOW_COPY_AND_ASSIGN(DownloadShelfView); |
153 }; | 156 }; |
154 | 157 |
155 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_SHELF_VIEW_H_ | 158 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_SHELF_VIEW_H_ |
OLD | NEW |