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

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

Issue 2655463006: PlzNavigate: Enforce 'frame-src' CSP on the browser. (Closed)
Patch Set: Addressed comments 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 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 return userPolicy == NavigationPolicyNewBackgroundTab; 521 return userPolicy == NavigationPolicyNewBackgroundTab;
522 } 522 }
523 523
524 NavigationPolicy LocalFrameClientImpl::decidePolicyForNavigation( 524 NavigationPolicy LocalFrameClientImpl::decidePolicyForNavigation(
525 const ResourceRequest& request, 525 const ResourceRequest& request,
526 DocumentLoader* loader, 526 DocumentLoader* loader,
527 NavigationType type, 527 NavigationType type,
528 NavigationPolicy policy, 528 NavigationPolicy policy,
529 bool replacesCurrentHistoryItem, 529 bool replacesCurrentHistoryItem,
530 bool isClientRedirect, 530 bool isClientRedirect,
531 HTMLFormElement* form) { 531 HTMLFormElement* form,
532 ContentSecurityPolicyDisposition
533 shouldCheckMainWorldContentSecurityPolicy) {
532 if (!m_webFrame->client()) 534 if (!m_webFrame->client())
533 return NavigationPolicyIgnore; 535 return NavigationPolicyIgnore;
534 536
535 if (policy == NavigationPolicyNewBackgroundTab && 537 if (policy == NavigationPolicyNewBackgroundTab &&
536 !allowCreatingBackgroundTabs() && 538 !allowCreatingBackgroundTabs() &&
537 !UIEventWithKeyState::newTabModifierSetFromIsolatedWorld()) 539 !UIEventWithKeyState::newTabModifierSetFromIsolatedWorld())
538 policy = NavigationPolicyNewForegroundTab; 540 policy = NavigationPolicyNewForegroundTab;
539 541
540 WebDataSourceImpl* ds = WebDataSourceImpl::fromDocumentLoader(loader); 542 WebDataSourceImpl* ds = WebDataSourceImpl::fromDocumentLoader(loader);
541 543
(...skipping 16 matching lines...) Expand all
558 560
559 WrappedResourceRequest wrappedResourceRequest(request); 561 WrappedResourceRequest wrappedResourceRequest(request);
560 WebFrameClient::NavigationPolicyInfo navigationInfo(wrappedResourceRequest); 562 WebFrameClient::NavigationPolicyInfo navigationInfo(wrappedResourceRequest);
561 navigationInfo.navigationType = static_cast<WebNavigationType>(type); 563 navigationInfo.navigationType = static_cast<WebNavigationType>(type);
562 navigationInfo.defaultPolicy = static_cast<WebNavigationPolicy>(policy); 564 navigationInfo.defaultPolicy = static_cast<WebNavigationPolicy>(policy);
563 navigationInfo.extraData = ds ? ds->getExtraData() : nullptr; 565 navigationInfo.extraData = ds ? ds->getExtraData() : nullptr;
564 navigationInfo.replacesCurrentHistoryItem = replacesCurrentHistoryItem; 566 navigationInfo.replacesCurrentHistoryItem = replacesCurrentHistoryItem;
565 navigationInfo.isHistoryNavigationInNewChildFrame = 567 navigationInfo.isHistoryNavigationInNewChildFrame =
566 isHistoryNavigationInNewChildFrame; 568 isHistoryNavigationInNewChildFrame;
567 navigationInfo.isClientRedirect = isClientRedirect; 569 navigationInfo.isClientRedirect = isClientRedirect;
570 navigationInfo.shouldBypassMainWorldCSP =
571 shouldCheckMainWorldContentSecurityPolicy ==
572 DoNotCheckContentSecurityPolicy;
568 // Caching could be disabled for requests initiated by DevTools. 573 // Caching could be disabled for requests initiated by DevTools.
569 // TODO(ananta) 574 // TODO(ananta)
570 // We should extract the network cache state into a global component which 575 // We should extract the network cache state into a global component which
571 // can be queried here and wherever necessary. 576 // can be queried here and wherever necessary.
572 navigationInfo.isCacheDisabled = 577 navigationInfo.isCacheDisabled =
573 devToolsAgent() ? devToolsAgent()->cacheDisabled() : false; 578 devToolsAgent() ? devToolsAgent()->cacheDisabled() : false;
574 if (form) 579 if (form)
575 navigationInfo.form = WebFormElement(form); 580 navigationInfo.form = WebFormElement(form);
576 581
577 WebNavigationPolicy webPolicy = 582 WebNavigationPolicy webPolicy =
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 KURL LocalFrameClientImpl::overrideFlashEmbedWithHTML(const KURL& url) { 1016 KURL LocalFrameClientImpl::overrideFlashEmbedWithHTML(const KURL& url) {
1012 return m_webFrame->client()->overrideFlashEmbedWithHTML(WebURL(url)); 1017 return m_webFrame->client()->overrideFlashEmbedWithHTML(WebURL(url));
1013 } 1018 }
1014 1019
1015 void LocalFrameClientImpl::setHasReceivedUserGesture() { 1020 void LocalFrameClientImpl::setHasReceivedUserGesture() {
1016 if (m_webFrame->client()) 1021 if (m_webFrame->client())
1017 m_webFrame->client()->setHasReceivedUserGesture(); 1022 m_webFrame->client()->setHasReceivedUserGesture();
1018 } 1023 }
1019 1024
1020 } // namespace blink 1025 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698