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_REQUEST_LIMITER_H_ | 5 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_LIMITER_H_ |
6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_LIMITER_H_ | 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_LIMITER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 // Are we showing a prompt to the user? | 118 // Are we showing a prompt to the user? |
119 bool is_showing_prompt() const { return (infobar_ != NULL); } | 119 bool is_showing_prompt() const { return (infobar_ != NULL); } |
120 | 120 |
121 // Invoked from DownloadRequestDialogDelegate. Notifies the delegates and | 121 // Invoked from DownloadRequestDialogDelegate. Notifies the delegates and |
122 // changes the status appropriately. Virtual for testing. | 122 // changes the status appropriately. Virtual for testing. |
123 virtual void Cancel(); | 123 virtual void Cancel(); |
124 virtual void Accept(); | 124 virtual void Accept(); |
125 | 125 |
126 protected: | 126 protected: |
127 // Used for testing. | 127 // Used for testing. |
128 TabDownloadState() | 128 TabDownloadState(); |
129 : host_(NULL), | |
130 status_(DownloadRequestLimiter::ALLOW_ONE_DOWNLOAD), | |
131 download_count_(0), | |
132 infobar_(NULL) { | |
133 } | |
134 | 129 |
135 private: | 130 private: |
136 // content::NotificationObserver method. | 131 // content::NotificationObserver method. |
137 virtual void Observe(int type, | 132 virtual void Observe(int type, |
138 const content::NotificationSource& source, | 133 const content::NotificationSource& source, |
139 const content::NotificationDetails& details) OVERRIDE; | 134 const content::NotificationDetails& details) OVERRIDE; |
140 | 135 |
141 // Notifies the callbacks as to whether the download is allowed or not. | 136 // Notifies the callbacks as to whether the download is allowed or not. |
142 // Updates status_ appropriately. | 137 // Updates status_ appropriately. |
143 void NotifyCallbacks(bool allow); | 138 void NotifyCallbacks(bool allow); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 // the TabDownloadState is removed and deleted (by way of Remove). | 235 // the TabDownloadState is removed and deleted (by way of Remove). |
241 typedef std::map<content::WebContents*, TabDownloadState*> StateMap; | 236 typedef std::map<content::WebContents*, TabDownloadState*> StateMap; |
242 StateMap state_map_; | 237 StateMap state_map_; |
243 | 238 |
244 static TestingDelegate* delegate_; | 239 static TestingDelegate* delegate_; |
245 | 240 |
246 DISALLOW_COPY_AND_ASSIGN(DownloadRequestLimiter); | 241 DISALLOW_COPY_AND_ASSIGN(DownloadRequestLimiter); |
247 }; | 242 }; |
248 | 243 |
249 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_LIMITER_H_ | 244 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_LIMITER_H_ |
OLD | NEW |