| 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_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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 TabDownloadState() | 124 TabDownloadState() |
| 125 : host_(NULL), | 125 : host_(NULL), |
| 126 controller_(NULL), | 126 controller_(NULL), |
| 127 status_(DownloadRequestLimiter::ALLOW_ONE_DOWNLOAD), | 127 status_(DownloadRequestLimiter::ALLOW_ONE_DOWNLOAD), |
| 128 download_count_(0), | 128 download_count_(0), |
| 129 infobar_(NULL) { | 129 infobar_(NULL) { |
| 130 } | 130 } |
| 131 | 131 |
| 132 private: | 132 private: |
| 133 // NotificationObserver method. | 133 // NotificationObserver method. |
| 134 void Observe(NotificationType type, | 134 virtual void Observe(NotificationType type, |
| 135 const NotificationSource& source, | 135 const NotificationSource& source, |
| 136 const NotificationDetails& details); | 136 const NotificationDetails& details); |
| 137 | 137 |
| 138 // Notifies the callbacks as to whether the download is allowed or not. | 138 // Notifies the callbacks as to whether the download is allowed or not. |
| 139 // Updates status_ appropriately. | 139 // Updates status_ appropriately. |
| 140 void NotifyCallbacks(bool allow); | 140 void NotifyCallbacks(bool allow); |
| 141 | 141 |
| 142 DownloadRequestLimiter* host_; | 142 DownloadRequestLimiter* host_; |
| 143 | 143 |
| 144 NavigationController* controller_; | 144 NavigationController* controller_; |
| 145 | 145 |
| 146 // Host of the first page the download started on. This may be empty. | 146 // Host of the first page the download started on. This may be empty. |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 // the TabDownloadState is removed and deleted (by way of Remove). | 243 // the TabDownloadState is removed and deleted (by way of Remove). |
| 244 typedef std::map<NavigationController*, TabDownloadState*> StateMap; | 244 typedef std::map<NavigationController*, TabDownloadState*> StateMap; |
| 245 StateMap state_map_; | 245 StateMap state_map_; |
| 246 | 246 |
| 247 static TestingDelegate* delegate_; | 247 static TestingDelegate* delegate_; |
| 248 | 248 |
| 249 DISALLOW_COPY_AND_ASSIGN(DownloadRequestLimiter); | 249 DISALLOW_COPY_AND_ASSIGN(DownloadRequestLimiter); |
| 250 }; | 250 }; |
| 251 | 251 |
| 252 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_LIMITER_H_ | 252 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_LIMITER_H_ |
| OLD | NEW |