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

Side by Side Diff: chrome/browser/renderer_host/download_throttling_resource_handler.h

Issue 6459005: Cancel prerender when we discover a download starting from a page we are prer... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Adding browser test Created 9 years, 10 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
OLDNEW
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_RENDERER_HOST_DOWNLOAD_THROTTLING_RESOURCE_HANDLER_H_ 5 #ifndef CHROME_BROWSER_RENDERER_HOST_DOWNLOAD_THROTTLING_RESOURCE_HANDLER_H_
6 #define CHROME_BROWSER_RENDERER_HOST_DOWNLOAD_THROTTLING_RESOURCE_HANDLER_H_ 6 #define CHROME_BROWSER_RENDERER_HOST_DOWNLOAD_THROTTLING_RESOURCE_HANDLER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "chrome/browser/download/download_request_limiter.h" 11 #include "chrome/browser/download/download_request_limiter.h"
12 #include "chrome/browser/renderer_host/resource_handler.h" 12 #include "chrome/browser/renderer_host/resource_handler.h"
13 #include "chrome/common/notification_type.h"
13 #include "googleurl/src/gurl.h" 14 #include "googleurl/src/gurl.h"
14 15
15 class DownloadResourceHandler; 16 class DownloadResourceHandler;
16 class ResourceDispatcherHost; 17 class ResourceDispatcherHost;
18 class ResourceRequestDetails;
17 19
18 namespace net { 20 namespace net {
19 class URLRequest; 21 class URLRequest;
20 } // namespace net 22 } // namespace net
21 23
22 // DownloadThrottlingResourceHandler is used to determine if a download should 24 // DownloadThrottlingResourceHandler is used to determine if a download should
23 // be allowed. When a DownloadThrottlingResourceHandler is created it pauses the 25 // be allowed. When a DownloadThrottlingResourceHandler is created it pauses the
24 // download and asks the DownloadRequestLimiter if the download should be 26 // download and asks the DownloadRequestLimiter if the download should be
25 // allowed. The DownloadRequestLimiter notifies us asynchronously as to whether 27 // allowed. The DownloadRequestLimiter notifies us asynchronously as to whether
26 // the download is allowed or not. If the download is allowed the request is 28 // the download is allowed or not. If the download is allowed the request is
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // DownloadRequestLimiter::Callback implementation: 60 // DownloadRequestLimiter::Callback implementation:
59 virtual void CancelDownload(); 61 virtual void CancelDownload();
60 virtual void ContinueDownload(); 62 virtual void ContinueDownload();
61 virtual int GetRequestId(); 63 virtual int GetRequestId();
62 64
63 private: 65 private:
64 virtual ~DownloadThrottlingResourceHandler(); 66 virtual ~DownloadThrottlingResourceHandler();
65 67
66 void CopyTmpBufferToDownloadHandler(); 68 void CopyTmpBufferToDownloadHandler();
67 69
70 ResourceRequestDetails* GetResourceRequestDetails();
71
72 template<NotificationType::Type T>
cbentzel 2011/02/09 12:11:14 Move this into .cc file and put in anonymous names
dominich 2011/02/09 22:33:30 I was following the pattern established in the Res
dominich 2011/02/09 22:33:30 Done.
73 static void NotifyOnUI(int process_id, int view_id,
74 ResourceRequestDetails* details);
75
68 ResourceDispatcherHost* host_; 76 ResourceDispatcherHost* host_;
69 net::URLRequest* request_; 77 net::URLRequest* request_;
70 GURL url_; 78 GURL url_;
71 int render_process_host_id_; 79 int render_process_host_id_;
72 int render_view_id_; 80 int render_view_id_;
73 int request_id_; 81 int request_id_;
74 82
75 // Handles the actual download. This is only created if the download is 83 // Handles the actual download. This is only created if the download is
76 // allowed to continue. 84 // allowed to continue.
77 scoped_refptr<DownloadResourceHandler> download_handler_; 85 scoped_refptr<DownloadResourceHandler> download_handler_;
(...skipping 10 matching lines...) Expand all
88 // If true the next call to OnReadCompleted is ignored. This is used if we're 96 // If true the next call to OnReadCompleted is ignored. This is used if we're
89 // paused during a call to OnReadCompleted. Pausing during OnReadCompleted 97 // paused during a call to OnReadCompleted. Pausing during OnReadCompleted
90 // results in two calls to OnReadCompleted for the same data. This make sure 98 // results in two calls to OnReadCompleted for the same data. This make sure
91 // we ignore one of them. 99 // we ignore one of them.
92 bool ignore_on_read_complete_; 100 bool ignore_on_read_complete_;
93 101
94 DISALLOW_COPY_AND_ASSIGN(DownloadThrottlingResourceHandler); 102 DISALLOW_COPY_AND_ASSIGN(DownloadThrottlingResourceHandler);
95 }; 103 };
96 104
97 #endif // CHROME_BROWSER_RENDERER_HOST_DOWNLOAD_THROTTLING_RESOURCE_HANDLER_H_ 105 #endif // CHROME_BROWSER_RENDERER_HOST_DOWNLOAD_THROTTLING_RESOURCE_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698