summaryrefslogtreecommitdiffstats
path: root/webkit/child/resource_loader_bridge.h
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-03 08:24:47 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-03 08:24:47 +0000
commitddf55bb8b0ced4209979730f71aa9643d5565304 (patch)
treed850f587aba1be19c3d9f698b2764ad8f2388ee7 /webkit/child/resource_loader_bridge.h
parent904cae4b8784cc1e9fec4b748f32dcb8e2e979cf (diff)
downloadchromium_src-ddf55bb8b0ced4209979730f71aa9643d5565304.zip
chromium_src-ddf55bb8b0ced4209979730f71aa9643d5565304.tar.gz
chromium_src-ddf55bb8b0ced4209979730f71aa9643d5565304.tar.bz2
Extract Peer interface out of ResourceLoaderBridge.
This moves it into its own header file in content/public/child/request_delegate_peer.h As requested by John in - https://codereview.chromium.org/186193005/diff/1/content/public/child/resource_loader_bridge.h#newcode133 BUG=265753,338338,237249 TEST=content_unittests, unit_tests R=jam@chromium.org TBR=darin Review URL: https://codereview.chromium.org/218973002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@261323 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/child/resource_loader_bridge.h')
-rw-r--r--webkit/child/resource_loader_bridge.h86
1 files changed, 6 insertions, 80 deletions
diff --git a/webkit/child/resource_loader_bridge.h b/webkit/child/resource_loader_bridge.h
index fb6cf09..0b877b4 100644
--- a/webkit/child/resource_loader_bridge.h
+++ b/webkit/child/resource_loader_bridge.h
@@ -10,103 +10,29 @@
// will own the pointer to the bridge, and will delete it when the request is
// no longer needed.
//
-// In turn, the bridge's owner on the WebKit end will implement the Peer
-// interface, which we will use to communicate notifications back.
+// In turn, the bridge's owner on the WebKit end will implement the
+// RequestPeer interface, which we will use to communicate notifications
+// back.
#ifndef WEBKIT_CHILD_RESOURCE_LOADER_BRIDGE_H_
#define WEBKIT_CHILD_RESOURCE_LOADER_BRIDGE_H_
-#include <utility>
-
-#include "build/build_config.h"
-#if defined(OS_POSIX)
-#include "base/file_descriptor_posix.h"
-#endif
-#include "base/memory/ref_counted.h"
-#include "base/platform_file.h"
-#include "base/values.h"
+#include "base/macros.h"
#include "net/base/request_priority.h"
-#include "url/gurl.h"
#include "webkit/child/webkit_child_export.h"
// TODO(pilgrim) remove this once resource loader is moved to content
// http://crbug.com/338338
namespace content {
+class RequestPeer;
class ResourceRequestBody;
struct SyncLoadResponse;
}
namespace webkit_glue {
-struct ResourceResponseInfo;
-
class ResourceLoaderBridge {
public:
- // Generated by the bridge. This is implemented by our custom resource loader
- // within webkit. The Peer and it's bridge should have identical lifetimes
- // as they represent each end of a communication channel.
- //
- // These callbacks mirror net::URLRequest::Delegate and the order and
- // conditions in which they will be called are identical. See url_request.h
- // for more information.
- class WEBKIT_CHILD_EXPORT Peer {
- public:
- // Called as upload progress is made.
- // note: only for requests with LOAD_ENABLE_UPLOAD_PROGRESS set
- virtual void OnUploadProgress(uint64 position, uint64 size) = 0;
-
- // Called when a redirect occurs. The implementation may return false to
- // suppress the redirect. The given ResponseInfo provides complete
- // information about the redirect, and new_url is the URL that will be
- // loaded if this method returns true. If this method returns true, the
- // output parameter *has_new_first_party_for_cookies indicates whether the
- // output parameter *new_first_party_for_cookies contains the new URL that
- // should be consulted for the third-party cookie blocking policy.
- virtual bool OnReceivedRedirect(const GURL& new_url,
- const ResourceResponseInfo& info,
- bool* has_new_first_party_for_cookies,
- GURL* new_first_party_for_cookies) = 0;
-
- // Called when response headers are available (after all redirects have
- // been followed).
- virtual void OnReceivedResponse(const ResourceResponseInfo& info) = 0;
-
- // Called when a chunk of response data is downloaded. This method may be
- // called multiple times or not at all if an error occurs. This method is
- // only called if RequestInfo::download_to_file was set to true, and in
- // that case, OnReceivedData will not be called.
- // The encoded_data_length is the length of the encoded data transferred
- // over the network, which could be different from data length (e.g. for
- // gzipped content).
- virtual void OnDownloadedData(int len, int encoded_data_length) = 0;
-
- // Called when a chunk of response data is available. This method may
- // be called multiple times or not at all if an error occurs.
- // The encoded_data_length is the length of the encoded data transferred
- // over the network, which could be different from data length (e.g. for
- // gzipped content).
- virtual void OnReceivedData(const char* data,
- int data_length,
- int encoded_data_length) = 0;
-
- // Called when metadata generated by the renderer is retrieved from the
- // cache. This method may be called zero or one times.
- virtual void OnReceivedCachedMetadata(const char* data, int len) { }
-
- // Called when the response is complete. This method signals completion of
- // the resource load.
- virtual void OnCompletedRequest(
- int error_code,
- bool was_ignored_by_handler,
- bool stale_copy_in_cache,
- const std::string& security_info,
- const base::TimeTicks& completion_time,
- int64 total_transfer_size) = 0;
-
- protected:
- virtual ~Peer() {}
- };
-
// use WebKitPlatformSupportImpl::CreateResourceLoader() for construction, but
// anybody can delete at any time, INCLUDING during processing of callbacks.
WEBKIT_CHILD_EXPORT virtual ~ResourceLoaderBridge();
@@ -117,7 +43,7 @@ class ResourceLoaderBridge {
// Call this method to initiate the request. If this method succeeds, then
// the peer's methods will be called asynchronously to report various events.
- virtual bool Start(Peer* peer) = 0;
+ virtual bool Start(content::RequestPeer* peer) = 0;
// Call this method to cancel a request that is in progress. This method
// causes the request to immediately transition into the 'done' state. The