OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 // response's mime type. This may be a derived value. | 134 // response's mime type. This may be a derived value. |
135 std::string charset; | 135 std::string charset; |
136 | 136 |
137 // An opaque string carrying security information pertaining to this | 137 // An opaque string carrying security information pertaining to this |
138 // response. This may include information about the SSL connection used. | 138 // response. This may include information about the SSL connection used. |
139 std::string security_info; | 139 std::string security_info; |
140 | 140 |
141 // Content length if available. -1 if not available | 141 // Content length if available. -1 if not available |
142 int64 content_length; | 142 int64 content_length; |
143 | 143 |
| 144 // Length of the raw data transferred over the network. In case there is no |
| 145 // data, contains -1. |
| 146 int64 raw_data_length; |
| 147 |
144 // The appcache this response was loaded from, or kNoCacheId. | 148 // The appcache this response was loaded from, or kNoCacheId. |
145 int64 appcache_id; | 149 int64 appcache_id; |
146 | 150 |
147 // The manifest url of the appcache this response was loaded from. | 151 // The manifest url of the appcache this response was loaded from. |
148 // Note: this value is only populated for main resource requests. | 152 // Note: this value is only populated for main resource requests. |
149 GURL appcache_manifest_url; | 153 GURL appcache_manifest_url; |
150 | 154 |
151 // Connection identifier from the underlying network stack. In case there | 155 // Connection identifier from the underlying network stack. In case there |
152 // is no associated connection, contains 0. | 156 // is no associated connection, contains 0. |
153 uint32 connection_id; | 157 uint32 connection_id; |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 virtual void OnReceivedResponse(const ResourceResponseInfo& info) = 0; | 298 virtual void OnReceivedResponse(const ResourceResponseInfo& info) = 0; |
295 | 299 |
296 // Called when a chunk of response data is downloaded. This method may be | 300 // Called when a chunk of response data is downloaded. This method may be |
297 // called multiple times or not at all if an error occurs. This method is | 301 // called multiple times or not at all if an error occurs. This method is |
298 // only called if RequestInfo::download_to_file was set to true, and in | 302 // only called if RequestInfo::download_to_file was set to true, and in |
299 // that case, OnReceivedData will not be called. | 303 // that case, OnReceivedData will not be called. |
300 virtual void OnDownloadedData(int len) = 0; | 304 virtual void OnDownloadedData(int len) = 0; |
301 | 305 |
302 // Called when a chunk of response data is available. This method may | 306 // Called when a chunk of response data is available. This method may |
303 // be called multiple times or not at all if an error occurs. | 307 // be called multiple times or not at all if an error occurs. |
304 virtual void OnReceivedData(const char* data, int len) = 0; | 308 // The raw_data_length is the length of the raw data transferred over the |
| 309 // network, which could be different from data length (e.g. for gzipped |
| 310 // content), or -1 if if unknown. |
| 311 virtual void OnReceivedData(const char* data, |
| 312 int data_length, |
| 313 int raw_data_length) = 0; |
305 | 314 |
306 // Called when metadata generated by the renderer is retrieved from the | 315 // Called when metadata generated by the renderer is retrieved from the |
307 // cache. This method may be called zero or one times. | 316 // cache. This method may be called zero or one times. |
308 virtual void OnReceivedCachedMetadata(const char* data, int len) { } | 317 virtual void OnReceivedCachedMetadata(const char* data, int len) { } |
309 | 318 |
310 // Called when the response is complete. This method signals completion of | 319 // Called when the response is complete. This method signals completion of |
311 // the resource load.ff | 320 // the resource load.ff |
312 virtual void OnCompletedRequest(const net::URLRequestStatus& status, | 321 virtual void OnCompletedRequest(const net::URLRequestStatus& status, |
313 const std::string& security_info, | 322 const std::string& security_info, |
314 const base::Time& completion_time) = 0; | 323 const base::Time& completion_time) = 0; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 // construction must go through Create() | 387 // construction must go through Create() |
379 ResourceLoaderBridge(); | 388 ResourceLoaderBridge(); |
380 | 389 |
381 private: | 390 private: |
382 DISALLOW_COPY_AND_ASSIGN(ResourceLoaderBridge); | 391 DISALLOW_COPY_AND_ASSIGN(ResourceLoaderBridge); |
383 }; | 392 }; |
384 | 393 |
385 } // namespace webkit_glue | 394 } // namespace webkit_glue |
386 | 395 |
387 #endif // WEBKIT_GLUE_RESOURCE_LOADER_BRIDGE_H_ | 396 #endif // WEBKIT_GLUE_RESOURCE_LOADER_BRIDGE_H_ |
OLD | NEW |