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

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 @alexmos. 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 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 return userPolicy == NavigationPolicyNewBackgroundTab; 518 return userPolicy == NavigationPolicyNewBackgroundTab;
519 } 519 }
520 520
521 NavigationPolicy LocalFrameClientImpl::decidePolicyForNavigation( 521 NavigationPolicy LocalFrameClientImpl::decidePolicyForNavigation(
522 const ResourceRequest& request, 522 const ResourceRequest& request,
523 DocumentLoader* loader, 523 DocumentLoader* loader,
524 NavigationType type, 524 NavigationType type,
525 NavigationPolicy policy, 525 NavigationPolicy policy,
526 bool replacesCurrentHistoryItem, 526 bool replacesCurrentHistoryItem,
527 bool isClientRedirect, 527 bool isClientRedirect,
528 HTMLFormElement* form) { 528 HTMLFormElement* form,
529 ContentSecurityPolicyDisposition
530 shouldCheckMainWorldContentSecurityPolicy) {
529 if (!m_webFrame->client()) 531 if (!m_webFrame->client())
530 return NavigationPolicyIgnore; 532 return NavigationPolicyIgnore;
531 533
532 if (policy == NavigationPolicyNewBackgroundTab && 534 if (policy == NavigationPolicyNewBackgroundTab &&
533 !allowCreatingBackgroundTabs() && 535 !allowCreatingBackgroundTabs() &&
534 !UIEventWithKeyState::newTabModifierSetFromIsolatedWorld()) 536 !UIEventWithKeyState::newTabModifierSetFromIsolatedWorld())
535 policy = NavigationPolicyNewForegroundTab; 537 policy = NavigationPolicyNewForegroundTab;
536 538
537 WebDataSourceImpl* ds = WebDataSourceImpl::fromDocumentLoader(loader); 539 WebDataSourceImpl* ds = WebDataSourceImpl::fromDocumentLoader(loader);
538 540
(...skipping 16 matching lines...) Expand all
555 557
556 WrappedResourceRequest wrappedResourceRequest(request); 558 WrappedResourceRequest wrappedResourceRequest(request);
557 WebFrameClient::NavigationPolicyInfo navigationInfo(wrappedResourceRequest); 559 WebFrameClient::NavigationPolicyInfo navigationInfo(wrappedResourceRequest);
558 navigationInfo.navigationType = static_cast<WebNavigationType>(type); 560 navigationInfo.navigationType = static_cast<WebNavigationType>(type);
559 navigationInfo.defaultPolicy = static_cast<WebNavigationPolicy>(policy); 561 navigationInfo.defaultPolicy = static_cast<WebNavigationPolicy>(policy);
560 navigationInfo.extraData = ds ? ds->getExtraData() : nullptr; 562 navigationInfo.extraData = ds ? ds->getExtraData() : nullptr;
561 navigationInfo.replacesCurrentHistoryItem = replacesCurrentHistoryItem; 563 navigationInfo.replacesCurrentHistoryItem = replacesCurrentHistoryItem;
562 navigationInfo.isHistoryNavigationInNewChildFrame = 564 navigationInfo.isHistoryNavigationInNewChildFrame =
563 isHistoryNavigationInNewChildFrame; 565 isHistoryNavigationInNewChildFrame;
564 navigationInfo.isClientRedirect = isClientRedirect; 566 navigationInfo.isClientRedirect = isClientRedirect;
567 navigationInfo.shouldBypassMainWorldCSP =
568 shouldCheckMainWorldContentSecurityPolicy ==
569 DoNotCheckContentSecurityPolicy;
565 // Caching could be disabled for requests initiated by DevTools. 570 // Caching could be disabled for requests initiated by DevTools.
566 // TODO(ananta) 571 // TODO(ananta)
567 // We should extract the network cache state into a global component which 572 // We should extract the network cache state into a global component which
568 // can be queried here and wherever necessary. 573 // can be queried here and wherever necessary.
569 navigationInfo.isCacheDisabled = 574 navigationInfo.isCacheDisabled =
570 devToolsAgent() ? devToolsAgent()->cacheDisabled() : false; 575 devToolsAgent() ? devToolsAgent()->cacheDisabled() : false;
571 if (form) 576 if (form)
572 navigationInfo.form = WebFormElement(form); 577 navigationInfo.form = WebFormElement(form);
573 578
574 WebNavigationPolicy webPolicy = 579 WebNavigationPolicy webPolicy =
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 KURL LocalFrameClientImpl::overrideFlashEmbedWithHTML(const KURL& url) { 1025 KURL LocalFrameClientImpl::overrideFlashEmbedWithHTML(const KURL& url) {
1021 return m_webFrame->client()->overrideFlashEmbedWithHTML(WebURL(url)); 1026 return m_webFrame->client()->overrideFlashEmbedWithHTML(WebURL(url));
1022 } 1027 }
1023 1028
1024 void LocalFrameClientImpl::setHasReceivedUserGesture() { 1029 void LocalFrameClientImpl::setHasReceivedUserGesture() {
1025 if (m_webFrame->client()) 1030 if (m_webFrame->client())
1026 m_webFrame->client()->setHasReceivedUserGesture(); 1031 m_webFrame->client()->setHasReceivedUserGesture();
1027 } 1032 }
1028 1033
1029 } // namespace blink 1034 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698