| 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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| 289 // within webkit. The Peer and it's bridge should have identical lifetimes | 289 // within webkit. The Peer and it's bridge should have identical lifetimes |
| 290 // as they represent each end of a communication channel. | 290 // as they represent each end of a communication channel. |
| 291 // | 291 // |
| 292 // These callbacks mirror net::URLRequest::Delegate and the order and | 292 // These callbacks mirror net::URLRequest::Delegate and the order and |
| 293 // conditions in which they will be called are identical. See url_request.h | 293 // conditions in which they will be called are identical. See url_request.h |
| 294 // for more information. | 294 // for more information. |
| 295 class Peer { | 295 class Peer { |
| 296 public: | 296 public: |
| 297 virtual ~Peer() {} | |
| 298 | |
| 299 // Called as upload progress is made. | 297 // Called as upload progress is made. |
| 300 // note: only for requests with LOAD_ENABLE_UPLOAD_PROGRESS set | 298 // note: only for requests with LOAD_ENABLE_UPLOAD_PROGRESS set |
| 301 virtual void OnUploadProgress(uint64 position, uint64 size) = 0; | 299 virtual void OnUploadProgress(uint64 position, uint64 size) = 0; |
| 302 | 300 |
| 303 // Called when a redirect occurs. The implementation may return false to | 301 // Called when a redirect occurs. The implementation may return false to |
| 304 // suppress the redirect. The given ResponseInfo provides complete | 302 // suppress the redirect. The given ResponseInfo provides complete |
| 305 // information about the redirect, and new_url is the URL that will be | 303 // information about the redirect, and new_url is the URL that will be |
| 306 // loaded if this method returns true. If this method returns true, the | 304 // loaded if this method returns true. If this method returns true, the |
| 307 // output parameter *has_new_first_party_for_cookies indicates whether the | 305 // output parameter *has_new_first_party_for_cookies indicates whether the |
| 308 // output parameter *new_first_party_for_cookies contains the new URL that | 306 // output parameter *new_first_party_for_cookies contains the new URL that |
| (...skipping 25 matching lines...) Expand all Loading... |
| 334 // Called when metadata generated by the renderer is retrieved from the | 332 // Called when metadata generated by the renderer is retrieved from the |
| 335 // cache. This method may be called zero or one times. | 333 // cache. This method may be called zero or one times. |
| 336 virtual void OnReceivedCachedMetadata(const char* data, int len) { } | 334 virtual void OnReceivedCachedMetadata(const char* data, int len) { } |
| 337 | 335 |
| 338 // Called when the response is complete. This method signals completion of | 336 // Called when the response is complete. This method signals completion of |
| 339 // the resource load.ff | 337 // the resource load.ff |
| 340 virtual void OnCompletedRequest( | 338 virtual void OnCompletedRequest( |
| 341 const net::URLRequestStatus& status, | 339 const net::URLRequestStatus& status, |
| 342 const std::string& security_info, | 340 const std::string& security_info, |
| 343 const base::TimeTicks& completion_time) = 0; | 341 const base::TimeTicks& completion_time) = 0; |
| 342 |
| 343 protected: |
| 344 virtual ~Peer() {} |
| 344 }; | 345 }; |
| 345 | 346 |
| 346 // use WebKitPlatformSupportImpl::CreateResourceLoader() for construction, but | 347 // use WebKitPlatformSupportImpl::CreateResourceLoader() for construction, but |
| 347 // anybody can delete at any time, INCLUDING during processing of callbacks. | 348 // anybody can delete at any time, INCLUDING during processing of callbacks. |
| 348 WEBKIT_GLUE_EXPORT virtual ~ResourceLoaderBridge(); | 349 WEBKIT_GLUE_EXPORT virtual ~ResourceLoaderBridge(); |
| 349 | 350 |
| 350 // Call this method before calling Start() to append a chunk of binary data | 351 // Call this method before calling Start() to append a chunk of binary data |
| 351 // to the request body. May only be used with HTTP(S) POST requests. | 352 // to the request body. May only be used with HTTP(S) POST requests. |
| 352 virtual void AppendDataToUpload(const char* data, int data_len) = 0; | 353 virtual void AppendDataToUpload(const char* data, int data_len) = 0; |
| 353 | 354 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 // methods may be called to construct the body of the request. | 409 // methods may be called to construct the body of the request. |
| 409 WEBKIT_GLUE_EXPORT ResourceLoaderBridge(); | 410 WEBKIT_GLUE_EXPORT ResourceLoaderBridge(); |
| 410 | 411 |
| 411 private: | 412 private: |
| 412 DISALLOW_COPY_AND_ASSIGN(ResourceLoaderBridge); | 413 DISALLOW_COPY_AND_ASSIGN(ResourceLoaderBridge); |
| 413 }; | 414 }; |
| 414 | 415 |
| 415 } // namespace webkit_glue | 416 } // namespace webkit_glue |
| 416 | 417 |
| 417 #endif // WEBKIT_GLUE_RESOURCE_LOADER_BRIDGE_H_ | 418 #endif // WEBKIT_GLUE_RESOURCE_LOADER_BRIDGE_H_ |
| OLD | NEW |