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