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

Side by Side Diff: content/browser/devtools/protocol/page_handler.cc

Issue 2703253002: devtools: Make it possible to override the navigation referrer (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
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
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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 Response PageHandler::StopLoading() { 583 Response PageHandler::StopLoading() {
581 WebContentsImpl* web_contents = GetWebContents(); 584 WebContentsImpl* web_contents = GetWebContents();
582 if (!web_contents) 585 if (!web_contents)
583 return Response::InternalError(); 586 return Response::InternalError();
584 web_contents->Stop(); 587 web_contents->Stop();
585 return Response::OK(); 588 return Response::OK();
586 } 589 }
587 590
588 } // namespace protocol 591 } // namespace protocol
589 } // namespace content 592 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698