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

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

Issue 8680036: Move ResourceResponse struct into the Content API, since it's used in Chrome. While at it, I also... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: add gypi changes Created 9 years, 1 month 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 // 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
11 11
12 #ifndef CONTENT_BROWSER_RENDERER_HOST_RESOURCE_HANDLER_H_ 12 #ifndef CONTENT_BROWSER_RENDERER_HOST_RESOURCE_HANDLER_H_
13 #define CONTENT_BROWSER_RENDERER_HOST_RESOURCE_HANDLER_H_ 13 #define CONTENT_BROWSER_RENDERER_HOST_RESOURCE_HANDLER_H_
14 #pragma once 14 #pragma once
15 15
16 #include <string> 16 #include <string>
17 17
18 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
19 19
20 class GURL;
21
22 namespace content {
23 struct ResourceResponse;
24 }
25
20 namespace net { 26 namespace net {
21 class IOBuffer; 27 class IOBuffer;
22 class URLRequestStatus; 28 class URLRequestStatus;
23 } // namespace net 29 } // namespace net
24 30
25 struct ResourceResponse;
26 class GURL;
27
28 // The resource dispatcher host uses this interface to push load events to the 31 // The resource dispatcher host uses this interface to push load events to the
29 // renderer, allowing for differences in the types of IPC messages generated. 32 // renderer, allowing for differences in the types of IPC messages generated.
30 // See the implementations of this interface defined below. 33 // See the implementations of this interface defined below.
31 class ResourceHandler 34 class ResourceHandler
32 : public base::RefCountedThreadSafe< 35 : public base::RefCountedThreadSafe<
33 ResourceHandler, content::BrowserThread::DeleteOnIOThread> { 36 ResourceHandler, content::BrowserThread::DeleteOnIOThread> {
34 public: 37 public:
35 // Called as upload progress is made. 38 // Called as upload progress is made.
36 virtual bool OnUploadProgress(int request_id, 39 virtual bool OnUploadProgress(int request_id,
37 uint64 position, 40 uint64 position,
38 uint64 size) = 0; 41 uint64 size) = 0;
39 42
40 // The request was redirected to a new URL. |*defer| has an initial value of 43 // The request was redirected to a new URL. |*defer| has an initial value of
41 // false. Set |*defer| to true to defer the redirect. The redirect may be 44 // false. Set |*defer| to true to defer the redirect. The redirect may be
42 // followed later on via ResourceDispatcherHost::FollowDeferredRedirect. 45 // followed later on via ResourceDispatcherHost::FollowDeferredRedirect.
43 virtual bool OnRequestRedirected(int request_id, const GURL& url, 46 virtual bool OnRequestRedirected(int request_id, const GURL& url,
44 ResourceResponse* response, 47 content::ResourceResponse* response,
45 bool* defer) = 0; 48 bool* defer) = 0;
46 49
47 // Response headers and meta data are available. 50 // Response headers and meta data are available.
48 virtual bool OnResponseStarted(int request_id, 51 virtual bool OnResponseStarted(int request_id,
49 ResourceResponse* response) = 0; 52 content::ResourceResponse* response) = 0;
50 53
51 // Called before the net::URLRequest for |request_id| (whose url is |url|) is 54 // Called before the net::URLRequest for |request_id| (whose url is |url|) is
52 // to be started. If the handler returns false, then the request is cancelled. 55 // to be started. If the handler returns false, then the request is cancelled.
53 // Otherwise if the return value is true, the ResourceHandler can delay the 56 // Otherwise if the return value is true, the ResourceHandler can delay the
54 // request from starting by setting |*defer = true|. A deferred request will 57 // request from starting by setting |*defer = true|. A deferred request will
55 // not have called net::URLRequest::Start(), and will not resume until someone 58 // not have called net::URLRequest::Start(), and will not resume until someone
56 // calls ResourceDispatcherHost::StartDeferredRequest(). 59 // calls ResourceDispatcherHost::StartDeferredRequest().
57 virtual bool OnWillStart(int request_id, const GURL& url, bool* defer) = 0; 60 virtual bool OnWillStart(int request_id, const GURL& url, bool* defer) = 0;
58 61
59 // Data will be read for the response. Upon success, this method places the 62 // Data will be read for the response. Upon success, this method places the
(...skipping 27 matching lines...) Expand all
87 virtual void OnDataDownloaded(int request_id, int bytes_downloaded) {} 90 virtual void OnDataDownloaded(int request_id, int bytes_downloaded) {}
88 91
89 protected: 92 protected:
90 friend class content::BrowserThread; 93 friend class content::BrowserThread;
91 friend class DeleteTask<ResourceHandler>; 94 friend class DeleteTask<ResourceHandler>;
92 95
93 virtual ~ResourceHandler() {} 96 virtual ~ResourceHandler() {}
94 }; 97 };
95 98
96 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_HANDLER_H_ 99 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698