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

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: Created 6 years, 3 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..a1030d727addc8a9213a67fa30102be7e072c140
--- /dev/null
+++ b/content/browser/loader/navigation_url_loader_core.h
@@ -0,0 +1,97 @@
+// 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/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. This bridges between
+// the IO and UI thread.
+class NavigationURLLoaderCore
clamy 2014/09/12 20:51:25 Why do we have a NavigationURLLoaderImpl and a Nav
davidben 2014/09/19 18:30:50 NavigationURLLoaderImpl is uniquely owned by the U
+ : public base::RefCountedThreadSafe<NavigationURLLoaderCore> {
+ public:
+ NavigationURLLoaderCore(NavigationURLLoader::Delegate* delegate);
+
+ // Called on the UI thread to start the request.
+ void StartRequest(BrowserContext* browser_context,
+ int64 frame_tree_node_id,
+ const NavigationRequestInfo& request_info,
+ ResourceRequestBody* request_body);
+
+ // Called on the UI thread to resume a deferred redirect.
+ void Resume();
+
+ // Called on the UI thread to cancel a request, if it has not completed. No
+ // further calls will be made on |delegate_|. Note: if the response has been
+ // 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 Resume.
+ void RequestRedirectedOnIOThread(const net::RedirectInfo& redirect_info,
+ ResourceResponse* response);
+
+ // Called on the IO thread when the response started. No further calls will be
+ // made on |resource_handler_|.
+ void ResponseStartedOnIOThread(ResourceResponse* response,
+ scoped_ptr<StreamHandle> body);
+
+ // Called on the IO thread if the request failed before giving a response. No
+ // further calls will be made on |resource_handler_|.
+ void RequestFailedOnIOThread(int net_error);
+
+ private:
+ friend class base::RefCountedThreadSafe<NavigationURLLoaderCore>;
+
+ ~NavigationURLLoaderCore();
+
+ void StartRequestOnIOThread(ResourceContext* resource_context,
+ int64 frame_tree_node_id,
+ const NavigationRequestInfo& request_info,
+ ResourceRequestBody* request_body);
+ void ResumeOnIOThread();
+ 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_

Powered by Google App Engine
This is Rietveld 408576698