| 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 23 matching lines...) Expand all Loading... |
| 34 #include "third_party/WebKit/Source/Platform/chromium/public/WebReferrerPolicy.h
" | 34 #include "third_party/WebKit/Source/Platform/chromium/public/WebReferrerPolicy.h
" |
| 35 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques
t.h" | 35 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques
t.h" |
| 36 #include "webkit/glue/resource_type.h" | 36 #include "webkit/glue/resource_type.h" |
| 37 #include "webkit/glue/webkit_glue_export.h" | 37 #include "webkit/glue/webkit_glue_export.h" |
| 38 | 38 |
| 39 namespace net { | 39 namespace net { |
| 40 class HttpResponseHeaders; | 40 class HttpResponseHeaders; |
| 41 } | 41 } |
| 42 | 42 |
| 43 namespace webkit_glue { | 43 namespace webkit_glue { |
| 44 class ResourceRequestBody; |
| 44 | 45 |
| 45 // Structure containing timing information for the request. It addresses | 46 // Structure containing timing information for the request. It addresses |
| 46 // http://groups.google.com/group/http-archive-specification/web/har-1-1-spec | 47 // http://groups.google.com/group/http-archive-specification/web/har-1-1-spec |
| 47 // and http://dev.w3.org/2006/webapi/WebTiming/ needs. | 48 // and http://dev.w3.org/2006/webapi/WebTiming/ needs. |
| 48 // | 49 // |
| 49 // All the values for starts and ends are given in milliseconds and are | 50 // All the values for starts and ends are given in milliseconds and are |
| 50 // offsets with respect to the given base time. | 51 // offsets with respect to the given base time. |
| 51 struct ResourceLoadTimingInfo { | 52 struct ResourceLoadTimingInfo { |
| 52 WEBKIT_GLUE_EXPORT ResourceLoadTimingInfo(); | 53 WEBKIT_GLUE_EXPORT ResourceLoadTimingInfo(); |
| 53 WEBKIT_GLUE_EXPORT ~ResourceLoadTimingInfo(); | 54 WEBKIT_GLUE_EXPORT ~ResourceLoadTimingInfo(); |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 const base::TimeTicks& completion_time) = 0; | 342 const base::TimeTicks& completion_time) = 0; |
| 342 | 343 |
| 343 protected: | 344 protected: |
| 344 virtual ~Peer() {} | 345 virtual ~Peer() {} |
| 345 }; | 346 }; |
| 346 | 347 |
| 347 // use WebKitPlatformSupportImpl::CreateResourceLoader() for construction, but | 348 // use WebKitPlatformSupportImpl::CreateResourceLoader() for construction, but |
| 348 // anybody can delete at any time, INCLUDING during processing of callbacks. | 349 // anybody can delete at any time, INCLUDING during processing of callbacks. |
| 349 WEBKIT_GLUE_EXPORT virtual ~ResourceLoaderBridge(); | 350 WEBKIT_GLUE_EXPORT virtual ~ResourceLoaderBridge(); |
| 350 | 351 |
| 351 // Call this method before calling Start() to append a chunk of binary data | 352 // Call this method before calling Start() to set the request body. |
| 352 // to the request body. May only be used with HTTP(S) POST requests. | 353 // May only be used with HTTP(S) POST requests. |
| 353 virtual void AppendDataToUpload(const char* data, int data_len) = 0; | 354 virtual void SetRequestBody(ResourceRequestBody* request_body) = 0; |
| 354 | |
| 355 // Call this method before calling Start() to append the contents of a file | |
| 356 // to the request body. May only be used with HTTP(S) POST requests. | |
| 357 void AppendFileToUpload(const FilePath& file_path) { | |
| 358 AppendFileRangeToUpload(file_path, 0, kuint64max, base::Time()); | |
| 359 } | |
| 360 | |
| 361 // Call this method before calling Start() to append the contents of a file | |
| 362 // to the request body. May only be used with HTTP(S) POST requests. | |
| 363 virtual void AppendFileRangeToUpload( | |
| 364 const FilePath& file_path, | |
| 365 uint64 offset, | |
| 366 uint64 length, | |
| 367 const base::Time& expected_modification_time) = 0; | |
| 368 | |
| 369 // Call this method before calling Start() to append the contents of a blob | |
| 370 // to the request body. May only be used with HTTP(S) POST requests. | |
| 371 virtual void AppendBlobToUpload(const GURL& blob_url) = 0; | |
| 372 | |
| 373 // Call this method before calling Start() to assign an upload identifier to | |
| 374 // this request. This is used to enable caching of POST responses. A value | |
| 375 // of 0 implies the unspecified identifier. | |
| 376 virtual void SetUploadIdentifier(int64 identifier) = 0; | |
| 377 | 355 |
| 378 // Call this method to initiate the request. If this method succeeds, then | 356 // Call this method to initiate the request. If this method succeeds, then |
| 379 // the peer's methods will be called asynchronously to report various events. | 357 // the peer's methods will be called asynchronously to report various events. |
| 380 virtual bool Start(Peer* peer) = 0; | 358 virtual bool Start(Peer* peer) = 0; |
| 381 | 359 |
| 382 // Call this method to cancel a request that is in progress. This method | 360 // Call this method to cancel a request that is in progress. This method |
| 383 // causes the request to immediately transition into the 'done' state. The | 361 // causes the request to immediately transition into the 'done' state. The |
| 384 // OnCompletedRequest method will be called asynchronously; this assumes | 362 // OnCompletedRequest method will be called asynchronously; this assumes |
| 385 // the peer is still valid. | 363 // the peer is still valid. |
| 386 virtual void Cancel() = 0; | 364 virtual void Cancel() = 0; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 405 // methods may be called to construct the body of the request. | 383 // methods may be called to construct the body of the request. |
| 406 WEBKIT_GLUE_EXPORT ResourceLoaderBridge(); | 384 WEBKIT_GLUE_EXPORT ResourceLoaderBridge(); |
| 407 | 385 |
| 408 private: | 386 private: |
| 409 DISALLOW_COPY_AND_ASSIGN(ResourceLoaderBridge); | 387 DISALLOW_COPY_AND_ASSIGN(ResourceLoaderBridge); |
| 410 }; | 388 }; |
| 411 | 389 |
| 412 } // namespace webkit_glue | 390 } // namespace webkit_glue |
| 413 | 391 |
| 414 #endif // WEBKIT_GLUE_RESOURCE_LOADER_BRIDGE_H_ | 392 #endif // WEBKIT_GLUE_RESOURCE_LOADER_BRIDGE_H_ |
| OLD | NEW |