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

Unified Diff: content/browser/frame_host/navigation_request.cc

Issue 367653002: Add a FrameHostMsg_BeginNavigation IPC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Przemek's comments + fixed compilation error Created 6 years, 5 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/frame_host/navigation_request.cc
diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc
new file mode 100644
index 0000000000000000000000000000000000000000..fb46ae59b3d9c10ad87d021dd60dd5010efb342f
--- /dev/null
+++ b/content/browser/frame_host/navigation_request.cc
@@ -0,0 +1,46 @@
+// 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.
+
+#include "content/browser/frame_host/navigation_request.h"
+
+#include "base/logging.h"
+#include "content/browser/loader/resource_dispatcher_host_impl.h"
+#include "content/common/resource_request_body.h"
+#include "content/public/browser/browser_thread.h"
+
+namespace content {
+
+namespace {
+
+void OnBeginNavigation(const NavigationRequestInfo& info,
+ scoped_refptr<ResourceRequestBody> request_body,
+ int64 frame_node_id) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ ResourceDispatcherHostImpl::Get()->NavigationRequest(
+ info, request_body, frame_node_id);
+}
+
+} // namespace
+
+NavigationRequest::NavigationRequest(const NavigationRequestInfo& info,
+ int64 frame_node_id)
+ : info_(info),
+ frame_node_id_(frame_node_id) {
+}
+
+NavigationRequest::~NavigationRequest() {
+ // TODO(clamy): Cancel the corresponding request in ResourceDispatcherHost if
+ // it has not commited yet.
davidben 2014/07/09 15:14:27 (I suspect this'll require that NavigationRequests
+}
+
+void NavigationRequest::BeginNavigation(
+ scoped_refptr<ResourceRequestBody> request_body) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ BrowserThread::PostTask(
+ BrowserThread::IO,
+ FROM_HERE,
+ base::Bind(&OnBeginNavigation, info_, request_body, frame_node_id_));
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698