| 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 // 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. | 7 // implemented by the embedder. |
| 8 // | 8 // |
| 9 // One of these objects will be created by WebKit for each request. WebKit | 9 // One of these objects will be created by WebKit for each request. WebKit |
| 10 // will own the pointer to the bridge, and will delete it when the request is | 10 // will own the pointer to the bridge, and will delete it when the request is |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 | 270 |
| 271 // See the SyncLoad method declared below. (The name of this struct is not | 271 // See the SyncLoad method declared below. (The name of this struct is not |
| 272 // suffixed with "Info" because it also contains the response data.) | 272 // suffixed with "Info" because it also contains the response data.) |
| 273 struct SyncLoadResponse : ResourceResponseInfo { | 273 struct SyncLoadResponse : ResourceResponseInfo { |
| 274 SyncLoadResponse(); | 274 SyncLoadResponse(); |
| 275 ~SyncLoadResponse(); | 275 ~SyncLoadResponse(); |
| 276 | 276 |
| 277 // The response status. | 277 // The response status. |
| 278 net::URLRequestStatus status; | 278 net::URLRequestStatus status; |
| 279 | 279 |
| 280 // Was the request handled externally. |
| 281 bool handled_externally; |
| 282 |
| 280 // The final URL of the response. This may differ from the request URL in | 283 // The final URL of the response. This may differ from the request URL in |
| 281 // the case of a server redirect. | 284 // the case of a server redirect. |
| 282 GURL url; | 285 GURL url; |
| 283 | 286 |
| 284 // The response data. | 287 // The response data. |
| 285 std::string data; | 288 std::string data; |
| 286 }; | 289 }; |
| 287 | 290 |
| 288 // Generated by the bridge. This is implemented by our custom resource loader | 291 // Generated by the bridge. This is implemented by our custom resource loader |
| 289 // within webkit. The Peer and it's bridge should have identical lifetimes | 292 // within webkit. The Peer and it's bridge should have identical lifetimes |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 // gzipped content), or -1 if if unknown. | 330 // gzipped content), or -1 if if unknown. |
| 328 virtual void OnReceivedData(const char* data, | 331 virtual void OnReceivedData(const char* data, |
| 329 int data_length, | 332 int data_length, |
| 330 int encoded_data_length) = 0; | 333 int encoded_data_length) = 0; |
| 331 | 334 |
| 332 // Called when metadata generated by the renderer is retrieved from the | 335 // Called when metadata generated by the renderer is retrieved from the |
| 333 // cache. This method may be called zero or one times. | 336 // cache. This method may be called zero or one times. |
| 334 virtual void OnReceivedCachedMetadata(const char* data, int len) { } | 337 virtual void OnReceivedCachedMetadata(const char* data, int len) { } |
| 335 | 338 |
| 336 // Called when the response is complete. This method signals completion of | 339 // Called when the response is complete. This method signals completion of |
| 337 // the resource load.ff | 340 // the resource load. |
| 338 virtual void OnCompletedRequest( | 341 virtual void OnCompletedRequest( |
| 339 const net::URLRequestStatus& status, | 342 const net::URLRequestStatus& status, |
| 343 bool handled_externally, |
| 340 const std::string& security_info, | 344 const std::string& security_info, |
| 341 const base::TimeTicks& completion_time) = 0; | 345 const base::TimeTicks& completion_time) = 0; |
| 342 | 346 |
| 343 protected: | 347 protected: |
| 344 virtual ~Peer() {} | 348 virtual ~Peer() {} |
| 345 }; | 349 }; |
| 346 | 350 |
| 347 // use WebKitPlatformSupportImpl::CreateResourceLoader() for construction, but | 351 // use WebKitPlatformSupportImpl::CreateResourceLoader() for construction, but |
| 348 // anybody can delete at any time, INCLUDING during processing of callbacks. | 352 // anybody can delete at any time, INCLUDING during processing of callbacks. |
| 349 WEBKIT_GLUE_EXPORT virtual ~ResourceLoaderBridge(); | 353 WEBKIT_GLUE_EXPORT virtual ~ResourceLoaderBridge(); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 // methods may be called to construct the body of the request. | 409 // methods may be called to construct the body of the request. |
| 406 WEBKIT_GLUE_EXPORT ResourceLoaderBridge(); | 410 WEBKIT_GLUE_EXPORT ResourceLoaderBridge(); |
| 407 | 411 |
| 408 private: | 412 private: |
| 409 DISALLOW_COPY_AND_ASSIGN(ResourceLoaderBridge); | 413 DISALLOW_COPY_AND_ASSIGN(ResourceLoaderBridge); |
| 410 }; | 414 }; |
| 411 | 415 |
| 412 } // namespace webkit_glue | 416 } // namespace webkit_glue |
| 413 | 417 |
| 414 #endif // WEBKIT_GLUE_RESOURCE_LOADER_BRIDGE_H_ | 418 #endif // WEBKIT_GLUE_RESOURCE_LOADER_BRIDGE_H_ |
| OLD | NEW |