OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "headless/app/shell_navigation_request.h" |
| 6 |
| 7 #include "headless/app/headless_shell.h" |
| 8 |
| 9 namespace headless { |
| 10 |
| 11 ShellNavigationRequest::ShellNavigationRequest( |
| 12 base::WeakPtr<HeadlessShell> headless_shell, |
| 13 const page::NavigationRequestedParams& params) |
| 14 : headless_shell_(headless_shell), |
| 15 navigation_id_(params.GetNavigationId()) {} |
| 16 |
| 17 ShellNavigationRequest::~ShellNavigationRequest() {} |
| 18 |
| 19 void ShellNavigationRequest::StartProcessing(base::Closure done_callback) { |
| 20 if (!headless_shell_) |
| 21 return; |
| 22 |
| 23 // Allow the navigation to proceed. |
| 24 headless_shell_->devtools_client() |
| 25 ->GetPage() |
| 26 ->GetExperimental() |
| 27 ->ProcessNavigation( |
| 28 headless::page::ProcessNavigationParams::Builder() |
| 29 .SetNavigationId(navigation_id_) |
| 30 .SetResponse(headless::page::NavigationResponse::PROCEED) |
| 31 .Build(), |
| 32 base::Bind(&ShellNavigationRequest::ProcessNavigationResult, |
| 33 done_callback)); |
| 34 } |
| 35 |
| 36 // static |
| 37 void ShellNavigationRequest::ProcessNavigationResult( |
| 38 base::Closure done_callback, |
| 39 std::unique_ptr<page::ProcessNavigationResult>) { |
| 40 done_callback.Run(); |
| 41 } |
| 42 |
| 43 } // namespace headless |
OLD | NEW |