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