| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 |
| 11 // will own the pointer to the bridge, and will delete it when the request is | 11 // will own the pointer to the bridge, and will delete it when the request is |
| 12 // no longer needed. | 12 // no longer needed. |
| 13 // | 13 // |
| 14 // In turn, the bridge's owner on the WebKit end will implement the Peer | 14 // In turn, the bridge's owner on the WebKit end will implement the Peer |
| 15 // interface, which we will use to communicate notifications back. | 15 // interface, which we will use to communicate notifications back. |
| 16 | 16 |
| 17 #ifndef RESOURCE_LOADER_BRIDGE_H_ | 17 #ifndef RESOURCE_LOADER_BRIDGE_H_ |
| 18 #define RESOURCE_LOADER_BRIDGE_H_ | 18 #define RESOURCE_LOADER_BRIDGE_H_ |
| 19 | 19 |
| 20 #include "build/build_config.h" | 20 #include "build/build_config.h" |
| 21 #if defined(OS_POSIX) | 21 #if defined(OS_POSIX) |
| 22 #include "base/file_descriptor_posix.h" | 22 #include "base/file_descriptor_posix.h" |
| 23 #endif | 23 #endif |
| 24 #include "base/file_path.h" |
| 24 #include "base/platform_file.h" | 25 #include "base/platform_file.h" |
| 25 #include "base/ref_counted.h" | 26 #include "base/ref_counted.h" |
| 26 #include "base/time.h" | 27 #include "base/time.h" |
| 27 #include "googleurl/src/gurl.h" | 28 #include "googleurl/src/gurl.h" |
| 28 #include "net/url_request/url_request_status.h" | 29 #include "net/url_request/url_request_status.h" |
| 29 #include "webkit/glue/resource_type.h" | 30 #include "webkit/glue/resource_type.h" |
| 30 | 31 |
| 31 class WebFrame; | 32 class WebFrame; |
| 32 | 33 |
| 33 namespace net { | 34 namespace net { |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 int requestor_pid, | 186 int requestor_pid, |
| 186 ResourceType::Type request_type, | 187 ResourceType::Type request_type, |
| 187 int routing_id); | 188 int routing_id); |
| 188 | 189 |
| 189 // Call this method before calling Start() to append a chunk of binary data | 190 // Call this method before calling Start() to append a chunk of binary data |
| 190 // to the request body. May only be used with HTTP(S) POST requests. | 191 // to the request body. May only be used with HTTP(S) POST requests. |
| 191 virtual void AppendDataToUpload(const char* data, int data_len) = 0; | 192 virtual void AppendDataToUpload(const char* data, int data_len) = 0; |
| 192 | 193 |
| 193 // Call this method before calling Start() to append the contents of a file | 194 // Call this method before calling Start() to append the contents of a file |
| 194 // to the request body. May only be used with HTTP(S) POST requests. | 195 // to the request body. May only be used with HTTP(S) POST requests. |
| 195 void AppendFileToUpload(const std::wstring& file_path) { | 196 void AppendFileToUpload(const FilePath& file_path) { |
| 196 AppendFileRangeToUpload(file_path, 0, kuint64max); | 197 AppendFileRangeToUpload(file_path, 0, kuint64max); |
| 197 } | 198 } |
| 198 | 199 |
| 199 // Call this method before calling Start() to append the contents of a file | 200 // Call this method before calling Start() to append the contents of a file |
| 200 // to the request body. May only be used with HTTP(S) POST requests. | 201 // to the request body. May only be used with HTTP(S) POST requests. |
| 201 virtual void AppendFileRangeToUpload(const std::wstring& file_path, | 202 virtual void AppendFileRangeToUpload(const FilePath& file_path, |
| 202 uint64 offset, uint64 length) = 0; | 203 uint64 offset, uint64 length) = 0; |
| 203 | 204 |
| 204 // Call this method before calling Start() to assign an upload identifier to | 205 // Call this method before calling Start() to assign an upload identifier to |
| 205 // this request. This is used to enable caching of POST responses. A value | 206 // this request. This is used to enable caching of POST responses. A value |
| 206 // of 0 implies the unspecified identifier. | 207 // of 0 implies the unspecified identifier. |
| 207 virtual void SetUploadIdentifier(int64 identifier) = 0; | 208 virtual void SetUploadIdentifier(int64 identifier) = 0; |
| 208 | 209 |
| 209 // Call this method to initiate the request. If this method succeeds, then | 210 // Call this method to initiate the request. If this method succeeds, then |
| 210 // the peer's methods will be called asynchronously to report various events. | 211 // the peer's methods will be called asynchronously to report various events. |
| 211 virtual bool Start(Peer* peer) = 0; | 212 virtual bool Start(Peer* peer) = 0; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 233 // construction must go through Create() | 234 // construction must go through Create() |
| 234 ResourceLoaderBridge(); | 235 ResourceLoaderBridge(); |
| 235 | 236 |
| 236 private: | 237 private: |
| 237 DISALLOW_EVIL_CONSTRUCTORS(ResourceLoaderBridge); | 238 DISALLOW_EVIL_CONSTRUCTORS(ResourceLoaderBridge); |
| 238 }; | 239 }; |
| 239 | 240 |
| 240 } // namespace webkit_glue | 241 } // namespace webkit_glue |
| 241 | 242 |
| 242 #endif // RESOURCE_LOADER_BRIDGE_ | 243 #endif // RESOURCE_LOADER_BRIDGE_ |
| OLD | NEW |