| OLD | NEW |
| 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 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 | 483 |
| 484 NavigationPolicy user_policy; | 484 NavigationPolicy user_policy; |
| 485 if (!NavigationPolicyFromMouseEvent(button_number, ctrl, shift, alt, meta, | 485 if (!NavigationPolicyFromMouseEvent(button_number, ctrl, shift, alt, meta, |
| 486 &user_policy)) | 486 &user_policy)) |
| 487 return false; | 487 return false; |
| 488 return user_policy == kNavigationPolicyNewBackgroundTab; | 488 return user_policy == kNavigationPolicyNewBackgroundTab; |
| 489 } | 489 } |
| 490 | 490 |
| 491 NavigationPolicy LocalFrameClientImpl::DecidePolicyForNavigation( | 491 NavigationPolicy LocalFrameClientImpl::DecidePolicyForNavigation( |
| 492 const ResourceRequest& request, | 492 const ResourceRequest& request, |
| 493 Document* origin_document, |
| 493 DocumentLoader* loader, | 494 DocumentLoader* loader, |
| 494 NavigationType type, | 495 NavigationType type, |
| 495 NavigationPolicy policy, | 496 NavigationPolicy policy, |
| 496 bool replaces_current_history_item, | 497 bool replaces_current_history_item, |
| 497 bool is_client_redirect, | 498 bool is_client_redirect, |
| 498 HTMLFormElement* form, | 499 HTMLFormElement* form, |
| 499 ContentSecurityPolicyDisposition | 500 ContentSecurityPolicyDisposition |
| 500 should_check_main_world_content_security_policy) { | 501 should_check_main_world_content_security_policy) { |
| 501 if (!web_frame_->Client()) | 502 if (!web_frame_->Client()) |
| 502 return kNavigationPolicyIgnore; | 503 return kNavigationPolicyIgnore; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 | 545 |
| 545 // Caching could be disabled for requests initiated by DevTools. | 546 // Caching could be disabled for requests initiated by DevTools. |
| 546 // TODO(ananta) | 547 // TODO(ananta) |
| 547 // We should extract the network cache state into a global component which | 548 // We should extract the network cache state into a global component which |
| 548 // can be queried here and wherever necessary. | 549 // can be queried here and wherever necessary. |
| 549 navigation_info.is_cache_disabled = | 550 navigation_info.is_cache_disabled = |
| 550 DevToolsAgent() ? DevToolsAgent()->CacheDisabled() : false; | 551 DevToolsAgent() ? DevToolsAgent()->CacheDisabled() : false; |
| 551 if (form) | 552 if (form) |
| 552 navigation_info.form = WebFormElement(form); | 553 navigation_info.form = WebFormElement(form); |
| 553 | 554 |
| 555 // The frame has navigated either by itself or by the action of the |
| 556 // |origin_document| when it is defined. |source_location| represents the |
| 557 // line of code that has initiated the navigation. It is used to let web |
| 558 // developpers locate the root cause of blocked navigations. |
| 554 std::unique_ptr<SourceLocation> source_location = | 559 std::unique_ptr<SourceLocation> source_location = |
| 555 SourceLocation::Capture(web_frame_->GetFrame()->GetDocument()); | 560 origin_document |
| 561 ? SourceLocation::Capture(origin_document) |
| 562 : SourceLocation::Capture(web_frame_->GetFrame()->GetDocument()); |
| 556 if (source_location && !source_location->IsUnknown()) { | 563 if (source_location && !source_location->IsUnknown()) { |
| 557 navigation_info.source_location.url = source_location->Url(); | 564 navigation_info.source_location.url = source_location->Url(); |
| 558 navigation_info.source_location.line_number = source_location->LineNumber(); | 565 navigation_info.source_location.line_number = source_location->LineNumber(); |
| 559 navigation_info.source_location.column_number = | 566 navigation_info.source_location.column_number = |
| 560 source_location->ColumnNumber(); | 567 source_location->ColumnNumber(); |
| 561 } | 568 } |
| 562 | 569 |
| 563 WebNavigationPolicy web_policy = | 570 WebNavigationPolicy web_policy = |
| 564 web_frame_->Client()->DecidePolicyForNavigation(navigation_info); | 571 web_frame_->Client()->DecidePolicyForNavigation(navigation_info); |
| 565 return static_cast<NavigationPolicy>(web_policy); | 572 return static_cast<NavigationPolicy>(web_policy); |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1036 | 1043 |
| 1037 TextCheckerClient& LocalFrameClientImpl::GetTextCheckerClient() const { | 1044 TextCheckerClient& LocalFrameClientImpl::GetTextCheckerClient() const { |
| 1038 return web_frame_->GetTextCheckerClient(); | 1045 return web_frame_->GetTextCheckerClient(); |
| 1039 } | 1046 } |
| 1040 | 1047 |
| 1041 std::unique_ptr<blink::WebURLLoader> LocalFrameClientImpl::CreateURLLoader() { | 1048 std::unique_ptr<blink::WebURLLoader> LocalFrameClientImpl::CreateURLLoader() { |
| 1042 return web_frame_->CreateURLLoader(); | 1049 return web_frame_->CreateURLLoader(); |
| 1043 } | 1050 } |
| 1044 | 1051 |
| 1045 } // namespace blink | 1052 } // namespace blink |
| OLD | NEW |