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

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

Issue 519533002: Initial PlzNavigate RDH-side logic. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests 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_core.h
diff --git a/content/browser/loader/navigation_url_loader_core.h b/content/browser/loader/navigation_url_loader_core.h
new file mode 100644
index 0000000000000000000000000000000000000000..c06f00086a0726726674d8475ada56d080e76fc9
--- /dev/null
+++ b/content/browser/loader/navigation_url_loader_core.h
@@ -0,0 +1,104 @@
+// 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_CORE_H_
+#define CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_CORE_H_
+
+#include "base/basictypes.h"
+#include "base/macros.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "content/browser/loader/navigation_url_loader.h"
+
+namespace net {
+class URLRequest;
+struct RedirectInfo;
+}
+
+namespace content {
+
+class BrowserContext;
+class FrameTreeNode;
+class NavigationResourceHandler;
+class ResourceContext;
+class ResourceHandler;
+class ResourceRequestBody;
+class StreamHandle;
+struct ResourceResponse;
+
+// Part of the implementation of NavigationURLLoaderImpl. It is jointly owned by
+// NavigationURLLoaderImpl on the UI thread and NavigationResourceHandler and IO
+// thread. It passes signals across threads between the two objects.
+class NavigationURLLoaderCore
+ : public base::RefCountedThreadSafe<NavigationURLLoaderCore> {
+ public:
+ NavigationURLLoaderCore();
+
+ // Called on the UI thread to start the request.
+ void StartRequest(BrowserContext* browser_context,
+ int64 frame_tree_node_id,
+ const CommonNavigationParams& common_params,
+ scoped_ptr<NavigationRequestInfo> request_info,
+ ResourceRequestBody* request_body);
+
+ // Called on the UI thread to set the delegate.
+ void set_delegate(NavigationURLLoader::Delegate* delegate) {
+ delegate_ = delegate;
+ }
+
+ // Called on the UI thread to resume a deferred redirect.
+ void FollowRedirect();
+
+ // Called on the UI thread to cancel a request, if it has not completed.
+ //
+ // Note: once the response headers are received, the request is considered
+ // completed from the perspective of NavigationURLLoader and ownership is
+ // transferred to the StreamHandle containing the body.
+ void Cancel();
+
+ // Called on the IO thread to set the resource handler.
+ void set_resource_handler(NavigationResourceHandler* resource_handler) {
+ resource_handler_ = resource_handler;
+ }
+
+ // Called on the IO thread when the request is redirected. The request will
+ // resume processing on the next call to FollowRedirect on the UI thread.
+ void RequestRedirectedOnIOThread(const net::RedirectInfo& redirect_info,
+ ResourceResponse* response);
+
+ // Called on the IO thread when the response started.
+ void ResponseStartedOnIOThread(ResourceResponse* response,
+ scoped_ptr<StreamHandle> body);
+
+ // Called on the IO thread if the request failed before giving a response.
+ void RequestFailedOnIOThread(int net_error);
+
+ private:
+ friend class base::RefCountedThreadSafe<NavigationURLLoaderCore>;
+
+ ~NavigationURLLoaderCore();
+
+ void StartRequestOnIOThread(ResourceContext* resource_context,
+ int64 frame_tree_node_id,
+ const CommonNavigationParams& common_params,
+ scoped_ptr<NavigationRequestInfo> request_info,
+ ResourceRequestBody* request_body);
+ void FollowRedirectOnIOThread();
+ void CancelOnIOThread();
+
+ void CallOnRequestRedirected(const net::RedirectInfo& redirect_info,
+ ResourceResponse* response);
+ void CallOnResponseStarted(ResourceResponse* response,
+ scoped_ptr<StreamHandle> body);
+ void CallOnRequestFailed(int net_error);
+
+ NavigationURLLoader::Delegate* delegate_;
+ NavigationResourceHandler* resource_handler_;
+
+ DISALLOW_COPY_AND_ASSIGN(NavigationURLLoaderCore);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_H_
« no previous file with comments | « content/browser/loader/navigation_url_loader.cc ('k') | content/browser/loader/navigation_url_loader_core.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698