| 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 12 matching lines...) Expand all Loading... |
| 23 #include "build/build_config.h" | 23 #include "build/build_config.h" |
| 24 #if defined(OS_POSIX) | 24 #if defined(OS_POSIX) |
| 25 #include "base/file_descriptor_posix.h" | 25 #include "base/file_descriptor_posix.h" |
| 26 #endif | 26 #endif |
| 27 #include "base/file_path.h" | 27 #include "base/file_path.h" |
| 28 #include "base/memory/ref_counted.h" | 28 #include "base/memory/ref_counted.h" |
| 29 #include "base/memory/scoped_ptr.h" | 29 #include "base/memory/scoped_ptr.h" |
| 30 #include "base/platform_file.h" | 30 #include "base/platform_file.h" |
| 31 #include "base/time.h" | 31 #include "base/time.h" |
| 32 #include "base/values.h" | 32 #include "base/values.h" |
| 33 #include "content/common/content_export.h" | |
| 34 #include "googleurl/src/gurl.h" | 33 #include "googleurl/src/gurl.h" |
| 35 #include "net/base/host_port_pair.h" | 34 #include "net/base/host_port_pair.h" |
| 36 #include "net/url_request/url_request_status.h" | 35 #include "net/url_request/url_request_status.h" |
| 37 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" | 36 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" |
| 38 #include "webkit/glue/resource_type.h" | 37 #include "webkit/glue/resource_type.h" |
| 39 | 38 |
| 40 namespace net { | 39 namespace net { |
| 41 class HttpResponseHeaders; | 40 class HttpResponseHeaders; |
| 42 } | 41 } |
| 43 | 42 |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 }; | 330 }; |
| 332 | 331 |
| 333 // use Create() for construction, but anybody can delete at any time, | 332 // use Create() for construction, but anybody can delete at any time, |
| 334 // INCLUDING during processing of callbacks. | 333 // INCLUDING during processing of callbacks. |
| 335 virtual ~ResourceLoaderBridge(); | 334 virtual ~ResourceLoaderBridge(); |
| 336 | 335 |
| 337 // Call this method to make a new instance. | 336 // Call this method to make a new instance. |
| 338 // | 337 // |
| 339 // For HTTP(S) POST requests, the AppendDataToUpload and AppendFileToUpload | 338 // For HTTP(S) POST requests, the AppendDataToUpload and AppendFileToUpload |
| 340 // methods may be called to construct the body of the request. | 339 // methods may be called to construct the body of the request. |
| 341 CONTENT_EXPORT static ResourceLoaderBridge* Create( | 340 static ResourceLoaderBridge* Create(const RequestInfo& request_info); |
| 342 const RequestInfo& request_info); | |
| 343 | 341 |
| 344 // Call this method before calling Start() to append a chunk of binary data | 342 // Call this method before calling Start() to append a chunk of binary data |
| 345 // to the request body. May only be used with HTTP(S) POST requests. | 343 // to the request body. May only be used with HTTP(S) POST requests. |
| 346 virtual void AppendDataToUpload(const char* data, int data_len) = 0; | 344 virtual void AppendDataToUpload(const char* data, int data_len) = 0; |
| 347 | 345 |
| 348 // Call this method before calling Start() to append the contents of a file | 346 // Call this method before calling Start() to append the contents of a file |
| 349 // to the request body. May only be used with HTTP(S) POST requests. | 347 // to the request body. May only be used with HTTP(S) POST requests. |
| 350 void AppendFileToUpload(const FilePath& file_path) { | 348 void AppendFileToUpload(const FilePath& file_path) { |
| 351 AppendFileRangeToUpload(file_path, 0, kuint64max, base::Time()); | 349 AppendFileRangeToUpload(file_path, 0, kuint64max, base::Time()); |
| 352 } | 350 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 // construction must go through Create() | 397 // construction must go through Create() |
| 400 ResourceLoaderBridge(); | 398 ResourceLoaderBridge(); |
| 401 | 399 |
| 402 private: | 400 private: |
| 403 DISALLOW_COPY_AND_ASSIGN(ResourceLoaderBridge); | 401 DISALLOW_COPY_AND_ASSIGN(ResourceLoaderBridge); |
| 404 }; | 402 }; |
| 405 | 403 |
| 406 } // namespace webkit_glue | 404 } // namespace webkit_glue |
| 407 | 405 |
| 408 #endif // WEBKIT_GLUE_RESOURCE_LOADER_BRIDGE_H_ | 406 #endif // WEBKIT_GLUE_RESOURCE_LOADER_BRIDGE_H_ |
| OLD | NEW |