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

Side by Side Diff: content/browser/renderer_host/resource_handler.h

Issue 10501004: Refactor the guts of ResourceDispatcherHostImpl into a new class named (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 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) 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 // This is the browser side of the resource dispatcher, it receives requests 5 // This is the browser side of the resource dispatcher, it receives requests
6 // from the RenderProcessHosts, and dispatches them to URLRequests. It then 6 // from the RenderProcessHosts, and dispatches them to URLRequests. It then
7 // fowards the messages from the URLRequests back to the correct process for 7 // fowards the messages from the URLRequests back to the correct process for
8 // handling. 8 // handling.
9 // 9 //
10 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading 10 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
(...skipping 10 matching lines...) Expand all
21 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
22 22
23 class GURL; 23 class GURL;
24 24
25 namespace net { 25 namespace net {
26 class IOBuffer; 26 class IOBuffer;
27 class URLRequestStatus; 27 class URLRequestStatus;
28 } // namespace net 28 } // namespace net
29 29
30 namespace content { 30 namespace content {
31 class ResourceController;
31 struct ResourceResponse; 32 struct ResourceResponse;
32 33
33 // The resource dispatcher host uses this interface to process network events 34 // The resource dispatcher host uses this interface to process network events
34 // for an URLRequest instance. A ResourceHandler's lifetime is bound to its 35 // for an URLRequest instance. A ResourceHandler's lifetime is bound to its
35 // associated URLRequest. 36 // associated URLRequest.
36 class CONTENT_EXPORT ResourceHandler 37 class CONTENT_EXPORT ResourceHandler
37 : public NON_EXPORTED_BASE(base::NonThreadSafe) { 38 : public NON_EXPORTED_BASE(base::NonThreadSafe) {
38 public: 39 public:
39 virtual ~ResourceHandler() {} 40 virtual ~ResourceHandler() {}
40 41
42 // Sets the controller for this handler.
43 virtual void SetController(ResourceController* controller);
44
41 // Called as upload progress is made. The return value is ignored. 45 // Called as upload progress is made. The return value is ignored.
42 virtual bool OnUploadProgress(int request_id, 46 virtual bool OnUploadProgress(int request_id,
43 uint64 position, 47 uint64 position,
44 uint64 size) = 0; 48 uint64 size) = 0;
45 49
46 // The request was redirected to a new URL. |*defer| has an initial value of 50 // The request was redirected to a new URL. |*defer| has an initial value of
47 // false. Set |*defer| to true to defer the redirect. The redirect may be 51 // false. Set |*defer| to true to defer the redirect. The redirect may be
48 // followed later on via ResourceDispatcherHost::FollowDeferredRedirect. If 52 // followed later on via ResourceDispatcherHost::FollowDeferredRedirect. If
49 // the handler returns false, then the request is cancelled. 53 // the handler returns false, then the request is cancelled.
50 virtual bool OnRequestRedirected(int request_id, const GURL& url, 54 virtual bool OnRequestRedirected(int request_id, const GURL& url,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // the request will be destroyed upon return. 98 // the request will be destroyed upon return.
95 virtual bool OnResponseCompleted(int request_id, 99 virtual bool OnResponseCompleted(int request_id,
96 const net::URLRequestStatus& status, 100 const net::URLRequestStatus& status,
97 const std::string& security_info) = 0; 101 const std::string& security_info) = 0;
98 102
99 // This notification is synthesized by the RedirectToFileResourceHandler 103 // This notification is synthesized by the RedirectToFileResourceHandler
100 // to indicate progress of 'download_to_file' requests. OnReadCompleted 104 // to indicate progress of 'download_to_file' requests. OnReadCompleted
101 // calls are consumed by the RedirectToFileResourceHandler and replaced 105 // calls are consumed by the RedirectToFileResourceHandler and replaced
102 // with OnDataDownloaded calls. 106 // with OnDataDownloaded calls.
103 virtual void OnDataDownloaded(int request_id, int bytes_downloaded) {} 107 virtual void OnDataDownloaded(int request_id, int bytes_downloaded) {}
108
109 protected:
110 ResourceHandler() : controller_(NULL) {}
111 ResourceController* controller() { return controller_; }
112
113 private:
114 ResourceController* controller_;
104 }; 115 };
105 116
106 } // namespace content 117 } // namespace content
107 118
108 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_HANDLER_H_ 119 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698