| 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 12 matching lines...) Expand all Loading... |
| 23 #if defined(OS_POSIX) | 23 #if defined(OS_POSIX) |
| 24 #include "base/file_descriptor_posix.h" | 24 #include "base/file_descriptor_posix.h" |
| 25 #endif | 25 #endif |
| 26 #include "base/file_path.h" | 26 #include "base/file_path.h" |
| 27 #include "base/memory/ref_counted.h" | 27 #include "base/memory/ref_counted.h" |
| 28 #include "base/platform_file.h" | 28 #include "base/platform_file.h" |
| 29 #include "base/time.h" | 29 #include "base/time.h" |
| 30 #include "base/values.h" | 30 #include "base/values.h" |
| 31 #include "googleurl/src/gurl.h" | 31 #include "googleurl/src/gurl.h" |
| 32 #include "net/base/host_port_pair.h" | 32 #include "net/base/host_port_pair.h" |
| 33 #include "net/base/request_priority.h" |
| 33 #include "net/url_request/url_request_status.h" | 34 #include "net/url_request/url_request_status.h" |
| 34 #include "third_party/WebKit/Source/Platform/chromium/public/WebReferrerPolicy.h
" | 35 #include "third_party/WebKit/Source/Platform/chromium/public/WebReferrerPolicy.h
" |
| 35 #include "third_party/WebKit/Source/Platform/chromium/public/WebURLRequest.h" | 36 #include "third_party/WebKit/Source/Platform/chromium/public/WebURLRequest.h" |
| 36 #include "webkit/glue/resource_type.h" | 37 #include "webkit/glue/resource_type.h" |
| 37 #include "webkit/glue/webkit_glue_export.h" | 38 #include "webkit/glue/webkit_glue_export.h" |
| 38 | 39 |
| 39 namespace net { | 40 namespace net { |
| 40 class HttpResponseHeaders; | 41 class HttpResponseHeaders; |
| 41 } | 42 } |
| 42 | 43 |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 int load_flags; | 241 int load_flags; |
| 241 | 242 |
| 242 // Process id of the process making the request. | 243 // Process id of the process making the request. |
| 243 int requestor_pid; | 244 int requestor_pid; |
| 244 | 245 |
| 245 // Indicates if the current request is the main frame load, a sub-frame | 246 // Indicates if the current request is the main frame load, a sub-frame |
| 246 // load, or a sub objects load. | 247 // load, or a sub objects load. |
| 247 ResourceType::Type request_type; | 248 ResourceType::Type request_type; |
| 248 | 249 |
| 249 // Indicates the priority of this request, as determined by WebKit. | 250 // Indicates the priority of this request, as determined by WebKit. |
| 250 WebKit::WebURLRequest::Priority priority; | 251 net::RequestPriority priority; |
| 251 | 252 |
| 252 // Used for plugin to browser requests. | 253 // Used for plugin to browser requests. |
| 253 uint32 request_context; | 254 uint32 request_context; |
| 254 | 255 |
| 255 // Identifies what appcache host this request is associated with. | 256 // Identifies what appcache host this request is associated with. |
| 256 int appcache_host_id; | 257 int appcache_host_id; |
| 257 | 258 |
| 258 // Used to associated the bridge with a frame's network context. | 259 // Used to associated the bridge with a frame's network context. |
| 259 int routing_id; | 260 int routing_id; |
| 260 | 261 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 // Call this method to cancel a request that is in progress. This method | 365 // Call this method to cancel a request that is in progress. This method |
| 365 // causes the request to immediately transition into the 'done' state. The | 366 // causes the request to immediately transition into the 'done' state. The |
| 366 // OnCompletedRequest method will be called asynchronously; this assumes | 367 // OnCompletedRequest method will be called asynchronously; this assumes |
| 367 // the peer is still valid. | 368 // the peer is still valid. |
| 368 virtual void Cancel() = 0; | 369 virtual void Cancel() = 0; |
| 369 | 370 |
| 370 // Call this method to suspend or resume a load that is in progress. This | 371 // Call this method to suspend or resume a load that is in progress. This |
| 371 // method may only be called after a successful call to the Start method. | 372 // method may only be called after a successful call to the Start method. |
| 372 virtual void SetDefersLoading(bool value) = 0; | 373 virtual void SetDefersLoading(bool value) = 0; |
| 373 | 374 |
| 375 // Call this method when the priority of the requested resource changes after |
| 376 // Start() has been called. This method may only be called after a successful |
| 377 // call to the Start method. |
| 378 virtual void DidChangePriority(net::RequestPriority new_priority) = 0; |
| 379 |
| 374 // Call this method to load the resource synchronously (i.e., in one shot). | 380 // Call this method to load the resource synchronously (i.e., in one shot). |
| 375 // This is an alternative to the Start method. Be warned that this method | 381 // This is an alternative to the Start method. Be warned that this method |
| 376 // will block the calling thread until the resource is fully downloaded or an | 382 // will block the calling thread until the resource is fully downloaded or an |
| 377 // error occurs. It could block the calling thread for a long time, so only | 383 // error occurs. It could block the calling thread for a long time, so only |
| 378 // use this if you really need it! There is also no way for the caller to | 384 // use this if you really need it! There is also no way for the caller to |
| 379 // interrupt this method. Errors are reported via the status field of the | 385 // interrupt this method. Errors are reported via the status field of the |
| 380 // response parameter. | 386 // response parameter. |
| 381 virtual void SyncLoad(SyncLoadResponse* response) = 0; | 387 virtual void SyncLoad(SyncLoadResponse* response) = 0; |
| 382 | 388 |
| 383 protected: | 389 protected: |
| 384 // Construction must go through | 390 // Construction must go through |
| 385 // WebKitPlatformSupportImpl::CreateResourceLoader() | 391 // WebKitPlatformSupportImpl::CreateResourceLoader() |
| 386 // For HTTP(S) POST requests, the AppendDataToUpload and AppendFileToUpload | 392 // For HTTP(S) POST requests, the AppendDataToUpload and AppendFileToUpload |
| 387 // methods may be called to construct the body of the request. | 393 // methods may be called to construct the body of the request. |
| 388 WEBKIT_GLUE_EXPORT ResourceLoaderBridge(); | 394 WEBKIT_GLUE_EXPORT ResourceLoaderBridge(); |
| 389 | 395 |
| 390 private: | 396 private: |
| 391 DISALLOW_COPY_AND_ASSIGN(ResourceLoaderBridge); | 397 DISALLOW_COPY_AND_ASSIGN(ResourceLoaderBridge); |
| 392 }; | 398 }; |
| 393 | 399 |
| 394 } // namespace webkit_glue | 400 } // namespace webkit_glue |
| 395 | 401 |
| 396 #endif // WEBKIT_GLUE_RESOURCE_LOADER_BRIDGE_H_ | 402 #endif // WEBKIT_GLUE_RESOURCE_LOADER_BRIDGE_H_ |
| OLD | NEW |