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 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 virtual void OnResponseCompleted(const net::URLRequestStatus& status, | 101 virtual void OnResponseCompleted(const net::URLRequestStatus& status, |
102 const std::string& security_info, | 102 const std::string& security_info, |
103 bool* defer) = 0; | 103 bool* defer) = 0; |
104 | 104 |
105 // This notification is synthesized by the RedirectToFileResourceHandler | 105 // This notification is synthesized by the RedirectToFileResourceHandler |
106 // to indicate progress of 'download_to_file' requests. OnReadCompleted | 106 // to indicate progress of 'download_to_file' requests. OnReadCompleted |
107 // calls are consumed by the RedirectToFileResourceHandler and replaced | 107 // calls are consumed by the RedirectToFileResourceHandler and replaced |
108 // with OnDataDownloaded calls. | 108 // with OnDataDownloaded calls. |
109 virtual void OnDataDownloaded(int bytes_downloaded) = 0; | 109 virtual void OnDataDownloaded(int bytes_downloaded) = 0; |
110 | 110 |
| 111 // Whether this ResourceHandler is a leaf handler (ie the last handler in a |
| 112 // chain of handlers). |
| 113 virtual bool IsLeafHandler() const; |
| 114 |
| 115 // If this handler points to a leaf handler, replaces it with |new_handler| |
| 116 // while delivering |payload_for_old_handler| and simulating the end of the |
| 117 // request on the former leaf handler. |
| 118 // This should never be called on a leaf handler. |
| 119 virtual void InstallNewLeafHandler( |
| 120 std::unique_ptr<ResourceHandler> new_handler, |
| 121 const std::string& payload_for_old_handler); |
| 122 |
111 protected: | 123 protected: |
112 ResourceHandler(net::URLRequest* request); | 124 ResourceHandler(net::URLRequest* request); |
113 | 125 |
114 ResourceController* controller() const { return controller_; } | 126 ResourceController* controller() const { return controller_; } |
115 net::URLRequest* request() const { return request_; } | 127 net::URLRequest* request() const { return request_; } |
116 | 128 |
117 // Convenience functions. | 129 // Convenience functions. |
118 ResourceRequestInfoImpl* GetRequestInfo() const; | 130 ResourceRequestInfoImpl* GetRequestInfo() const; |
119 int GetRequestID() const; | 131 int GetRequestID() const; |
120 ResourceMessageFilter* GetFilter() const; | 132 ResourceMessageFilter* GetFilter() const; |
121 | 133 |
122 private: | 134 private: |
123 ResourceController* controller_; | 135 ResourceController* controller_; |
124 net::URLRequest* request_; | 136 net::URLRequest* request_; |
125 }; | 137 }; |
126 | 138 |
127 } // namespace content | 139 } // namespace content |
128 | 140 |
129 #endif // CONTENT_BROWSER_LOADER_RESOURCE_HANDLER_H_ | 141 #endif // CONTENT_BROWSER_LOADER_RESOURCE_HANDLER_H_ |
OLD | NEW |