OLD | NEW |
---|---|
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 |
11 | 11 |
12 #ifndef CONTENT_BROWSER_LOADER_RESOURCE_HANDLER_H_ | 12 #ifndef CONTENT_BROWSER_LOADER_RESOURCE_HANDLER_H_ |
13 #define CONTENT_BROWSER_LOADER_RESOURCE_HANDLER_H_ | 13 #define CONTENT_BROWSER_LOADER_RESOURCE_HANDLER_H_ |
14 | 14 |
15 #include <string> | 15 #include <string> |
16 | 16 |
17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
18 #include "base/sequenced_task_runner_helpers.h" | 18 #include "base/sequenced_task_runner_helpers.h" |
19 #include "base/threading/non_thread_safe.h" | 19 #include "base/threading/non_thread_safe.h" |
20 #include "content/common/content_export.h" | 20 #include "content/common/content_export.h" |
21 #include "net/base/net_errors.h" | |
21 | 22 |
22 class GURL; | 23 class GURL; |
23 | 24 |
24 namespace net { | 25 namespace net { |
25 class IOBuffer; | 26 class IOBuffer; |
26 class URLRequest; | 27 class URLRequest; |
27 class URLRequestStatus; | 28 class URLRequestStatus; |
28 struct RedirectInfo; | 29 struct RedirectInfo; |
29 } // namespace net | 30 } // namespace net |
30 | 31 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 // Call controller()->Resume() to continue reading response data. A zero | 88 // Call controller()->Resume() to continue reading response data. A zero |
88 // |bytes_read| signals that no further data is available. | 89 // |bytes_read| signals that no further data is available. |
89 virtual bool OnReadCompleted(int bytes_read, bool* defer) = 0; | 90 virtual bool OnReadCompleted(int bytes_read, bool* defer) = 0; |
90 | 91 |
91 // The response is complete. The final response status is given. Set | 92 // The response is complete. The final response status is given. Set |
92 // |*defer| to true to defer destruction to a later time. Otherwise, the | 93 // |*defer| to true to defer destruction to a later time. Otherwise, the |
93 // request will be destroyed upon return. | 94 // request will be destroyed upon return. |
94 virtual void OnResponseCompleted(const net::URLRequestStatus& status, | 95 virtual void OnResponseCompleted(const net::URLRequestStatus& status, |
95 bool* defer) = 0; | 96 bool* defer) = 0; |
96 | 97 |
98 // The request has been cancelled. Set |*defer| to true to defer cancellation | |
99 // to a later time. Otherwise, the request will be destroyed on return. | |
100 virtual void OnCancel(net::Error net_error, bool* defer); | |
mmenke
2016/11/07 15:59:25
I don't think this is supposed to be part of this
| |
101 | |
97 // This notification is synthesized by the RedirectToFileResourceHandler | 102 // This notification is synthesized by the RedirectToFileResourceHandler |
98 // to indicate progress of 'download_to_file' requests. OnReadCompleted | 103 // to indicate progress of 'download_to_file' requests. OnReadCompleted |
99 // calls are consumed by the RedirectToFileResourceHandler and replaced | 104 // calls are consumed by the RedirectToFileResourceHandler and replaced |
100 // with OnDataDownloaded calls. | 105 // with OnDataDownloaded calls. |
101 virtual void OnDataDownloaded(int bytes_downloaded) = 0; | 106 virtual void OnDataDownloaded(int bytes_downloaded) = 0; |
102 | 107 |
103 protected: | 108 protected: |
104 ResourceHandler(net::URLRequest* request); | 109 ResourceHandler(net::URLRequest* request); |
105 | 110 |
106 ResourceController* controller() const { return controller_; } | 111 ResourceController* controller() const { return controller_; } |
107 net::URLRequest* request() const { return request_; } | 112 net::URLRequest* request() const { return request_; } |
108 | 113 |
109 // Convenience functions. | 114 // Convenience functions. |
110 ResourceRequestInfoImpl* GetRequestInfo() const; | 115 ResourceRequestInfoImpl* GetRequestInfo() const; |
111 int GetRequestID() const; | 116 int GetRequestID() const; |
112 ResourceMessageFilter* GetFilter() const; | 117 ResourceMessageFilter* GetFilter() const; |
113 | 118 |
114 private: | 119 private: |
115 ResourceController* controller_; | 120 ResourceController* controller_; |
116 net::URLRequest* request_; | 121 net::URLRequest* request_; |
117 }; | 122 }; |
118 | 123 |
119 } // namespace content | 124 } // namespace content |
120 | 125 |
121 #endif // CONTENT_BROWSER_LOADER_RESOURCE_HANDLER_H_ | 126 #endif // CONTENT_BROWSER_LOADER_RESOURCE_HANDLER_H_ |
OLD | NEW |