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

Unified Diff: content/browser/loader/navigation_url_loader_delegate.h

Issue 648813002: PlzNavigate: Add first version of NavigationURLLoader. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@plz-navigate-prepare
Patch Set: nasko and mmenke comments Created 6 years, 2 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
Index: content/browser/loader/navigation_url_loader_delegate.h
diff --git a/content/browser/loader/navigation_url_loader_delegate.h b/content/browser/loader/navigation_url_loader_delegate.h
new file mode 100644
index 0000000000000000000000000000000000000000..0dcfc6d452bf6908c2a9e04d3caacf5c52f39dea
--- /dev/null
+++ b/content/browser/loader/navigation_url_loader_delegate.h
@@ -0,0 +1,49 @@
+// 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_BROWSER_LOADER_NAVIGATION_URL_LOADER_DELEGATE_H_
+#define CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_DELEGATE_H_
+
+#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+#include "content/common/content_export.h"
+
+namespace net {
+struct RedirectInfo;
+}
+
+namespace content {
+
+class StreamHandle;
+struct ResourceResponse;
+
+// PlzNavigate: The delegate interface to NavigationURLLoader.
+class CONTENT_EXPORT NavigationURLLoaderDelegate {
+ public:
+ // Called when the request is redirected. Call FollowRedirect to continue
+ // processing the request.
+ virtual void OnRequestRedirected(const net::RedirectInfo& redirect_info,
+ ResourceResponse* response) = 0;
mmenke 2014/10/28 16:05:39 Suggest making this a "const scoped_refptr&". Tha
davidben 2014/10/29 19:10:34 Done. At least within loader/.
+
+ // Called when the request receives its response. No further calls will be
+ // made to the delegate. The response body is returned as a stream in
+ // |body|.
+ virtual void OnResponseStarted(ResourceResponse* response,
+ scoped_ptr<StreamHandle> body) = 0;
mmenke 2014/10/28 16:05:39 nit: Maybe body_stream? Or body_blob? Or bloby_
davidben 2014/10/29 19:10:33 *shrug* I feel like body is pretty descriptive. St
mmenke 2014/10/29 19:44:46 I dunno... I see a test mucking with something ca
davidben 2014/10/29 19:46:54 Yeah, that a StreamHandle requires a URLRequest to
+
+ // Called if the request fails before receving a response. |net_error| is a
+ // network error code for the failure.
+ virtual void OnRequestFailed(int net_error) = 0;
+
+ protected:
+ NavigationURLLoaderDelegate() {}
+ virtual ~NavigationURLLoaderDelegate() {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(NavigationURLLoaderDelegate);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_DELEGATE_H_

Powered by Google App Engine
This is Rietveld 408576698