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

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

Issue 2655463006: PlzNavigate: Enforce 'frame-src' CSP on the browser. (Closed)
Patch Set: Rebase. Created 3 years, 9 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 /* 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 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 return userPolicy == NavigationPolicyNewBackgroundTab; 527 return userPolicy == NavigationPolicyNewBackgroundTab;
528 } 528 }
529 529
530 NavigationPolicy LocalFrameClientImpl::decidePolicyForNavigation( 530 NavigationPolicy LocalFrameClientImpl::decidePolicyForNavigation(
531 const ResourceRequest& request, 531 const ResourceRequest& request,
532 DocumentLoader* loader, 532 DocumentLoader* loader,
533 NavigationType type, 533 NavigationType type,
534 NavigationPolicy policy, 534 NavigationPolicy policy,
535 bool replacesCurrentHistoryItem, 535 bool replacesCurrentHistoryItem,
536 bool isClientRedirect, 536 bool isClientRedirect,
537 HTMLFormElement* form) { 537 HTMLFormElement* form,
538 ContentSecurityPolicyDisposition
539 shouldCheckMainWorldContentSecurityPolicy) {
538 if (!m_webFrame->client()) 540 if (!m_webFrame->client())
539 return NavigationPolicyIgnore; 541 return NavigationPolicyIgnore;
540 542
541 if (policy == NavigationPolicyNewBackgroundTab && 543 if (policy == NavigationPolicyNewBackgroundTab &&
542 !allowCreatingBackgroundTabs() && 544 !allowCreatingBackgroundTabs() &&
543 !UIEventWithKeyState::newTabModifierSetFromIsolatedWorld()) 545 !UIEventWithKeyState::newTabModifierSetFromIsolatedWorld())
544 policy = NavigationPolicyNewForegroundTab; 546 policy = NavigationPolicyNewForegroundTab;
545 547
546 WebDataSourceImpl* ds = WebDataSourceImpl::fromDocumentLoader(loader); 548 WebDataSourceImpl* ds = WebDataSourceImpl::fromDocumentLoader(loader);
547 549
(...skipping 16 matching lines...) Expand all
564 566
565 WrappedResourceRequest wrappedResourceRequest(request); 567 WrappedResourceRequest wrappedResourceRequest(request);
566 WebFrameClient::NavigationPolicyInfo navigationInfo(wrappedResourceRequest); 568 WebFrameClient::NavigationPolicyInfo navigationInfo(wrappedResourceRequest);
567 navigationInfo.navigationType = static_cast<WebNavigationType>(type); 569 navigationInfo.navigationType = static_cast<WebNavigationType>(type);
568 navigationInfo.defaultPolicy = static_cast<WebNavigationPolicy>(policy); 570 navigationInfo.defaultPolicy = static_cast<WebNavigationPolicy>(policy);
569 navigationInfo.extraData = ds ? ds->getExtraData() : nullptr; 571 navigationInfo.extraData = ds ? ds->getExtraData() : nullptr;
570 navigationInfo.replacesCurrentHistoryItem = replacesCurrentHistoryItem; 572 navigationInfo.replacesCurrentHistoryItem = replacesCurrentHistoryItem;
571 navigationInfo.isHistoryNavigationInNewChildFrame = 573 navigationInfo.isHistoryNavigationInNewChildFrame =
572 isHistoryNavigationInNewChildFrame; 574 isHistoryNavigationInNewChildFrame;
573 navigationInfo.isClientRedirect = isClientRedirect; 575 navigationInfo.isClientRedirect = isClientRedirect;
576 navigationInfo.shouldCheckMainWorldContentSecurityPolicy =
577 shouldCheckMainWorldContentSecurityPolicy == CheckContentSecurityPolicy
578 ? WebContentSecurityPolicyDispositionCheck
579 : WebContentSecurityPolicyDispositionDoNotCheck;
574 // Caching could be disabled for requests initiated by DevTools. 580 // Caching could be disabled for requests initiated by DevTools.
575 // TODO(ananta) 581 // TODO(ananta)
576 // We should extract the network cache state into a global component which 582 // We should extract the network cache state into a global component which
577 // can be queried here and wherever necessary. 583 // can be queried here and wherever necessary.
578 navigationInfo.isCacheDisabled = 584 navigationInfo.isCacheDisabled =
579 devToolsAgent() ? devToolsAgent()->cacheDisabled() : false; 585 devToolsAgent() ? devToolsAgent()->cacheDisabled() : false;
580 if (form) 586 if (form)
581 navigationInfo.form = WebFormElement(form); 587 navigationInfo.form = WebFormElement(form);
582 588
583 std::unique_ptr<SourceLocation> sourceLocation = 589 std::unique_ptr<SourceLocation> sourceLocation =
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 KURL LocalFrameClientImpl::overrideFlashEmbedWithHTML(const KURL& url) { 1030 KURL LocalFrameClientImpl::overrideFlashEmbedWithHTML(const KURL& url) {
1025 return m_webFrame->client()->overrideFlashEmbedWithHTML(WebURL(url)); 1031 return m_webFrame->client()->overrideFlashEmbedWithHTML(WebURL(url));
1026 } 1032 }
1027 1033
1028 void LocalFrameClientImpl::setHasReceivedUserGesture() { 1034 void LocalFrameClientImpl::setHasReceivedUserGesture() {
1029 if (m_webFrame->client()) 1035 if (m_webFrame->client())
1030 m_webFrame->client()->setHasReceivedUserGesture(); 1036 m_webFrame->client()->setHasReceivedUserGesture();
1031 } 1037 }
1032 1038
1033 } // namespace blink 1039 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/LocalFrameClientImpl.h ('k') | third_party/WebKit/Source/web/WebLocalFrameImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698