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

Side by Side Diff: third_party/WebKit/Source/web/LocalFrameClientImpl.cpp

Issue 2901223003: PlzNavigate: Fix wrong SourceLocation. (Closed)
Patch Set: Rebase + Fix conflicts. Created 3 years, 6 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
« no previous file with comments | « third_party/WebKit/Source/web/LocalFrameClientImpl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2011 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 487
488 NavigationPolicy user_policy; 488 NavigationPolicy user_policy;
489 if (!NavigationPolicyFromMouseEvent(button_number, ctrl, shift, alt, meta, 489 if (!NavigationPolicyFromMouseEvent(button_number, ctrl, shift, alt, meta,
490 &user_policy)) 490 &user_policy))
491 return false; 491 return false;
492 return user_policy == kNavigationPolicyNewBackgroundTab; 492 return user_policy == kNavigationPolicyNewBackgroundTab;
493 } 493 }
494 494
495 NavigationPolicy LocalFrameClientImpl::DecidePolicyForNavigation( 495 NavigationPolicy LocalFrameClientImpl::DecidePolicyForNavigation(
496 const ResourceRequest& request, 496 const ResourceRequest& request,
497 Document* origin_document,
497 DocumentLoader* loader, 498 DocumentLoader* loader,
498 NavigationType type, 499 NavigationType type,
499 NavigationPolicy policy, 500 NavigationPolicy policy,
500 bool replaces_current_history_item, 501 bool replaces_current_history_item,
501 bool is_client_redirect, 502 bool is_client_redirect,
502 HTMLFormElement* form, 503 HTMLFormElement* form,
503 ContentSecurityPolicyDisposition 504 ContentSecurityPolicyDisposition
504 should_check_main_world_content_security_policy) { 505 should_check_main_world_content_security_policy) {
505 if (!web_frame_->Client()) 506 if (!web_frame_->Client())
506 return kNavigationPolicyIgnore; 507 return kNavigationPolicyIgnore;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 549
549 // Caching could be disabled for requests initiated by DevTools. 550 // Caching could be disabled for requests initiated by DevTools.
550 // TODO(ananta) 551 // TODO(ananta)
551 // We should extract the network cache state into a global component which 552 // We should extract the network cache state into a global component which
552 // can be queried here and wherever necessary. 553 // can be queried here and wherever necessary.
553 navigation_info.is_cache_disabled = 554 navigation_info.is_cache_disabled =
554 DevToolsAgent() ? DevToolsAgent()->CacheDisabled() : false; 555 DevToolsAgent() ? DevToolsAgent()->CacheDisabled() : false;
555 if (form) 556 if (form)
556 navigation_info.form = WebFormElement(form); 557 navigation_info.form = WebFormElement(form);
557 558
559 // The frame has navigated either by itself or by the action of the
560 // |origin_document| when it is defined. |source_location| represents the
561 // line of code that has initiated the navigation. It is used to let web
562 // developpers locate the root cause of blocked navigations.
558 std::unique_ptr<SourceLocation> source_location = 563 std::unique_ptr<SourceLocation> source_location =
559 SourceLocation::Capture(web_frame_->GetFrame()->GetDocument()); 564 origin_document
565 ? SourceLocation::Capture(origin_document)
566 : SourceLocation::Capture(web_frame_->GetFrame()->GetDocument());
560 if (source_location && !source_location->IsUnknown()) { 567 if (source_location && !source_location->IsUnknown()) {
561 navigation_info.source_location.url = source_location->Url(); 568 navigation_info.source_location.url = source_location->Url();
562 navigation_info.source_location.line_number = source_location->LineNumber(); 569 navigation_info.source_location.line_number = source_location->LineNumber();
563 navigation_info.source_location.column_number = 570 navigation_info.source_location.column_number =
564 source_location->ColumnNumber(); 571 source_location->ColumnNumber();
565 } 572 }
566 573
567 WebNavigationPolicy web_policy = 574 WebNavigationPolicy web_policy =
568 web_frame_->Client()->DecidePolicyForNavigation(navigation_info); 575 web_frame_->Client()->DecidePolicyForNavigation(navigation_info);
569 return static_cast<NavigationPolicy>(web_policy); 576 return static_cast<NavigationPolicy>(web_policy);
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
1040 1047
1041 TextCheckerClient& LocalFrameClientImpl::GetTextCheckerClient() const { 1048 TextCheckerClient& LocalFrameClientImpl::GetTextCheckerClient() const {
1042 return web_frame_->GetTextCheckerClient(); 1049 return web_frame_->GetTextCheckerClient();
1043 } 1050 }
1044 1051
1045 std::unique_ptr<blink::WebURLLoader> LocalFrameClientImpl::CreateURLLoader() { 1052 std::unique_ptr<blink::WebURLLoader> LocalFrameClientImpl::CreateURLLoader() {
1046 return web_frame_->CreateURLLoader(); 1053 return web_frame_->CreateURLLoader();
1047 } 1054 }
1048 1055
1049 } // namespace blink 1056 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/LocalFrameClientImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698