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 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SHELF_H_ | 5 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SHELF_H_ |
6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SHELF_H_ | 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SHELF_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 // The browser view needs to know when we are going away to properly return | 88 // The browser view needs to know when we are going away to properly return |
89 // the resize corner size to WebKit so that we don't draw on top of it. | 89 // the resize corner size to WebKit so that we don't draw on top of it. |
90 // This returns the showing state of our animation which is set to true at | 90 // This returns the showing state of our animation which is set to true at |
91 // the beginning Show and false at the beginning of a Hide. | 91 // the beginning Show and false at the beginning of a Hide. |
92 virtual bool IsShowing() const = 0; | 92 virtual bool IsShowing() const = 0; |
93 | 93 |
94 // Returns whether the download shelf is showing the close animation. | 94 // Returns whether the download shelf is showing the close animation. |
95 virtual bool IsClosing() const = 0; | 95 virtual bool IsClosing() const = 0; |
96 | 96 |
97 // Opens the shelf. | 97 // Opens the shelf. |
98 void Show(); | 98 void Open(); |
99 | 99 |
100 // Closes the shelf. | 100 // Closes the shelf. |
101 void Close(CloseReason reason); | 101 void Close(CloseReason reason); |
102 | 102 |
103 // Hides the shelf. This closes the shelf if it is currently showing. | 103 // Hides the shelf. This closes the shelf if it is currently showing. |
104 void Hide(); | 104 void Hide(); |
105 | 105 |
106 // Unhides the shelf. This will cause the shelf to be opened if it was open | 106 // Unhides the shelf. This will cause the shelf to be opened if it was open |
107 // when it was hidden, or was shown while it was hidden. | 107 // when it was hidden, or was shown while it was hidden. |
108 void Unhide(); | 108 void Unhide(); |
109 | 109 |
110 virtual Browser* browser() const = 0; | 110 virtual Browser* browser() const = 0; |
111 | 111 |
112 // Returns whether the download shelf is hidden. | 112 // Returns whether the download shelf is hidden. |
113 bool is_hidden() { return is_hidden_; } | 113 bool is_hidden() { return is_hidden_; } |
114 | 114 |
115 protected: | 115 protected: |
116 virtual void DoAddDownload(content::DownloadItem* download) = 0; | 116 virtual void DoAddDownload(content::DownloadItem* download) = 0; |
117 virtual void DoShow() = 0; | 117 virtual void DoOpen() = 0; |
118 virtual void DoClose(CloseReason reason) = 0; | 118 virtual void DoClose(CloseReason reason) = 0; |
| 119 virtual void DoHide() = 0; |
| 120 virtual void DoUnhide() = 0; |
119 | 121 |
120 // Time delay to wait before adding a transient download to the shelf. | 122 // Time delay to wait before adding a transient download to the shelf. |
121 // Protected virtual for testing. | 123 // Protected virtual for testing. |
122 virtual base::TimeDelta GetTransientDownloadShowDelay(); | 124 virtual base::TimeDelta GetTransientDownloadShowDelay(); |
123 | 125 |
124 // Returns the DownloadManager associated with this DownloadShelf. All | 126 // Returns the DownloadManager associated with this DownloadShelf. All |
125 // downloads that are shown on this shelf is expected to belong to this | 127 // downloads that are shown on this shelf is expected to belong to this |
126 // DownloadManager. Protected virtual for testing. | 128 // DownloadManager. Protected virtual for testing. |
127 virtual content::DownloadManager* GetDownloadManager(); | 129 virtual content::DownloadManager* GetDownloadManager(); |
128 | 130 |
129 private: | 131 private: |
130 // Show the download on the shelf immediately. Also displayes the download | 132 // Show the download on the shelf immediately. Also displayes the download |
131 // started animation if necessary. | 133 // started animation if necessary. |
132 void ShowDownload(content::DownloadItem* download); | 134 void ShowDownload(content::DownloadItem* download); |
133 | 135 |
134 // Similar to ShowDownload() but refers to the download using an ID. This | 136 // Similar to ShowDownload() but refers to the download using an ID. This |
135 // download should belong to the DownloadManager returned by | 137 // download should belong to the DownloadManager returned by |
136 // GetDownloadManager(). | 138 // GetDownloadManager(). |
137 void ShowDownloadById(int32_t download_id); | 139 void ShowDownloadById(int32_t download_id); |
138 | 140 |
139 bool should_show_on_unhide_; | 141 bool should_show_on_unhide_; |
140 bool is_hidden_; | 142 bool is_hidden_; |
141 base::WeakPtrFactory<DownloadShelf> weak_ptr_factory_; | 143 base::WeakPtrFactory<DownloadShelf> weak_ptr_factory_; |
142 }; | 144 }; |
143 | 145 |
144 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SHELF_H_ | 146 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_SHELF_H_ |
OLD | NEW |