OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/devtools/protocol/page_handler.h" | 5 #include "content/browser/devtools/protocol/page_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 : ReloadType::NORMAL, | 221 : ReloadType::NORMAL, |
222 false); | 222 false); |
223 return Response::OK(); | 223 return Response::OK(); |
224 } else { | 224 } else { |
225 // Handle reload in renderer except for crashed and view source mode. | 225 // Handle reload in renderer except for crashed and view source mode. |
226 return Response::FallThrough(); | 226 return Response::FallThrough(); |
227 } | 227 } |
228 } | 228 } |
229 | 229 |
230 Response PageHandler::Navigate(const std::string& url, | 230 Response PageHandler::Navigate(const std::string& url, |
| 231 Maybe<std::string> referrer, |
231 Page::FrameId* frame_id) { | 232 Page::FrameId* frame_id) { |
232 GURL gurl(url); | 233 GURL gurl(url); |
233 if (!gurl.is_valid()) | 234 if (!gurl.is_valid()) |
234 return Response::Error("Cannot navigate to invalid URL"); | 235 return Response::Error("Cannot navigate to invalid URL"); |
235 | 236 |
236 WebContentsImpl* web_contents = GetWebContents(); | 237 WebContentsImpl* web_contents = GetWebContents(); |
237 if (!web_contents) | 238 if (!web_contents) |
238 return Response::InternalError(); | 239 return Response::InternalError(); |
239 | 240 |
240 web_contents->GetController() | 241 web_contents->GetController().LoadURL( |
241 .LoadURL(gurl, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); | 242 gurl, |
| 243 Referrer(GURL(referrer.fromMaybe("")), blink::WebReferrerPolicyDefault), |
| 244 ui::PAGE_TRANSITION_TYPED, std::string()); |
242 return Response::FallThrough(); | 245 return Response::FallThrough(); |
243 } | 246 } |
244 | 247 |
245 Response PageHandler::GetNavigationHistory( | 248 Response PageHandler::GetNavigationHistory( |
246 int* current_index, | 249 int* current_index, |
247 std::unique_ptr<NavigationEntries>* entries) { | 250 std::unique_ptr<NavigationEntries>* entries) { |
248 WebContentsImpl* web_contents = GetWebContents(); | 251 WebContentsImpl* web_contents = GetWebContents(); |
249 if (!web_contents) | 252 if (!web_contents) |
250 return Response::InternalError(); | 253 return Response::InternalError(); |
251 | 254 |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 Response PageHandler::StopLoading() { | 588 Response PageHandler::StopLoading() { |
586 WebContentsImpl* web_contents = GetWebContents(); | 589 WebContentsImpl* web_contents = GetWebContents(); |
587 if (!web_contents) | 590 if (!web_contents) |
588 return Response::InternalError(); | 591 return Response::InternalError(); |
589 web_contents->Stop(); | 592 web_contents->Stop(); |
590 return Response::OK(); | 593 return Response::OK(); |
591 } | 594 } |
592 | 595 |
593 } // namespace protocol | 596 } // namespace protocol |
594 } // namespace content | 597 } // namespace content |
OLD | NEW |