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

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

Issue 10409031: Fix crash when download from popup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
« 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 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 // CanDownloadOnIOThread invokes this on the UI thread. This determines the 217 // CanDownloadOnIOThread invokes this on the UI thread. This determines the
218 // tab and invokes CanDownloadImpl. 218 // tab and invokes CanDownloadImpl.
219 void CanDownload(int render_process_host_id, 219 void CanDownload(int render_process_host_id,
220 int render_view_id, 220 int render_view_id,
221 int request_id, 221 int request_id,
222 const std::string& request_method, 222 const std::string& request_method,
223 const Callback& callback); 223 const Callback& callback);
224 224
225 // Does the work of updating the download status on the UI thread and 225 // Does the work of updating the download status on the UI thread and
226 // potentially prompting the user. 226 // potentially prompting the user.
227 void CanDownloadImpl(TabContentsWrapper* originating_tab, 227 void CanDownloadImpl(content::WebContents* originating_contents,
228 int request_id, 228 int request_id,
229 const std::string& request_method, 229 const std::string& request_method,
230 const Callback& callback); 230 const Callback& callback);
231 231
232 // Invoked on the UI thread. Schedules a call to NotifyCallback on the io 232 // Invoked on the UI thread. Schedules a call to NotifyCallback on the io
233 // thread. 233 // thread.
234 void ScheduleNotification(const Callback& callback, bool allow); 234 void ScheduleNotification(const Callback& callback, bool allow);
235 235
236 // Removes the specified TabDownloadState from the internal map and deletes 236 // Removes the specified TabDownloadState from the internal map and deletes
237 // it. This has the effect of resetting the status for the tab to 237 // it. This has the effect of resetting the status for the tab to
238 // ALLOW_ONE_DOWNLOAD. 238 // ALLOW_ONE_DOWNLOAD.
239 void Remove(TabDownloadState* state); 239 void Remove(TabDownloadState* state);
240 240
241 // Maps from tab to download state. The download state for a tab only exists 241 // Maps from tab to download state. The download state for a tab only exists
242 // if the state is other than ALLOW_ONE_DOWNLOAD. Similarly once the state 242 // if the state is other than ALLOW_ONE_DOWNLOAD. Similarly once the state
243 // transitions from anything but ALLOW_ONE_DOWNLOAD back to ALLOW_ONE_DOWNLOAD 243 // transitions from anything but ALLOW_ONE_DOWNLOAD back to ALLOW_ONE_DOWNLOAD
244 // the TabDownloadState is removed and deleted (by way of Remove). 244 // the TabDownloadState is removed and deleted (by way of Remove).
245 typedef std::map<content::NavigationController*, TabDownloadState*> StateMap; 245 typedef std::map<content::NavigationController*, TabDownloadState*> StateMap;
246 StateMap state_map_; 246 StateMap state_map_;
247 247
248 static TestingDelegate* delegate_; 248 static TestingDelegate* delegate_;
249 249
250 DISALLOW_COPY_AND_ASSIGN(DownloadRequestLimiter); 250 DISALLOW_COPY_AND_ASSIGN(DownloadRequestLimiter);
251 }; 251 };
252 252
253 #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