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

Unified Diff: content/public/child/request_delegate_peer.h

Issue 218973002: Extract Peer interface out of ResourceLoaderBridge. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/content_child.gypi ('k') | content/public/child/resource_dispatcher_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/child/request_delegate_peer.h
diff --git a/content/public/child/request_delegate_peer.h b/content/public/child/request_delegate_peer.h
new file mode 100644
index 0000000000000000000000000000000000000000..80cef9dd4d3adb637b1f3d8e84f60fab43985c4e
--- /dev/null
+++ b/content/public/child/request_delegate_peer.h
@@ -0,0 +1,92 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_PUBLIC_CHILD_REQUEST_DELEGATE_PEER_H_
+#define CONTENT_PUBLIC_CHILD_REQUEST_DELEGATE_PEER_H_
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "content/common/content_export.h"
+
+class GURL;
+
+namespace base {
+class TimeTicks;
+}
+
+namespace webkit_glue {
+struct ResourceResponseInfo;
+}
+
+namespace content {
+
+// Generated by the bridge. This is implemented by our custom resource loader
jam 2014/03/31 17:18:45 update this comment, there's no bridge anymore (or
tfarina 2014/04/02 16:18:22 Done.
+// within content. 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 CONTENT_EXPORT RequestDelegatePeer {
jam 2014/03/31 17:18:45 this is a bit of a confusing name, since content/p
tfarina 2014/04/02 16:18:22 Done.
+ 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 webkit_glue::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 webkit_glue::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 ~RequestDelegatePeer() {}
+};
+
+} // namespace content
+
+#endif // CONTENT_PUBLIC_CHILD_REQUEST_DELEGATE_PEER_H_
« no previous file with comments | « content/content_child.gypi ('k') | content/public/child/resource_dispatcher_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698