OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // The intent of this file is to provide a type-neutral abstraction between | 5 // The intent of this file is to provide a type-neutral abstraction between |
6 // Chrome and WebKit for resource loading. This pure-virtual interface is | 6 // Chrome and WebKit for resource loading. This pure-virtual interface is |
7 // implemented by the embedder, which also provides a factory method Create | 7 // implemented by the embedder, which also provides a factory method Create |
8 // to instantiate this object. | 8 // to instantiate this object. |
9 // | 9 // |
10 // One of these objects will be created by WebKit for each request. WebKit | 10 // One of these objects will be created by WebKit for each request. WebKit |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // within webkit. The Peer and it's bridge should have identical lifetimes | 84 // within webkit. The Peer and it's bridge should have identical lifetimes |
85 // as they represent each end of a communication channel. | 85 // as they represent each end of a communication channel. |
86 // | 86 // |
87 // These callbacks mirror URLRequest::Delegate and the order and conditions | 87 // These callbacks mirror URLRequest::Delegate and the order and conditions |
88 // in which they will be called are identical. See url_request.h for more | 88 // in which they will be called are identical. See url_request.h for more |
89 // information. | 89 // information. |
90 class Peer { | 90 class Peer { |
91 public: | 91 public: |
92 virtual ~Peer() {} | 92 virtual ~Peer() {} |
93 | 93 |
| 94 // Called as download progress is made. |
| 95 // note: only for requests with LOAD_ENABLE_DOWNLOAD_FILE set and the |
| 96 // resource is downloaded to a standalone file and the file handle to it is |
| 97 // passed in ResponseInfo during OnReceivedResponse. Note that size may be |
| 98 // unknown and |size| will be kuint64max in that case. |
| 99 virtual void OnDownloadProgress(uint64 position, uint64 size) {} |
| 100 |
94 // Called as upload progress is made. | 101 // Called as upload progress is made. |
95 // note: only for requests with LOAD_ENABLE_UPLOAD_PROGRESS set | 102 // note: only for requests with LOAD_ENABLE_UPLOAD_PROGRESS set |
96 virtual void OnUploadProgress(uint64 position, uint64 size) = 0; | 103 virtual void OnUploadProgress(uint64 position, uint64 size) = 0; |
97 | 104 |
98 // Called when a redirect occurs. | 105 // Called when a redirect occurs. |
99 virtual void OnReceivedRedirect(const GURL& new_url) = 0; | 106 virtual void OnReceivedRedirect(const GURL& new_url) = 0; |
100 | 107 |
101 // Called when response headers are available (after all redirects have | 108 // Called when response headers are available (after all redirects have |
102 // been followed). |content_filtered| is set to true if the contents is | 109 // been followed). |content_filtered| is set to true if the contents is |
103 // altered or replaced (usually for security reasons when the resource is | 110 // altered or replaced (usually for security reasons when the resource is |
104 // deemed unsafe). | 111 // deemed unsafe). |
105 virtual void OnReceivedResponse(const ResponseInfo& info, | 112 virtual void OnReceivedResponse(const ResponseInfo& info, |
106 bool content_filtered) = 0; | 113 bool content_filtered) = 0; |
107 | 114 |
108 // Called when a chunk of response data is available. This method may | 115 // Called when a chunk of response data is available. This method may |
109 // be called multiple times or not at all if an error occurs. | 116 // be called multiple times or not at all if an error occurs. |
110 virtual void OnReceivedData(const char* data, int len) = 0; | 117 virtual void OnReceivedData(const char* data, int len) = 0; |
111 | 118 |
112 // Called when the response is complete. This method signals completion of | 119 // Called when the response is complete. This method signals completion of |
113 // the resource load.ff | 120 // the resource load.ff |
114 virtual void OnCompletedRequest(const URLRequestStatus& status, | 121 virtual void OnCompletedRequest(const URLRequestStatus& status, |
115 const std::string& security_info) = 0; | 122 const std::string& security_info) = 0; |
116 | 123 |
117 // Returns the URL of the request, which allows us to display it in | 124 // Returns the URL of the request, which allows us to display it in |
118 // debugging situations. | 125 // debugging situations. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 // construction must go through Create() | 210 // construction must go through Create() |
204 ResourceLoaderBridge(); | 211 ResourceLoaderBridge(); |
205 | 212 |
206 private: | 213 private: |
207 DISALLOW_EVIL_CONSTRUCTORS(ResourceLoaderBridge); | 214 DISALLOW_EVIL_CONSTRUCTORS(ResourceLoaderBridge); |
208 }; | 215 }; |
209 | 216 |
210 } // namespace webkit_glue | 217 } // namespace webkit_glue |
211 | 218 |
212 #endif // RESOURCE_LOADER_BRIDGE_ | 219 #endif // RESOURCE_LOADER_BRIDGE_ |
OLD | NEW |