| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 download_count_++; | 102 download_count_++; |
| 103 } | 103 } |
| 104 size_t download_count() const { | 104 size_t download_count() const { |
| 105 return download_count_; | 105 return download_count_; |
| 106 } | 106 } |
| 107 | 107 |
| 108 // content::WebContentsObserver overrides. | 108 // content::WebContentsObserver overrides. |
| 109 void DidNavigateMainFrame( | 109 void DidNavigateMainFrame( |
| 110 const content::LoadCommittedDetails& details, | 110 const content::LoadCommittedDetails& details, |
| 111 const content::FrameNavigateParams& params) override; | 111 const content::FrameNavigateParams& params) override; |
| 112 // Invoked when a user gesture occurs (mouse click, enter or space). This | 112 // Invoked when a user gesture occurs (mouse click, mouse scroll, tap, or |
| 113 // may result in invoking Remove on DownloadRequestLimiter. | 113 // key down). This may result in invoking Remove on DownloadRequestLimiter. |
| 114 void DidGetUserGesture() override; | 114 void DidGetUserInteraction(const blink::WebInputEvent::Type type) override; |
| 115 void WebContentsDestroyed() override; | 115 void WebContentsDestroyed() override; |
| 116 | 116 |
| 117 // Asks the user if they really want to allow the download. | 117 // Asks the user if they really want to allow the download. |
| 118 // See description above CanDownloadOnIOThread for details on lifetime of | 118 // See description above CanDownloadOnIOThread for details on lifetime of |
| 119 // callback. | 119 // callback. |
| 120 void PromptUserForDownload( | 120 void PromptUserForDownload( |
| 121 const DownloadRequestLimiter::Callback& callback); | 121 const DownloadRequestLimiter::Callback& callback); |
| 122 | 122 |
| 123 // Invoked from DownloadRequestDialogDelegate. Notifies the delegates and | 123 // Invoked from DownloadRequestDialogDelegate. Notifies the delegates and |
| 124 // changes the status appropriately. Virtual for testing. | 124 // changes the status appropriately. Virtual for testing. |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 StateMap state_map_; | 243 StateMap state_map_; |
| 244 | 244 |
| 245 // Weak ptr factory used when |CanDownload| asks the delegate asynchronously | 245 // Weak ptr factory used when |CanDownload| asks the delegate asynchronously |
| 246 // about the download. | 246 // about the download. |
| 247 base::WeakPtrFactory<DownloadRequestLimiter> factory_; | 247 base::WeakPtrFactory<DownloadRequestLimiter> factory_; |
| 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 |