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

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

Issue 2727633005: PlzNavigate: Enforce frame-src CSP on the browser. (Closed)
Patch Set: Addressed Alex's comments + trying to fix subframe swap issue 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 677
678 const RequestExtraData* extra_data = 678 const RequestExtraData* extra_data =
679 static_cast<RequestExtraData*>(info.urlRequest.getExtraData()); 679 static_cast<RequestExtraData*>(info.urlRequest.getExtraData());
680 DCHECK(extra_data); 680 DCHECK(extra_data);
681 return CommonNavigationParams( 681 return CommonNavigationParams(
682 info.urlRequest.url(), referrer, extra_data->transition_type(), 682 info.urlRequest.url(), referrer, extra_data->transition_type(),
683 navigation_type, true, info.replacesCurrentHistoryItem, ui_timestamp, 683 navigation_type, true, info.replacesCurrentHistoryItem, ui_timestamp,
684 report_type, GURL(), GURL(), 684 report_type, GURL(), GURL(),
685 static_cast<PreviewsState>(info.urlRequest.getPreviewsState()), 685 static_cast<PreviewsState>(info.urlRequest.getPreviewsState()),
686 base::TimeTicks::Now(), info.urlRequest.httpMethod().latin1(), 686 base::TimeTicks::Now(), info.urlRequest.httpMethod().latin1(),
687 GetRequestBodyForWebURLRequest(info.urlRequest)); 687 GetRequestBodyForWebURLRequest(info.urlRequest),
688 info.shouldBypassMainWorldCSP);
688 } 689 }
689 690
690 media::Context3D GetSharedMainThreadContext3D( 691 media::Context3D GetSharedMainThreadContext3D(
691 scoped_refptr<ui::ContextProviderCommandBuffer> provider) { 692 scoped_refptr<ui::ContextProviderCommandBuffer> provider) {
692 if (!provider) 693 if (!provider)
693 return media::Context3D(); 694 return media::Context3D();
694 return media::Context3D(provider->ContextGL(), provider->GrContext()); 695 return media::Context3D(provider->ContextGL(), provider->GrContext());
695 } 696 }
696 697
697 WebFrameLoadType ReloadFrameLoadTypeFor( 698 WebFrameLoadType ReloadFrameLoadTypeFor(
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after
1563 IPC_MESSAGE_HANDLER(FrameMsg_CommitNavigation, OnCommitNavigation) 1564 IPC_MESSAGE_HANDLER(FrameMsg_CommitNavigation, OnCommitNavigation)
1564 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateSandboxFlags, OnDidUpdateSandboxFlags) 1565 IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateSandboxFlags, OnDidUpdateSandboxFlags)
1565 IPC_MESSAGE_HANDLER(FrameMsg_SetFrameOwnerProperties, 1566 IPC_MESSAGE_HANDLER(FrameMsg_SetFrameOwnerProperties,
1566 OnSetFrameOwnerProperties) 1567 OnSetFrameOwnerProperties)
1567 IPC_MESSAGE_HANDLER(FrameMsg_AdvanceFocus, OnAdvanceFocus) 1568 IPC_MESSAGE_HANDLER(FrameMsg_AdvanceFocus, OnAdvanceFocus)
1568 IPC_MESSAGE_HANDLER(FrameMsg_SetFocusedFrame, OnSetFocusedFrame) 1569 IPC_MESSAGE_HANDLER(FrameMsg_SetFocusedFrame, OnSetFocusedFrame)
1569 IPC_MESSAGE_HANDLER(FrameMsg_SetTextTrackSettings, 1570 IPC_MESSAGE_HANDLER(FrameMsg_SetTextTrackSettings,
1570 OnTextTrackSettingsChanged) 1571 OnTextTrackSettingsChanged)
1571 IPC_MESSAGE_HANDLER(FrameMsg_PostMessageEvent, OnPostMessageEvent) 1572 IPC_MESSAGE_HANDLER(FrameMsg_PostMessageEvent, OnPostMessageEvent)
1572 IPC_MESSAGE_HANDLER(FrameMsg_FailedNavigation, OnFailedNavigation) 1573 IPC_MESSAGE_HANDLER(FrameMsg_FailedNavigation, OnFailedNavigation)
1574 IPC_MESSAGE_HANDLER(FrameMsg_ReportContentSecurityPolicyViolation,
1575 OnReportContentSecurityPolicyViolation)
1573 IPC_MESSAGE_HANDLER(FrameMsg_GetSavableResourceLinks, 1576 IPC_MESSAGE_HANDLER(FrameMsg_GetSavableResourceLinks,
1574 OnGetSavableResourceLinks) 1577 OnGetSavableResourceLinks)
1575 IPC_MESSAGE_HANDLER(FrameMsg_GetSerializedHtmlWithLocalLinks, 1578 IPC_MESSAGE_HANDLER(FrameMsg_GetSerializedHtmlWithLocalLinks,
1576 OnGetSerializedHtmlWithLocalLinks) 1579 OnGetSerializedHtmlWithLocalLinks)
1577 IPC_MESSAGE_HANDLER(FrameMsg_SerializeAsMHTML, OnSerializeAsMHTML) 1580 IPC_MESSAGE_HANDLER(FrameMsg_SerializeAsMHTML, OnSerializeAsMHTML)
1578 IPC_MESSAGE_HANDLER(FrameMsg_Find, OnFind) 1581 IPC_MESSAGE_HANDLER(FrameMsg_Find, OnFind)
1579 IPC_MESSAGE_HANDLER(FrameMsg_ClearActiveFindMatch, OnClearActiveFindMatch) 1582 IPC_MESSAGE_HANDLER(FrameMsg_ClearActiveFindMatch, OnClearActiveFindMatch)
1580 IPC_MESSAGE_HANDLER(FrameMsg_StopFinding, OnStopFinding) 1583 IPC_MESSAGE_HANDLER(FrameMsg_StopFinding, OnStopFinding)
1581 IPC_MESSAGE_HANDLER(FrameMsg_EnableViewSourceMode, OnEnableViewSourceMode) 1584 IPC_MESSAGE_HANDLER(FrameMsg_EnableViewSourceMode, OnEnableViewSourceMode)
1582 IPC_MESSAGE_HANDLER(FrameMsg_SuppressFurtherDialogs, 1585 IPC_MESSAGE_HANDLER(FrameMsg_SuppressFurtherDialogs,
(...skipping 3638 matching lines...) Expand 10 before | Expand all | Expand 10 after
5221 history_entry = PageStateToHistoryEntry(request_params.page_state); 5224 history_entry = PageStateToHistoryEntry(request_params.page_state);
5222 5225
5223 // For renderer initiated navigations, we send out a didFailProvisionalLoad() 5226 // For renderer initiated navigations, we send out a didFailProvisionalLoad()
5224 // notification. 5227 // notification.
5225 if (request_params.nav_entry_id == 0) 5228 if (request_params.nav_entry_id == 0)
5226 didFailProvisionalLoad(frame_, error, blink::WebStandardCommit); 5229 didFailProvisionalLoad(frame_, error, blink::WebStandardCommit);
5227 LoadNavigationErrorPage(failed_request, error, replace, history_entry.get()); 5230 LoadNavigationErrorPage(failed_request, error, replace, history_entry.get());
5228 browser_side_navigation_pending_ = false; 5231 browser_side_navigation_pending_ = false;
5229 } 5232 }
5230 5233
5234 void RenderFrameImpl::OnReportContentSecurityPolicyViolation(
5235 const content::CSPViolationParams& violation_params) {
5236 frame_->reportContentSecurityPolicyViolation(
5237 BuildWebContentSecurityPolicyViolation(violation_params));
5238 }
5239
5231 WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation( 5240 WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
5232 const NavigationPolicyInfo& info) { 5241 const NavigationPolicyInfo& info) {
5233 // A content initiated navigation may have originated from a link-click, 5242 // A content initiated navigation may have originated from a link-click,
5234 // script, drag-n-drop operation, etc. 5243 // script, drag-n-drop operation, etc.
5235 // info.extraData is only non-null if this is a redirect. Use the extraData 5244 // info.extraData is only non-null if this is a redirect. Use the extraData
5236 // initiation information for redirects, and check pending_navigation_params_ 5245 // initiation information for redirects, and check pending_navigation_params_
5237 // otherwise. 5246 // otherwise.
5238 bool is_content_initiated = 5247 bool is_content_initiated =
5239 info.extraData 5248 info.extraData
5240 ? static_cast<DocumentState*>(info.extraData) 5249 ? static_cast<DocumentState*>(info.extraData)
(...skipping 1608 matching lines...) Expand 10 before | Expand all | Expand 10 after
6849 // event target. Potentially a Pepper plugin will receive the event. 6858 // event target. Potentially a Pepper plugin will receive the event.
6850 // In order to tell whether a plugin gets the last mouse event and which it 6859 // In order to tell whether a plugin gets the last mouse event and which it
6851 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6860 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6852 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6861 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6853 // |pepper_last_mouse_event_target_|. 6862 // |pepper_last_mouse_event_target_|.
6854 pepper_last_mouse_event_target_ = nullptr; 6863 pepper_last_mouse_event_target_ = nullptr;
6855 #endif 6864 #endif
6856 } 6865 }
6857 6866
6858 } // namespace content 6867 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698