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

Unified Diff: headless/app/shell_navigation_request.cc

Issue 2687083002: Headless: make URLRequestDispatcher aware of navigations (Closed)
Patch Set: Address nits Created 3 years, 10 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 | « headless/app/shell_navigation_request.h ('k') | headless/public/util/deterministic_dispatcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: headless/app/shell_navigation_request.cc
diff --git a/headless/app/shell_navigation_request.cc b/headless/app/shell_navigation_request.cc
new file mode 100644
index 0000000000000000000000000000000000000000..3c419bce8ec8800be86feec5ebd0ce7cc3a44b91
--- /dev/null
+++ b/headless/app/shell_navigation_request.cc
@@ -0,0 +1,43 @@
+// Copyright 2017 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 "headless/app/shell_navigation_request.h"
+
+#include "headless/app/headless_shell.h"
+
+namespace headless {
+
+ShellNavigationRequest::ShellNavigationRequest(
+ base::WeakPtr<HeadlessShell> headless_shell,
+ const page::NavigationRequestedParams& params)
+ : headless_shell_(headless_shell),
+ navigation_id_(params.GetNavigationId()) {}
+
+ShellNavigationRequest::~ShellNavigationRequest() {}
+
+void ShellNavigationRequest::StartProcessing(base::Closure done_callback) {
+ if (!headless_shell_)
+ return;
+
+ // Allow the navigation to proceed.
+ headless_shell_->devtools_client()
+ ->GetPage()
+ ->GetExperimental()
+ ->ProcessNavigation(
+ headless::page::ProcessNavigationParams::Builder()
+ .SetNavigationId(navigation_id_)
+ .SetResponse(headless::page::NavigationResponse::PROCEED)
+ .Build(),
+ base::Bind(&ShellNavigationRequest::ProcessNavigationResult,
+ done_callback));
+}
+
+// static
+void ShellNavigationRequest::ProcessNavigationResult(
+ base::Closure done_callback,
+ std::unique_ptr<page::ProcessNavigationResult>) {
+ done_callback.Run();
+}
+
+} // namespace headless
« no previous file with comments | « headless/app/shell_navigation_request.h ('k') | headless/public/util/deterministic_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698