OLD | NEW |
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 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ |
6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ | 6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "base/time/time.h" | 24 #include "base/time/time.h" |
25 #include "build/build_config.h" | 25 #include "build/build_config.h" |
26 #include "content/browser/accessibility/browser_accessibility_manager.h" | 26 #include "content/browser/accessibility/browser_accessibility_manager.h" |
27 #include "content/browser/bad_message.h" | 27 #include "content/browser/bad_message.h" |
28 #include "content/browser/loader/global_routing_id.h" | 28 #include "content/browser/loader/global_routing_id.h" |
29 #include "content/browser/site_instance_impl.h" | 29 #include "content/browser/site_instance_impl.h" |
30 #include "content/browser/webui/web_ui_impl.h" | 30 #include "content/browser/webui/web_ui_impl.h" |
31 #include "content/common/accessibility_mode.h" | 31 #include "content/common/accessibility_mode.h" |
32 #include "content/common/ax_content_node_data.h" | 32 #include "content/common/ax_content_node_data.h" |
33 #include "content/common/content_export.h" | 33 #include "content/common/content_export.h" |
34 #include "content/common/content_security_policy/content_security_policy.h" | 34 #include "content/common/content_security_policy/csp_context.h" |
35 #include "content/common/download/mhtml_save_status.h" | 35 #include "content/common/download/mhtml_save_status.h" |
36 #include "content/common/features.h" | 36 #include "content/common/features.h" |
37 #include "content/common/frame.mojom.h" | 37 #include "content/common/frame.mojom.h" |
38 #include "content/common/frame_message_enums.h" | 38 #include "content/common/frame_message_enums.h" |
39 #include "content/common/frame_replication_state.h" | 39 #include "content/common/frame_replication_state.h" |
40 #include "content/common/image_downloader/image_downloader.mojom.h" | 40 #include "content/common/image_downloader/image_downloader.mojom.h" |
41 #include "content/common/navigation_params.h" | 41 #include "content/common/navigation_params.h" |
42 #include "content/public/browser/render_frame_host.h" | 42 #include "content/public/browser/render_frame_host.h" |
43 #include "content/public/common/javascript_dialog_type.h" | 43 #include "content/public/common/javascript_dialog_type.h" |
44 #include "content/public/common/previews_state.h" | 44 #include "content/public/common/previews_state.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 class CreateNewWindowParams; | 111 class CreateNewWindowParams; |
112 } | 112 } |
113 | 113 |
114 class CONTENT_EXPORT RenderFrameHostImpl | 114 class CONTENT_EXPORT RenderFrameHostImpl |
115 : public RenderFrameHost, | 115 : public RenderFrameHost, |
116 public base::SupportsUserData, | 116 public base::SupportsUserData, |
117 NON_EXPORTED_BASE(public mojom::FrameHost), | 117 NON_EXPORTED_BASE(public mojom::FrameHost), |
118 public BrowserAccessibilityDelegate, | 118 public BrowserAccessibilityDelegate, |
119 public SiteInstanceImpl::Observer, | 119 public SiteInstanceImpl::Observer, |
120 public NON_EXPORTED_BASE( | 120 public NON_EXPORTED_BASE( |
121 service_manager::InterfaceFactory<media::mojom::InterfaceFactory>) { | 121 service_manager::InterfaceFactory<media::mojom::InterfaceFactory>), |
| 122 public CSPContext { |
122 public: | 123 public: |
123 using AXTreeSnapshotCallback = | 124 using AXTreeSnapshotCallback = |
124 base::Callback<void( | 125 base::Callback<void( |
125 const ui::AXTreeUpdate&)>; | 126 const ui::AXTreeUpdate&)>; |
126 using SmartClipCallback = base::Callback<void(const base::string16& text, | 127 using SmartClipCallback = base::Callback<void(const base::string16& text, |
127 const base::string16& html)>; | 128 const base::string16& html)>; |
128 | 129 |
129 // An accessibility reset is only allowed to prevent very rare corner cases | 130 // An accessibility reset is only allowed to prevent very rare corner cases |
130 // or race conditions where the browser and renderer get out of sync. If | 131 // or race conditions where the browser and renderer get out of sync. If |
131 // this happens more than this many times, kill the renderer. | 132 // this happens more than this many times, kill the renderer. |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 gfx::Rect AccessibilityGetViewBounds() const override; | 205 gfx::Rect AccessibilityGetViewBounds() const override; |
205 gfx::Point AccessibilityOriginInScreen( | 206 gfx::Point AccessibilityOriginInScreen( |
206 const gfx::Rect& bounds) const override; | 207 const gfx::Rect& bounds) const override; |
207 void AccessibilityFatalError() override; | 208 void AccessibilityFatalError() override; |
208 gfx::AcceleratedWidget AccessibilityGetAcceleratedWidget() override; | 209 gfx::AcceleratedWidget AccessibilityGetAcceleratedWidget() override; |
209 gfx::NativeViewAccessible AccessibilityGetNativeViewAccessible() override; | 210 gfx::NativeViewAccessible AccessibilityGetNativeViewAccessible() override; |
210 | 211 |
211 // SiteInstanceImpl::Observer | 212 // SiteInstanceImpl::Observer |
212 void RenderProcessGone(SiteInstanceImpl* site_instance) override; | 213 void RenderProcessGone(SiteInstanceImpl* site_instance) override; |
213 | 214 |
| 215 // CSPContext |
| 216 void LogToConsole(const std::string& message) override; |
| 217 void ReportContentSecurityPolicyViolation( |
| 218 const CSPViolationParams& violation_params) override; |
| 219 bool SchemeShouldBypassCSP(const base::StringPiece& scheme) override; |
| 220 |
214 // Creates a RenderFrame in the renderer process. | 221 // Creates a RenderFrame in the renderer process. |
215 bool CreateRenderFrame(int proxy_routing_id, | 222 bool CreateRenderFrame(int proxy_routing_id, |
216 int opener_routing_id, | 223 int opener_routing_id, |
217 int parent_routing_id, | 224 int parent_routing_id, |
218 int previous_sibling_routing_id); | 225 int previous_sibling_routing_id); |
219 | 226 |
220 // Tracks whether the RenderFrame for this RenderFrameHost has been created in | 227 // Tracks whether the RenderFrame for this RenderFrameHost has been created in |
221 // the renderer process. This is currently only used for subframes. | 228 // the renderer process. This is currently only used for subframes. |
222 // TODO(creis): Use this for main frames as well when RVH goes away. | 229 // TODO(creis): Use this for main frames as well when RVH goes away. |
223 void SetRenderFrameCreated(bool created); | 230 void SetRenderFrameCreated(bool created); |
(...skipping 18 matching lines...) Expand all Loading... |
242 // Called when this frame tries to open a new WebContents, e.g. via a script | 249 // Called when this frame tries to open a new WebContents, e.g. via a script |
243 // call to window.open(). The renderer has already been told to create the | 250 // call to window.open(). The renderer has already been told to create the |
244 // RenderView and RenderFrame with the specified route ids, which were | 251 // RenderView and RenderFrame with the specified route ids, which were |
245 // assigned on the IO thread. | 252 // assigned on the IO thread. |
246 void OnCreateNewWindow(int32_t render_view_route_id, | 253 void OnCreateNewWindow(int32_t render_view_route_id, |
247 int32_t main_frame_route_id, | 254 int32_t main_frame_route_id, |
248 int32_t main_frame_widget_route_id, | 255 int32_t main_frame_widget_route_id, |
249 const mojom::CreateNewWindowParams& params, | 256 const mojom::CreateNewWindowParams& params, |
250 SessionStorageNamespace* session_storage_namespace); | 257 SessionStorageNamespace* session_storage_namespace); |
251 | 258 |
| 259 // Update this frame's last committed origin. |
| 260 void SetLastCommittedOrigin(const url::Origin& origin); |
| 261 |
252 RenderViewHostImpl* render_view_host() { return render_view_host_; } | 262 RenderViewHostImpl* render_view_host() { return render_view_host_; } |
253 RenderFrameHostDelegate* delegate() { return delegate_; } | 263 RenderFrameHostDelegate* delegate() { return delegate_; } |
254 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } | 264 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } |
255 | 265 |
256 const GURL& last_committed_url() const { return last_committed_url_; } | 266 const GURL& last_committed_url() const { return last_committed_url_; } |
257 | 267 |
258 // Allows FrameTreeNode::SetCurrentURL to update this frame's last committed | 268 // Allows FrameTreeNode::SetCurrentURL to update this frame's last committed |
259 // URL. Do not call this directly, since we rely on SetCurrentURL to track | 269 // URL. Do not call this directly, since we rely on SetCurrentURL to track |
260 // whether a real load has committed or not. | 270 // whether a real load has committed or not. |
261 void set_last_committed_url(const GURL& url) { | 271 void set_last_committed_url(const GURL& url) { |
262 last_committed_url_ = url; | 272 last_committed_url_ = url; |
263 } | 273 } |
264 | 274 |
265 // The most recent non-net-error URL to commit in this frame. In almost all | 275 // The most recent non-net-error URL to commit in this frame. In almost all |
266 // cases, use GetLastCommittedURL instead. | 276 // cases, use GetLastCommittedURL instead. |
267 const GURL& last_successful_url() { return last_successful_url_; } | 277 const GURL& last_successful_url() { return last_successful_url_; } |
268 void set_last_successful_url(const GURL& url) { | 278 void set_last_successful_url(const GURL& url) { |
269 last_successful_url_ = url; | 279 last_successful_url_ = url; |
270 } | 280 } |
271 | 281 |
272 // Update this frame's last committed origin. | |
273 void set_last_committed_origin(const url::Origin& origin) { | |
274 last_committed_origin_ = origin; | |
275 } | |
276 | |
277 // Returns the associated WebUI or null if none applies. | 282 // Returns the associated WebUI or null if none applies. |
278 WebUIImpl* web_ui() const { return web_ui_.get(); } | 283 WebUIImpl* web_ui() const { return web_ui_.get(); } |
279 | 284 |
280 // Returns the pending WebUI, or null if none applies. | 285 // Returns the pending WebUI, or null if none applies. |
281 WebUIImpl* pending_web_ui() const { | 286 WebUIImpl* pending_web_ui() const { |
282 return should_reuse_web_ui_ ? web_ui_.get() : pending_web_ui_.get(); | 287 return should_reuse_web_ui_ ? web_ui_.get() : pending_web_ui_.get(); |
283 } | 288 } |
284 | 289 |
285 // Returns this RenderFrameHost's loading state. This method is only used by | 290 // Returns this RenderFrameHost's loading state. This method is only used by |
286 // FrameTreeNode. The proper way to check whether a frame is loading is to | 291 // FrameTreeNode. The proper way to check whether a frame is loading is to |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 IPC::Message* reply_msg); | 716 IPC::Message* reply_msg); |
712 void OnRunFileChooser(const FileChooserParams& params); | 717 void OnRunFileChooser(const FileChooserParams& params); |
713 void OnTextSurroundingSelectionResponse(const base::string16& content, | 718 void OnTextSurroundingSelectionResponse(const base::string16& content, |
714 uint32_t start_offset, | 719 uint32_t start_offset, |
715 uint32_t end_offset); | 720 uint32_t end_offset); |
716 void OnDidAccessInitialDocument(); | 721 void OnDidAccessInitialDocument(); |
717 void OnDidChangeOpener(int32_t opener_routing_id); | 722 void OnDidChangeOpener(int32_t opener_routing_id); |
718 void OnDidChangeName(const std::string& name, const std::string& unique_name); | 723 void OnDidChangeName(const std::string& name, const std::string& unique_name); |
719 void OnDidSetFeaturePolicyHeader( | 724 void OnDidSetFeaturePolicyHeader( |
720 const ParsedFeaturePolicyHeader& parsed_header); | 725 const ParsedFeaturePolicyHeader& parsed_header); |
| 726 |
| 727 // A CSP |header| has been added. |
| 728 // RFC2616, section 4.2 specifies that headers appearing multiple times can be |
| 729 // combined with a comma. Hence zero, one or several |policies| are added to |
| 730 // the document. |
721 void OnDidAddContentSecurityPolicy( | 731 void OnDidAddContentSecurityPolicy( |
722 const ContentSecurityPolicyHeader& header, | 732 const ContentSecurityPolicyHeader& header, |
723 const std::vector<ContentSecurityPolicy>& policy); | 733 const std::vector<ContentSecurityPolicy>& policies); |
| 734 |
724 void OnEnforceInsecureRequestPolicy(blink::WebInsecureRequestPolicy policy); | 735 void OnEnforceInsecureRequestPolicy(blink::WebInsecureRequestPolicy policy); |
725 void OnUpdateToUniqueOrigin(bool is_potentially_trustworthy_unique_origin); | 736 void OnUpdateToUniqueOrigin(bool is_potentially_trustworthy_unique_origin); |
726 void OnDidChangeSandboxFlags(int32_t frame_routing_id, | 737 void OnDidChangeSandboxFlags(int32_t frame_routing_id, |
727 blink::WebSandboxFlags flags); | 738 blink::WebSandboxFlags flags); |
728 void OnDidChangeFrameOwnerProperties(int32_t frame_routing_id, | 739 void OnDidChangeFrameOwnerProperties(int32_t frame_routing_id, |
729 const FrameOwnerProperties& properties); | 740 const FrameOwnerProperties& properties); |
730 void OnUpdateTitle(const base::string16& title, | 741 void OnUpdateTitle(const base::string16& title, |
731 blink::WebTextDirection title_direction); | 742 blink::WebTextDirection title_direction); |
732 void OnUpdateEncoding(const std::string& encoding); | 743 void OnUpdateEncoding(const std::string& encoding); |
733 void OnBeginNavigation(const CommonNavigationParams& common_params, | 744 void OnBeginNavigation(const CommonNavigationParams& common_params, |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1151 | 1162 |
1152 // NOTE: This must be the last member. | 1163 // NOTE: This must be the last member. |
1153 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; | 1164 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; |
1154 | 1165 |
1155 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); | 1166 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); |
1156 }; | 1167 }; |
1157 | 1168 |
1158 } // namespace content | 1169 } // namespace content |
1159 | 1170 |
1160 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ | 1171 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ |
OLD | NEW |