| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 |
| 11 // no longer needed. | 11 // no longer needed. |
| 12 // | 12 // |
| 13 // In turn, the bridge's owner on the WebKit end will implement the | 13 // In turn, the bridge's owner on the WebKit end will implement the |
| 14 // RequestPeer interface, which we will use to communicate notifications | 14 // RequestPeer interface, which we will use to communicate notifications |
| 15 // back. | 15 // back. |
| 16 | 16 |
| 17 #ifndef WEBKIT_CHILD_RESOURCE_LOADER_BRIDGE_H_ | 17 #ifndef WEBKIT_CHILD_RESOURCE_LOADER_BRIDGE_H_ |
| 18 #define WEBKIT_CHILD_RESOURCE_LOADER_BRIDGE_H_ | 18 #define WEBKIT_CHILD_RESOURCE_LOADER_BRIDGE_H_ |
| 19 | 19 |
| 20 #include "base/macros.h" | 20 #include "base/macros.h" |
| 21 #include "net/base/request_priority.h" | 21 #include "net/base/request_priority.h" |
| 22 #include "webkit/child/webkit_child_export.h" | 22 #include "webkit/child/webkit_child_export.h" |
| 23 | 23 |
| 24 namespace blink { |
| 25 class WebThreadedDataReceiver; |
| 26 } |
| 27 |
| 24 // TODO(pilgrim) remove this once resource loader is moved to content | 28 // TODO(pilgrim) remove this once resource loader is moved to content |
| 25 // http://crbug.com/338338 | 29 // http://crbug.com/338338 |
| 26 namespace content { | 30 namespace content { |
| 27 class RequestPeer; | 31 class RequestPeer; |
| 28 class ResourceRequestBody; | 32 class ResourceRequestBody; |
| 29 struct SyncLoadResponse; | 33 struct SyncLoadResponse; |
| 30 } | 34 } |
| 31 | 35 |
| 32 namespace webkit_glue { | 36 namespace webkit_glue { |
| 33 | 37 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 54 // Call this method to suspend or resume a load that is in progress. This | 58 // Call this method to suspend or resume a load that is in progress. This |
| 55 // method may only be called after a successful call to the Start method. | 59 // method may only be called after a successful call to the Start method. |
| 56 virtual void SetDefersLoading(bool value) = 0; | 60 virtual void SetDefersLoading(bool value) = 0; |
| 57 | 61 |
| 58 // Call this method when the priority of the requested resource changes after | 62 // Call this method when the priority of the requested resource changes after |
| 59 // Start() has been called. This method may only be called after a successful | 63 // Start() has been called. This method may only be called after a successful |
| 60 // call to the Start method. | 64 // call to the Start method. |
| 61 virtual void DidChangePriority(net::RequestPriority new_priority, | 65 virtual void DidChangePriority(net::RequestPriority new_priority, |
| 62 int intra_priority_value) = 0; | 66 int intra_priority_value) = 0; |
| 63 | 67 |
| 68 // Call this method to attach a data receiver which will receive resource data |
| 69 // on its own thread. |
| 70 virtual bool AttachThreadedDataReceiver( |
| 71 blink::WebThreadedDataReceiver* threaded_data_receiver) = 0; |
| 72 |
| 64 // Call this method to load the resource synchronously (i.e., in one shot). | 73 // Call this method to load the resource synchronously (i.e., in one shot). |
| 65 // This is an alternative to the Start method. Be warned that this method | 74 // This is an alternative to the Start method. Be warned that this method |
| 66 // will block the calling thread until the resource is fully downloaded or an | 75 // will block the calling thread until the resource is fully downloaded or an |
| 67 // error occurs. It could block the calling thread for a long time, so only | 76 // error occurs. It could block the calling thread for a long time, so only |
| 68 // use this if you really need it! There is also no way for the caller to | 77 // use this if you really need it! There is also no way for the caller to |
| 69 // interrupt this method. Errors are reported via the status field of the | 78 // interrupt this method. Errors are reported via the status field of the |
| 70 // response parameter. | 79 // response parameter. |
| 71 virtual void SyncLoad(content::SyncLoadResponse* response) = 0; | 80 virtual void SyncLoad(content::SyncLoadResponse* response) = 0; |
| 72 | 81 |
| 73 protected: | 82 protected: |
| 74 // Construction must go through | 83 // Construction must go through |
| 75 // WebKitPlatformSupportImpl::CreateResourceLoader() | 84 // WebKitPlatformSupportImpl::CreateResourceLoader() |
| 76 // For HTTP(S) POST requests, the AppendDataToUpload and AppendFileToUpload | 85 // For HTTP(S) POST requests, the AppendDataToUpload and AppendFileToUpload |
| 77 // methods may be called to construct the body of the request. | 86 // methods may be called to construct the body of the request. |
| 78 WEBKIT_CHILD_EXPORT ResourceLoaderBridge(); | 87 WEBKIT_CHILD_EXPORT ResourceLoaderBridge(); |
| 79 | 88 |
| 80 private: | 89 private: |
| 81 DISALLOW_COPY_AND_ASSIGN(ResourceLoaderBridge); | 90 DISALLOW_COPY_AND_ASSIGN(ResourceLoaderBridge); |
| 82 }; | 91 }; |
| 83 | 92 |
| 84 } // namespace webkit_glue | 93 } // namespace webkit_glue |
| 85 | 94 |
| 86 #endif // WEBKIT_CHILD_RESOURCE_LOADER_BRIDGE_H_ | 95 #endif // WEBKIT_CHILD_RESOURCE_LOADER_BRIDGE_H_ |
| OLD | NEW |