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

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

Issue 2655463006: PlzNavigate: Enforce 'frame-src' CSP on the browser. (Closed)
Patch Set: Fix tests. Created 3 years, 10 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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 return userPolicy == NavigationPolicyNewBackgroundTab; 504 return userPolicy == NavigationPolicyNewBackgroundTab;
505 } 505 }
506 506
507 NavigationPolicy FrameLoaderClientImpl::decidePolicyForNavigation( 507 NavigationPolicy FrameLoaderClientImpl::decidePolicyForNavigation(
508 const ResourceRequest& request, 508 const ResourceRequest& request,
509 DocumentLoader* loader, 509 DocumentLoader* loader,
510 NavigationType type, 510 NavigationType type,
511 NavigationPolicy policy, 511 NavigationPolicy policy,
512 bool replacesCurrentHistoryItem, 512 bool replacesCurrentHistoryItem,
513 bool isClientRedirect, 513 bool isClientRedirect,
514 HTMLFormElement* form) { 514 HTMLFormElement* form,
515 ContentSecurityPolicyDisposition shouldBypassMainWorldCSP) {
515 if (!m_webFrame->client()) 516 if (!m_webFrame->client())
516 return NavigationPolicyIgnore; 517 return NavigationPolicyIgnore;
517 518
518 if (policy == NavigationPolicyNewBackgroundTab && 519 if (policy == NavigationPolicyNewBackgroundTab &&
519 !allowCreatingBackgroundTabs() && 520 !allowCreatingBackgroundTabs() &&
520 !UIEventWithKeyState::newTabModifierSetFromIsolatedWorld()) 521 !UIEventWithKeyState::newTabModifierSetFromIsolatedWorld())
521 policy = NavigationPolicyNewForegroundTab; 522 policy = NavigationPolicyNewForegroundTab;
522 523
523 WebDataSourceImpl* ds = WebDataSourceImpl::fromDocumentLoader(loader); 524 WebDataSourceImpl* ds = WebDataSourceImpl::fromDocumentLoader(loader);
524 525
(...skipping 16 matching lines...) Expand all
541 542
542 WrappedResourceRequest wrappedResourceRequest(request); 543 WrappedResourceRequest wrappedResourceRequest(request);
543 WebFrameClient::NavigationPolicyInfo navigationInfo(wrappedResourceRequest); 544 WebFrameClient::NavigationPolicyInfo navigationInfo(wrappedResourceRequest);
544 navigationInfo.navigationType = static_cast<WebNavigationType>(type); 545 navigationInfo.navigationType = static_cast<WebNavigationType>(type);
545 navigationInfo.defaultPolicy = static_cast<WebNavigationPolicy>(policy); 546 navigationInfo.defaultPolicy = static_cast<WebNavigationPolicy>(policy);
546 navigationInfo.extraData = ds ? ds->getExtraData() : nullptr; 547 navigationInfo.extraData = ds ? ds->getExtraData() : nullptr;
547 navigationInfo.replacesCurrentHistoryItem = replacesCurrentHistoryItem; 548 navigationInfo.replacesCurrentHistoryItem = replacesCurrentHistoryItem;
548 navigationInfo.isHistoryNavigationInNewChildFrame = 549 navigationInfo.isHistoryNavigationInNewChildFrame =
549 isHistoryNavigationInNewChildFrame; 550 isHistoryNavigationInNewChildFrame;
550 navigationInfo.isClientRedirect = isClientRedirect; 551 navigationInfo.isClientRedirect = isClientRedirect;
552 navigationInfo.shouldBypassMainWorldCSP =
553 shouldBypassMainWorldCSP == DoNotCheckContentSecurityPolicy;
551 // Caching could be disabled for requests initiated by DevTools. 554 // Caching could be disabled for requests initiated by DevTools.
552 // TODO(ananta) 555 // TODO(ananta)
553 // We should extract the network cache state into a global component which 556 // We should extract the network cache state into a global component which
554 // can be queried here and wherever necessary. 557 // can be queried here and wherever necessary.
555 navigationInfo.isCacheDisabled = 558 navigationInfo.isCacheDisabled =
556 devToolsAgent() ? devToolsAgent()->cacheDisabled() : false; 559 devToolsAgent() ? devToolsAgent()->cacheDisabled() : false;
557 if (form) 560 if (form)
558 navigationInfo.form = WebFormElement(form); 561 navigationInfo.form = WebFormElement(form);
559 562
560 WebNavigationPolicy webPolicy = 563 WebNavigationPolicy webPolicy =
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 KURL FrameLoaderClientImpl::overrideFlashEmbedWithHTML(const KURL& url) { 1006 KURL FrameLoaderClientImpl::overrideFlashEmbedWithHTML(const KURL& url) {
1004 return m_webFrame->client()->overrideFlashEmbedWithHTML(WebURL(url)); 1007 return m_webFrame->client()->overrideFlashEmbedWithHTML(WebURL(url));
1005 } 1008 }
1006 1009
1007 void FrameLoaderClientImpl::setHasReceivedUserGesture() { 1010 void FrameLoaderClientImpl::setHasReceivedUserGesture() {
1008 if (m_webFrame->client()) 1011 if (m_webFrame->client())
1009 m_webFrame->client()->setHasReceivedUserGesture(); 1012 m_webFrame->client()->setHasReceivedUserGesture();
1010 } 1013 }
1011 1014
1012 } // namespace blink 1015 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698