| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 bool* defer) = 0; | 66 bool* defer) = 0; |
| 67 | 67 |
| 68 // Called before the net::URLRequest for |request_id| (whose url is |url|) is | 68 // Called before the net::URLRequest for |request_id| (whose url is |url|) is |
| 69 // to be started. If the handler returns false, then the request is | 69 // to be started. If the handler returns false, then the request is |
| 70 // cancelled. Otherwise if the return value is true, the ResourceHandler can | 70 // cancelled. Otherwise if the return value is true, the ResourceHandler can |
| 71 // delay the request from starting by setting |*defer = true|. A deferred | 71 // delay the request from starting by setting |*defer = true|. A deferred |
| 72 // request will not have called net::URLRequest::Start(), and will not resume | 72 // request will not have called net::URLRequest::Start(), and will not resume |
| 73 // until someone calls ResourceDispatcherHost::StartDeferredRequest(). | 73 // until someone calls ResourceDispatcherHost::StartDeferredRequest(). |
| 74 virtual bool OnWillStart(int request_id, const GURL& url, bool* defer) = 0; | 74 virtual bool OnWillStart(int request_id, const GURL& url, bool* defer) = 0; |
| 75 | 75 |
| 76 // Called before the net::URLRequest for |request_id| (whose url is |url|} |
| 77 // uses the network for the first time to load the resource. If the handler |
| 78 // returns false, then the request is cancelled. Otherwise if the return value |
| 79 // is true, the ResourceHandler can delay the request from starting by setting |
| 80 // |*defer = true|. Call controller()->Resume() to continue if deferred. |
| 81 virtual bool OnBeforeNetworkStart(int request_id, |
| 82 const GURL& url, |
| 83 bool* defer) = 0; |
| 84 |
| 76 // Data will be read for the response. Upon success, this method places the | 85 // Data will be read for the response. Upon success, this method places the |
| 77 // size and address of the buffer where the data is to be written in its | 86 // size and address of the buffer where the data is to be written in its |
| 78 // out-params. This call will be followed by either OnReadCompleted or | 87 // out-params. This call will be followed by either OnReadCompleted or |
| 79 // OnResponseCompleted, at which point the buffer may be recycled. | 88 // OnResponseCompleted, at which point the buffer may be recycled. |
| 80 // | 89 // |
| 81 // If the handler returns false, then the request is cancelled. Otherwise, | 90 // If the handler returns false, then the request is cancelled. Otherwise, |
| 82 // once data is available, OnReadCompleted will be called. | 91 // once data is available, OnReadCompleted will be called. |
| 83 virtual bool OnWillRead(int request_id, | 92 virtual bool OnWillRead(int request_id, |
| 84 scoped_refptr<net::IOBuffer>* buf, | 93 scoped_refptr<net::IOBuffer>* buf, |
| 85 int* buf_size, | 94 int* buf_size, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 ResourceMessageFilter* GetFilter() const; | 127 ResourceMessageFilter* GetFilter() const; |
| 119 | 128 |
| 120 private: | 129 private: |
| 121 ResourceController* controller_; | 130 ResourceController* controller_; |
| 122 net::URLRequest* request_; | 131 net::URLRequest* request_; |
| 123 }; | 132 }; |
| 124 | 133 |
| 125 } // namespace content | 134 } // namespace content |
| 126 | 135 |
| 127 #endif // CONTENT_BROWSER_LOADER_RESOURCE_HANDLER_H_ | 136 #endif // CONTENT_BROWSER_LOADER_RESOURCE_HANDLER_H_ |
| OLD | NEW |