| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 content::WebContents* web_contents() const { | 105 content::WebContents* web_contents() const { |
| 106 return content::WebContentsObserver::web_contents(); | 106 return content::WebContentsObserver::web_contents(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 // content::WebContentsObserver overrides. | 109 // content::WebContentsObserver overrides. |
| 110 virtual void AboutToNavigateRenderView( | 110 virtual void AboutToNavigateRenderView( |
| 111 content::RenderViewHost* render_view_host) OVERRIDE; | 111 content::RenderViewHost* render_view_host) OVERRIDE; |
| 112 // Invoked when a user gesture occurs (mouse click, enter or space). This | 112 // Invoked when a user gesture occurs (mouse click, enter or space). This |
| 113 // may result in invoking Remove on DownloadRequestLimiter. | 113 // may result in invoking Remove on DownloadRequestLimiter. |
| 114 virtual void DidGetUserGesture() OVERRIDE; | 114 virtual void DidGetUserGesture() OVERRIDE; |
| 115 virtual void WebContentsDestroyed( | 115 virtual void WebContentsDestroyed() OVERRIDE; |
| 116 content::WebContents* web_contents) OVERRIDE; | |
| 117 | 116 |
| 118 // Asks the user if they really want to allow the download. | 117 // Asks the user if they really want to allow the download. |
| 119 // See description above CanDownloadOnIOThread for details on lifetime of | 118 // See description above CanDownloadOnIOThread for details on lifetime of |
| 120 // callback. | 119 // callback. |
| 121 void PromptUserForDownload( | 120 void PromptUserForDownload( |
| 122 const DownloadRequestLimiter::Callback& callback); | 121 const DownloadRequestLimiter::Callback& callback); |
| 123 | 122 |
| 124 // Invoked from DownloadRequestDialogDelegate. Notifies the delegates and | 123 // Invoked from DownloadRequestDialogDelegate. Notifies the delegates and |
| 125 // changes the status appropriately. Virtual for testing. | 124 // changes the status appropriately. Virtual for testing. |
| 126 virtual void Cancel(); | 125 virtual void Cancel(); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 StateMap state_map_; | 257 StateMap state_map_; |
| 259 | 258 |
| 260 // Weak ptr factory used when |CanDownload| asks the delegate asynchronously | 259 // Weak ptr factory used when |CanDownload| asks the delegate asynchronously |
| 261 // about the download. | 260 // about the download. |
| 262 base::WeakPtrFactory<DownloadRequestLimiter> factory_; | 261 base::WeakPtrFactory<DownloadRequestLimiter> factory_; |
| 263 | 262 |
| 264 DISALLOW_COPY_AND_ASSIGN(DownloadRequestLimiter); | 263 DISALLOW_COPY_AND_ASSIGN(DownloadRequestLimiter); |
| 265 }; | 264 }; |
| 266 | 265 |
| 267 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_LIMITER_H_ | 266 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_LIMITER_H_ |
| OLD | NEW |