OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_DOWNLOAD_SHELF_VIEW_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_SHELF_VIEW_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_SHELF_VIEW_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_SHELF_VIEW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 public views::LinkListener, | 42 public views::LinkListener, |
43 public views::MouseWatcherListener { | 43 public views::MouseWatcherListener { |
44 public: | 44 public: |
45 DownloadShelfView(Browser* browser, BrowserView* parent); | 45 DownloadShelfView(Browser* browser, BrowserView* parent); |
46 virtual ~DownloadShelfView(); | 46 virtual ~DownloadShelfView(); |
47 | 47 |
48 // Sent from the DownloadItemView when the user opens an item. | 48 // Sent from the DownloadItemView when the user opens an item. |
49 void OpenedDownload(DownloadItemView* view); | 49 void OpenedDownload(DownloadItemView* view); |
50 | 50 |
51 // Implementation of View. | 51 // Implementation of View. |
52 virtual gfx::Size GetPreferredSize(); | 52 virtual gfx::Size GetPreferredSize() OVERRIDE; |
53 virtual void Layout(); | 53 virtual void Layout() OVERRIDE; |
54 virtual void OnPaint(gfx::Canvas* canvas); | 54 virtual void ViewHierarchyChanged(bool is_add, |
| 55 View* parent, |
| 56 View* child) OVERRIDE; |
| 57 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; |
55 | 58 |
56 // Implementation of ui::AnimationDelegate. | 59 // Implementation of ui::AnimationDelegate. |
57 virtual void AnimationProgressed(const ui::Animation* animation); | 60 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
58 virtual void AnimationEnded(const ui::Animation* animation); | 61 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; |
59 | 62 |
60 // Implementation of views::LinkListener. | 63 // Implementation of views::LinkListener. |
61 // Invoked when the user clicks the 'show all downloads' link button. | 64 // Invoked when the user clicks the 'show all downloads' link button. |
62 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; | 65 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; |
63 | 66 |
64 // Implementation of ButtonListener. | 67 // Implementation of ButtonListener. |
65 // Invoked when the user clicks the close button. Asks the browser to | 68 // Invoked when the user clicks the close button. Asks the browser to |
66 // hide the download shelf. | 69 // hide the download shelf. |
67 virtual void ButtonPressed(views::Button* button, const views::Event& event); | 70 virtual void ButtonPressed(views::Button* button, |
| 71 const views::Event& event) OVERRIDE; |
68 | 72 |
69 // Implementation of DownloadShelf. | 73 // Implementation of DownloadShelf. |
70 virtual void AddDownload(BaseDownloadItemModel* download_model); | 74 virtual void AddDownload(BaseDownloadItemModel* download_model) OVERRIDE; |
71 virtual bool IsShowing() const; | 75 virtual bool IsShowing() const OVERRIDE; |
72 virtual bool IsClosing() const; | 76 virtual bool IsClosing() const OVERRIDE; |
73 virtual void Show(); | 77 virtual void Show() OVERRIDE; |
74 virtual void Close(); | 78 virtual void Close() OVERRIDE; |
75 virtual Browser* browser() const; | 79 virtual Browser* browser() const OVERRIDE; |
76 | 80 |
77 // Implementation of MouseWatcherDelegate. | 81 // Implementation of MouseWatcherDelegate OVERRIDE. |
78 virtual void MouseMovedOutOfView(); | 82 virtual void MouseMovedOutOfView(); |
79 | 83 |
80 // Override views::FocusChangeListener method from AccessiblePaneView. | 84 // Override views::FocusChangeListener method from AccessiblePaneView. |
81 virtual void FocusWillChange(View* focused_before, | 85 virtual void FocusWillChange(View* focused_before, |
82 View* focused_now); | 86 View* focused_now) OVERRIDE; |
83 | 87 |
84 // Removes a specified download view. The supplied view is deleted after | 88 // Removes a specified download view. The supplied view is deleted after |
85 // it's removed. | 89 // it's removed. |
86 void RemoveDownloadView(views::View* view); | 90 void RemoveDownloadView(views::View* view); |
87 | 91 |
88 protected: | 92 protected: |
89 // From AccessiblePaneView | 93 // From AccessiblePaneView |
90 virtual views::View* GetDefaultFocusableChild(); | 94 virtual views::View* GetDefaultFocusableChild() OVERRIDE; |
91 | 95 |
92 private: | 96 private: |
93 void Init(); | 97 void Init(); |
94 | 98 |
95 // Adds a View representing a download to this DownloadShelfView. | 99 // Adds a View representing a download to this DownloadShelfView. |
96 // DownloadShelfView takes ownership of the View, and will delete it as | 100 // DownloadShelfView takes ownership of the View, and will delete it as |
97 // necessary. | 101 // necessary. |
98 void AddDownloadView(DownloadItemView* view); | 102 void AddDownloadView(DownloadItemView* view); |
99 | 103 |
100 // Paints the border. | 104 // Paints the border. |
101 virtual void OnPaintBorder(gfx::Canvas* canvas); | 105 virtual void OnPaintBorder(gfx::Canvas* canvas) OVERRIDE; |
102 | 106 |
103 // Returns true if the shelf is wide enough to show the first download item. | 107 // Returns true if the shelf is wide enough to show the first download item. |
104 bool CanFitFirstDownloadItem(); | 108 bool CanFitFirstDownloadItem(); |
105 | 109 |
106 // Called on theme change. | 110 // Called on theme change. |
107 void UpdateButtonColors(); | 111 void UpdateButtonColors(); |
108 | 112 |
109 // Overridden from views::View. | 113 // Overridden from views::View. |
110 virtual void OnThemeChanged(); | 114 virtual void OnThemeChanged(); |
111 | 115 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 155 |
152 // The window this shelf belongs to. | 156 // The window this shelf belongs to. |
153 BrowserView* parent_; | 157 BrowserView* parent_; |
154 | 158 |
155 views::MouseWatcher mouse_watcher_; | 159 views::MouseWatcher mouse_watcher_; |
156 | 160 |
157 DISALLOW_COPY_AND_ASSIGN(DownloadShelfView); | 161 DISALLOW_COPY_AND_ASSIGN(DownloadShelfView); |
158 }; | 162 }; |
159 | 163 |
160 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_SHELF_VIEW_H_ | 164 #endif // CHROME_BROWSER_UI_VIEWS_DOWNLOAD_DOWNLOAD_SHELF_VIEW_H_ |
OLD | NEW |