Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1138)

Unified Diff: webkit/child/resource_loader_bridge.h

Issue 218973002: Extract Peer interface out of ResourceLoaderBridge. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: REBASED Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/public/child/resource_dispatcher_delegate.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/child/resource_loader_bridge.h
diff --git a/webkit/child/resource_loader_bridge.h b/webkit/child/resource_loader_bridge.h
index fb6cf0966af476a959232b2b2556a8a374847ce7..0b877b4c0276db00c2731ce98fa1dcc4c54e70c6 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
« no previous file with comments | « content/public/child/resource_dispatcher_delegate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698