| 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_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 virtual void Observe(NotificationType type, | 134 virtual void Observe(int 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_; |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 // the TabDownloadState is removed and deleted (by way of Remove). | 246 // the TabDownloadState is removed and deleted (by way of Remove). |
| 247 typedef std::map<NavigationController*, TabDownloadState*> StateMap; | 247 typedef std::map<NavigationController*, TabDownloadState*> StateMap; |
| 248 StateMap state_map_; | 248 StateMap state_map_; |
| 249 | 249 |
| 250 static TestingDelegate* delegate_; | 250 static TestingDelegate* delegate_; |
| 251 | 251 |
| 252 DISALLOW_COPY_AND_ASSIGN(DownloadRequestLimiter); | 252 DISALLOW_COPY_AND_ASSIGN(DownloadRequestLimiter); |
| 253 }; | 253 }; |
| 254 | 254 |
| 255 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_LIMITER_H_ | 255 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_LIMITER_H_ |
| OLD | NEW |