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