| 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 private: | 267 private: |
| 268 DISALLOW_COPY_AND_ASSIGN(RequestInfo); | 268 DISALLOW_COPY_AND_ASSIGN(RequestInfo); |
| 269 }; | 269 }; |
| 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 error code. |
| 278 net::URLRequestStatus status; | 278 int error_code; |
| 279 | 279 |
| 280 // The final URL of the response. This may differ from the request URL in | 280 // The final URL of the response. This may differ from the request URL in |
| 281 // the case of a server redirect. | 281 // the case of a server redirect. |
| 282 GURL url; | 282 GURL url; |
| 283 | 283 |
| 284 // The response data. | 284 // The response data. |
| 285 std::string data; | 285 std::string data; |
| 286 }; | 286 }; |
| 287 | 287 |
| 288 // Generated by the bridge. This is implemented by our custom resource loader | 288 // Generated by the bridge. This is implemented by our custom resource loader |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 // gzipped content), or -1 if if unknown. | 327 // gzipped content), or -1 if if unknown. |
| 328 virtual void OnReceivedData(const char* data, | 328 virtual void OnReceivedData(const char* data, |
| 329 int data_length, | 329 int data_length, |
| 330 int encoded_data_length) = 0; | 330 int encoded_data_length) = 0; |
| 331 | 331 |
| 332 // Called when metadata generated by the renderer is retrieved from the | 332 // Called when metadata generated by the renderer is retrieved from the |
| 333 // cache. This method may be called zero or one times. | 333 // cache. This method may be called zero or one times. |
| 334 virtual void OnReceivedCachedMetadata(const char* data, int len) { } | 334 virtual void OnReceivedCachedMetadata(const char* data, int len) { } |
| 335 | 335 |
| 336 // Called when the response is complete. This method signals completion of | 336 // Called when the response is complete. This method signals completion of |
| 337 // the resource load.ff | 337 // the resource load. |
| 338 virtual void OnCompletedRequest( | 338 virtual void OnCompletedRequest( |
| 339 const net::URLRequestStatus& status, | 339 int error_code, |
| 340 const std::string& security_info, | 340 const std::string& security_info, |
| 341 const base::TimeTicks& completion_time) = 0; | 341 const base::TimeTicks& completion_time) = 0; |
| 342 | 342 |
| 343 protected: | 343 protected: |
| 344 virtual ~Peer() {} | 344 virtual ~Peer() {} |
| 345 }; | 345 }; |
| 346 | 346 |
| 347 // use WebKitPlatformSupportImpl::CreateResourceLoader() for construction, but | 347 // use WebKitPlatformSupportImpl::CreateResourceLoader() for construction, but |
| 348 // anybody can delete at any time, INCLUDING during processing of callbacks. | 348 // anybody can delete at any time, INCLUDING during processing of callbacks. |
| 349 WEBKIT_GLUE_EXPORT virtual ~ResourceLoaderBridge(); | 349 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. | 405 // methods may be called to construct the body of the request. |
| 406 WEBKIT_GLUE_EXPORT ResourceLoaderBridge(); | 406 WEBKIT_GLUE_EXPORT ResourceLoaderBridge(); |
| 407 | 407 |
| 408 private: | 408 private: |
| 409 DISALLOW_COPY_AND_ASSIGN(ResourceLoaderBridge); | 409 DISALLOW_COPY_AND_ASSIGN(ResourceLoaderBridge); |
| 410 }; | 410 }; |
| 411 | 411 |
| 412 } // namespace webkit_glue | 412 } // namespace webkit_glue |
| 413 | 413 |
| 414 #endif // WEBKIT_GLUE_RESOURCE_LOADER_BRIDGE_H_ | 414 #endif // WEBKIT_GLUE_RESOURCE_LOADER_BRIDGE_H_ |
| OLD | NEW |