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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 virtual bool OnResponseStarted(ResourceResponse* response, bool* defer) = 0; | 60 virtual bool OnResponseStarted(ResourceResponse* response, bool* defer) = 0; |
61 | 61 |
62 // Called before the net::URLRequest (whose url is |url|) is to be started. | 62 // Called before the net::URLRequest (whose url is |url|) is to be started. |
63 // If the handler returns false, then the request is cancelled. Otherwise if | 63 // If the handler returns false, then the request is cancelled. Otherwise if |
64 // the return value is true, the ResourceHandler can delay the request from | 64 // the return value is true, the ResourceHandler can delay the request from |
65 // starting by setting |*defer = true|. A deferred request will not have | 65 // starting by setting |*defer = true|. A deferred request will not have |
66 // called net::URLRequest::Start(), and will not resume until someone calls | 66 // called net::URLRequest::Start(), and will not resume until someone calls |
67 // ResourceDispatcherHost::StartDeferredRequest(). | 67 // ResourceDispatcherHost::StartDeferredRequest(). |
68 virtual bool OnWillStart(const GURL& url, bool* defer) = 0; | 68 virtual bool OnWillStart(const GURL& url, bool* defer) = 0; |
69 | 69 |
70 // Called before the net::URLRequest (whose url is |url|} uses the network for | |
71 // the first time to load the resource. If the handler returns false, then the | |
72 // request is cancelled. Otherwise if the return value is true, the | |
73 // ResourceHandler can delay the request from starting by setting |*defer = | |
74 // true|. Call controller()->Resume() to continue if deferred. | |
75 virtual bool OnBeforeNetworkStart(const GURL& url, bool* defer) = 0; | |
76 | |
77 // Data will be read for the response. Upon success, this method places the | 70 // Data will be read for the response. Upon success, this method places the |
78 // size and address of the buffer where the data is to be written in its | 71 // size and address of the buffer where the data is to be written in its |
79 // out-params. This call will be followed by either OnReadCompleted (on | 72 // out-params. This call will be followed by either OnReadCompleted (on |
80 // successful read or EOF) or OnResponseCompleted (on error). If | 73 // successful read or EOF) or OnResponseCompleted (on error). If |
81 // OnReadCompleted is called, the buffer may be recycled. Otherwise, it may | 74 // OnReadCompleted is called, the buffer may be recycled. Otherwise, it may |
82 // not be recycled and may potentially outlive the handler. If |min_size| is | 75 // not be recycled and may potentially outlive the handler. If |min_size| is |
83 // not -1, it is the minimum size of the returned buffer. | 76 // not -1, it is the minimum size of the returned buffer. |
84 // | 77 // |
85 // If the handler returns false, then the request is cancelled. Otherwise, | 78 // If the handler returns false, then the request is cancelled. Otherwise, |
86 // once data is available, OnReadCompleted will be called. | 79 // once data is available, OnReadCompleted will be called. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 ResourceMessageFilter* GetFilter() const; | 113 ResourceMessageFilter* GetFilter() const; |
121 | 114 |
122 private: | 115 private: |
123 ResourceController* controller_; | 116 ResourceController* controller_; |
124 net::URLRequest* request_; | 117 net::URLRequest* request_; |
125 }; | 118 }; |
126 | 119 |
127 } // namespace content | 120 } // namespace content |
128 | 121 |
129 #endif // CONTENT_BROWSER_LOADER_RESOURCE_HANDLER_H_ | 122 #endif // CONTENT_BROWSER_LOADER_RESOURCE_HANDLER_H_ |
OLD | NEW |