Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Side by Side Diff: chrome/browser/download/download_request_limiter.h

Issue 1964863002: Persist prompt/block download limiter state on renderer-initiated loads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding subframe limiter test Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/download/download_request_limiter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 99
100 // Number of "ALLOWED" downloads. 100 // Number of "ALLOWED" downloads.
101 void increment_download_count() { 101 void increment_download_count() {
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 DidStartNavigation(
110 const content::LoadCommittedDetails& details, 110 content::NavigationHandle* navigation_handle) override;
111 const content::FrameNavigateParams& params) override; 111 void DidFinishNavigation(
112 content::NavigationHandle* navigation_handle) override;
112 // Invoked when a user gesture occurs (mouse click, mouse scroll, tap, or 113 // Invoked when a user gesture occurs (mouse click, mouse scroll, tap, or
113 // key down). This may result in invoking Remove on DownloadRequestLimiter. 114 // key down). This may result in invoking Remove on DownloadRequestLimiter.
114 void DidGetUserInteraction(const blink::WebInputEvent::Type type) override; 115 void DidGetUserInteraction(const blink::WebInputEvent::Type type) override;
115 void WebContentsDestroyed() override; 116 void WebContentsDestroyed() override;
116 117
117 // Asks the user if they really want to allow the download. 118 // Asks the user if they really want to allow the download.
118 // See description above CanDownloadOnIOThread for details on lifetime of 119 // See description above CanDownloadOnIOThread for details on lifetime of
119 // callback. 120 // callback.
120 void PromptUserForDownload( 121 void PromptUserForDownload(
121 const DownloadRequestLimiter::Callback& callback); 122 const DownloadRequestLimiter::Callback& callback);
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 StateMap state_map_; 244 StateMap state_map_;
244 245
245 // Weak ptr factory used when |CanDownload| asks the delegate asynchronously 246 // Weak ptr factory used when |CanDownload| asks the delegate asynchronously
246 // about the download. 247 // about the download.
247 base::WeakPtrFactory<DownloadRequestLimiter> factory_; 248 base::WeakPtrFactory<DownloadRequestLimiter> factory_;
248 249
249 DISALLOW_COPY_AND_ASSIGN(DownloadRequestLimiter); 250 DISALLOW_COPY_AND_ASSIGN(DownloadRequestLimiter);
250 }; 251 };
251 252
252 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_LIMITER_H_ 253 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_REQUEST_LIMITER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/download/download_request_limiter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698