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

Side by Side Diff: content/renderer/render_frame_impl.cc

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 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 navigation_type = FrameMsg_Navigate_Type::RELOAD; 677 navigation_type = FrameMsg_Navigate_Type::RELOAD;
678 } 678 }
679 679
680 base::Optional<SourceLocation> source_location; 680 base::Optional<SourceLocation> source_location;
681 if (!info.sourceLocation.url.isNull()) { 681 if (!info.sourceLocation.url.isNull()) {
682 source_location = SourceLocation(info.sourceLocation.url.latin1(), 682 source_location = SourceLocation(info.sourceLocation.url.latin1(),
683 info.sourceLocation.lineNumber, 683 info.sourceLocation.lineNumber,
684 info.sourceLocation.columnNumber); 684 info.sourceLocation.columnNumber);
685 } 685 }
686 686
687 CSPDisposition should_check_main_world_csp =
688 info.shouldCheckMainWorldContentSecurityPolicy ==
689 blink::WebContentSecurityPolicyDispositionCheck
690 ? CSPDisposition::CHECK
691 : CSPDisposition::DO_NOT_CHECK;
692
687 const RequestExtraData* extra_data = 693 const RequestExtraData* extra_data =
688 static_cast<RequestExtraData*>(info.urlRequest.getExtraData()); 694 static_cast<RequestExtraData*>(info.urlRequest.getExtraData());
689 DCHECK(extra_data); 695 DCHECK(extra_data);
690 return CommonNavigationParams( 696 return CommonNavigationParams(
691 info.urlRequest.url(), referrer, extra_data->transition_type(), 697 info.urlRequest.url(), referrer, extra_data->transition_type(),
692 navigation_type, true, info.replacesCurrentHistoryItem, ui_timestamp, 698 navigation_type, true, info.replacesCurrentHistoryItem, ui_timestamp,
693 report_type, GURL(), GURL(), 699 report_type, GURL(), GURL(),
694 static_cast<PreviewsState>(info.urlRequest.getPreviewsState()), 700 static_cast<PreviewsState>(info.urlRequest.getPreviewsState()),
695 base::TimeTicks::Now(), info.urlRequest.httpMethod().latin1(), 701 base::TimeTicks::Now(), info.urlRequest.httpMethod().latin1(),
696 GetRequestBodyForWebURLRequest(info.urlRequest), source_location); 702 GetRequestBodyForWebURLRequest(info.urlRequest), source_location,
703 should_check_main_world_csp);
697 } 704 }
698 705
699 media::Context3D GetSharedMainThreadContext3D( 706 media::Context3D GetSharedMainThreadContext3D(
700 scoped_refptr<ui::ContextProviderCommandBuffer> provider) { 707 scoped_refptr<ui::ContextProviderCommandBuffer> provider) {
701 if (!provider) 708 if (!provider)
702 return media::Context3D(); 709 return media::Context3D();
703 return media::Context3D(provider->ContextGL(), provider->GrContext()); 710 return media::Context3D(provider->ContextGL(), provider->GrContext());
704 } 711 }
705 712
706 WebFrameLoadType ReloadFrameLoadTypeFor( 713 WebFrameLoadType ReloadFrameLoadTypeFor(
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after
1571 IPC_MESSAGE_HANDLER(FrameMsg_CommitNavigation, OnCommitNavigation) 1578 IPC_MESSAGE_HANDLER(FrameMsg_CommitNavigation, OnCommitNavigation)
1572 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateSandboxFlags, OnDidUpdateSandboxFlags) 1579 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateSandboxFlags, OnDidUpdateSandboxFlags)
1573 IPC_MESSAGE_HANDLER(FrameMsg_SetFrameOwnerProperties, 1580 IPC_MESSAGE_HANDLER(FrameMsg_SetFrameOwnerProperties,
1574 OnSetFrameOwnerProperties) 1581 OnSetFrameOwnerProperties)
1575 IPC_MESSAGE_HANDLER(FrameMsg_AdvanceFocus, OnAdvanceFocus) 1582 IPC_MESSAGE_HANDLER(FrameMsg_AdvanceFocus, OnAdvanceFocus)
1576 IPC_MESSAGE_HANDLER(FrameMsg_SetFocusedFrame, OnSetFocusedFrame) 1583 IPC_MESSAGE_HANDLER(FrameMsg_SetFocusedFrame, OnSetFocusedFrame)
1577 IPC_MESSAGE_HANDLER(FrameMsg_SetTextTrackSettings, 1584 IPC_MESSAGE_HANDLER(FrameMsg_SetTextTrackSettings,
1578 OnTextTrackSettingsChanged) 1585 OnTextTrackSettingsChanged)
1579 IPC_MESSAGE_HANDLER(FrameMsg_PostMessageEvent, OnPostMessageEvent) 1586 IPC_MESSAGE_HANDLER(FrameMsg_PostMessageEvent, OnPostMessageEvent)
1580 IPC_MESSAGE_HANDLER(FrameMsg_FailedNavigation, OnFailedNavigation) 1587 IPC_MESSAGE_HANDLER(FrameMsg_FailedNavigation, OnFailedNavigation)
1588 IPC_MESSAGE_HANDLER(FrameMsg_ReportContentSecurityPolicyViolation,
1589 OnReportContentSecurityPolicyViolation)
1581 IPC_MESSAGE_HANDLER(FrameMsg_GetSavableResourceLinks, 1590 IPC_MESSAGE_HANDLER(FrameMsg_GetSavableResourceLinks,
1582 OnGetSavableResourceLinks) 1591 OnGetSavableResourceLinks)
1583 IPC_MESSAGE_HANDLER(FrameMsg_GetSerializedHtmlWithLocalLinks, 1592 IPC_MESSAGE_HANDLER(FrameMsg_GetSerializedHtmlWithLocalLinks,
1584 OnGetSerializedHtmlWithLocalLinks) 1593 OnGetSerializedHtmlWithLocalLinks)
1585 IPC_MESSAGE_HANDLER(FrameMsg_SerializeAsMHTML, OnSerializeAsMHTML) 1594 IPC_MESSAGE_HANDLER(FrameMsg_SerializeAsMHTML, OnSerializeAsMHTML)
1586 IPC_MESSAGE_HANDLER(FrameMsg_Find, OnFind) 1595 IPC_MESSAGE_HANDLER(FrameMsg_Find, OnFind)
1587 IPC_MESSAGE_HANDLER(FrameMsg_ClearActiveFindMatch, OnClearActiveFindMatch) 1596 IPC_MESSAGE_HANDLER(FrameMsg_ClearActiveFindMatch, OnClearActiveFindMatch)
1588 IPC_MESSAGE_HANDLER(FrameMsg_StopFinding, OnStopFinding) 1597 IPC_MESSAGE_HANDLER(FrameMsg_StopFinding, OnStopFinding)
1589 IPC_MESSAGE_HANDLER(FrameMsg_EnableViewSourceMode, OnEnableViewSourceMode) 1598 IPC_MESSAGE_HANDLER(FrameMsg_EnableViewSourceMode, OnEnableViewSourceMode)
1590 IPC_MESSAGE_HANDLER(FrameMsg_SuppressFurtherDialogs, 1599 IPC_MESSAGE_HANDLER(FrameMsg_SuppressFurtherDialogs,
(...skipping 3660 matching lines...) Expand 10 before | Expand all | Expand 10 after
5251 // provisionalDataSource(), LoadNavigationErrorPage wasn't called, so do it 5260 // provisionalDataSource(), LoadNavigationErrorPage wasn't called, so do it
5252 // now. 5261 // now.
5253 if (request_params.nav_entry_id != 0 || !had_provisional_data_source) { 5262 if (request_params.nav_entry_id != 0 || !had_provisional_data_source) {
5254 LoadNavigationErrorPage(failed_request, error, replace, 5263 LoadNavigationErrorPage(failed_request, error, replace,
5255 history_entry.get()); 5264 history_entry.get());
5256 } 5265 }
5257 5266
5258 browser_side_navigation_pending_ = false; 5267 browser_side_navigation_pending_ = false;
5259 } 5268 }
5260 5269
5270 void RenderFrameImpl::OnReportContentSecurityPolicyViolation(
5271 const content::CSPViolationParams& violation_params) {
5272 frame_->reportContentSecurityPolicyViolation(
5273 BuildWebContentSecurityPolicyViolation(violation_params));
5274 }
5275
5261 WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation( 5276 WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
5262 const NavigationPolicyInfo& info) { 5277 const NavigationPolicyInfo& info) {
5263 // A content initiated navigation may have originated from a link-click, 5278 // A content initiated navigation may have originated from a link-click,
5264 // script, drag-n-drop operation, etc. 5279 // script, drag-n-drop operation, etc.
5265 // info.extraData is only non-null if this is a redirect. Use the extraData 5280 // info.extraData is only non-null if this is a redirect. Use the extraData
5266 // initiation information for redirects, and check pending_navigation_params_ 5281 // initiation information for redirects, and check pending_navigation_params_
5267 // otherwise. 5282 // otherwise.
5268 bool is_content_initiated = 5283 bool is_content_initiated =
5269 info.extraData 5284 info.extraData
5270 ? static_cast<DocumentState*>(info.extraData) 5285 ? static_cast<DocumentState*>(info.extraData)
(...skipping 1627 matching lines...) Expand 10 before | Expand all | Expand 10 after
6898 // event target. Potentially a Pepper plugin will receive the event. 6913 // event target. Potentially a Pepper plugin will receive the event.
6899 // In order to tell whether a plugin gets the last mouse event and which it 6914 // In order to tell whether a plugin gets the last mouse event and which it
6900 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6915 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6901 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6916 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6902 // |pepper_last_mouse_event_target_|. 6917 // |pepper_last_mouse_event_target_|.
6903 pepper_last_mouse_event_target_ = nullptr; 6918 pepper_last_mouse_event_target_ = nullptr;
6904 #endif 6919 #endif
6905 } 6920 }
6906 6921
6907 } // namespace content 6922 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | third_party/WebKit/LayoutTests/FlagExpectations/enable-browser-side-navigation » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698