Chromium Code Reviews| 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 |
| 11 #include <list> | 11 #include <list> |
| 12 #include <map> | 12 #include <map> |
| 13 #include <set> | 13 #include <set> |
| 14 #include <string> | 14 #include <string> |
| 15 #include <vector> | 15 #include <vector> |
| 16 | 16 |
| 17 #include "base/callback.h" | 17 #include "base/callback.h" |
| 18 #include "base/compiler_specific.h" | 18 #include "base/compiler_specific.h" |
| 19 #include "base/gtest_prod_util.h" | 19 #include "base/gtest_prod_util.h" |
| 20 #include "base/macros.h" | 20 #include "base/macros.h" |
| 21 #include "base/memory/weak_ptr.h" | 21 #include "base/memory/weak_ptr.h" |
| 22 #include "base/strings/string16.h" | 22 #include "base/strings/string16.h" |
| 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/frame_host/csp_context_impl.h" | |
| 27 #include "content/browser/loader/global_routing_id.h" | 28 #include "content/browser/loader/global_routing_id.h" |
| 28 #include "content/browser/site_instance_impl.h" | 29 #include "content/browser/site_instance_impl.h" |
| 29 #include "content/browser/webui/web_ui_impl.h" | 30 #include "content/browser/webui/web_ui_impl.h" |
| 30 #include "content/common/accessibility_mode_enums.h" | 31 #include "content/common/accessibility_mode_enums.h" |
| 31 #include "content/common/ax_content_node_data.h" | 32 #include "content/common/ax_content_node_data.h" |
| 32 #include "content/common/content_export.h" | 33 #include "content/common/content_export.h" |
| 33 #include "content/common/content_security_policy/content_security_policy.h" | 34 #include "content/common/content_security_policy/csp_context.h" |
| 34 #include "content/common/download/mhtml_save_status.h" | 35 #include "content/common/download/mhtml_save_status.h" |
| 35 #include "content/common/frame.mojom.h" | 36 #include "content/common/frame.mojom.h" |
| 36 #include "content/common/frame_message_enums.h" | 37 #include "content/common/frame_message_enums.h" |
| 37 #include "content/common/frame_replication_state.h" | 38 #include "content/common/frame_replication_state.h" |
| 38 #include "content/common/image_downloader/image_downloader.mojom.h" | 39 #include "content/common/image_downloader/image_downloader.mojom.h" |
| 39 #include "content/common/navigation_params.h" | 40 #include "content/common/navigation_params.h" |
| 40 #include "content/public/browser/render_frame_host.h" | 41 #include "content/public/browser/render_frame_host.h" |
| 41 #include "content/public/common/javascript_dialog_type.h" | 42 #include "content/public/common/javascript_dialog_type.h" |
| 42 #include "content/public/common/previews_state.h" | 43 #include "content/public/common/previews_state.h" |
| 43 #include "media/mojo/interfaces/interface_factory.mojom.h" | 44 #include "media/mojo/interfaces/interface_factory.mojom.h" |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 264 // 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 |
| 265 // cases, use GetLastCommittedURL instead. | 266 // cases, use GetLastCommittedURL instead. |
| 266 const GURL& last_successful_url() { return last_successful_url_; } | 267 const GURL& last_successful_url() { return last_successful_url_; } |
| 267 void set_last_successful_url(const GURL& url) { | 268 void set_last_successful_url(const GURL& url) { |
| 268 last_successful_url_ = url; | 269 last_successful_url_ = url; |
| 269 } | 270 } |
| 270 | 271 |
| 271 // Update this frame's last committed origin. | 272 // Update this frame's last committed origin. |
| 272 void set_last_committed_origin(const url::Origin& origin) { | 273 void set_last_committed_origin(const url::Origin& origin) { |
| 273 last_committed_origin_ = origin; | 274 last_committed_origin_ = origin; |
| 275 csp_context_->SetSelf(origin); | |
| 274 } | 276 } |
| 275 | 277 |
| 276 // Returns the associated WebUI or null if none applies. | 278 // Returns the associated WebUI or null if none applies. |
| 277 WebUIImpl* web_ui() const { return web_ui_.get(); } | 279 WebUIImpl* web_ui() const { return web_ui_.get(); } |
| 278 | 280 |
| 279 // Returns the pending WebUI, or null if none applies. | 281 // Returns the pending WebUI, or null if none applies. |
| 280 WebUIImpl* pending_web_ui() const { | 282 WebUIImpl* pending_web_ui() const { |
| 281 return should_reuse_web_ui_ ? web_ui_.get() : pending_web_ui_.get(); | 283 return should_reuse_web_ui_ ? web_ui_.get() : pending_web_ui_.get(); |
| 282 } | 284 } |
| 283 | 285 |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 544 bool is_view_source); | 546 bool is_view_source); |
| 545 | 547 |
| 546 // PlzNavigate | 548 // PlzNavigate |
| 547 // Indicates that a navigation failed and that this RenderFrame should display | 549 // Indicates that a navigation failed and that this RenderFrame should display |
| 548 // an error page. | 550 // an error page. |
| 549 void FailedNavigation(const CommonNavigationParams& common_params, | 551 void FailedNavigation(const CommonNavigationParams& common_params, |
| 550 const RequestNavigationParams& request_params, | 552 const RequestNavigationParams& request_params, |
| 551 bool has_stale_copy_in_cache, | 553 bool has_stale_copy_in_cache, |
| 552 int error_code); | 554 int error_code); |
| 553 | 555 |
| 556 // PlzNavigate | |
| 557 // Inform the renderer process that a navigation has been blocked by a content | |
| 558 // security policy. | |
| 559 void ReportContentSecurityPolicyViolation( | |
| 560 const CSPViolationParams& violation_params); | |
| 561 | |
| 554 // Sets up the Mojo connection between this instance and its associated render | 562 // Sets up the Mojo connection between this instance and its associated render |
| 555 // frame if it has not yet been set up. | 563 // frame if it has not yet been set up. |
| 556 void SetUpMojoIfNeeded(); | 564 void SetUpMojoIfNeeded(); |
| 557 | 565 |
| 558 // Tears down the browser-side state relating to the Mojo connection between | 566 // Tears down the browser-side state relating to the Mojo connection between |
| 559 // this instance and its associated render frame. | 567 // this instance and its associated render frame. |
| 560 void InvalidateMojoConnection(); | 568 void InvalidateMojoConnection(); |
| 561 | 569 |
| 562 // Returns whether the frame is focused. A frame is considered focused when it | 570 // Returns whether the frame is focused. A frame is considered focused when it |
| 563 // is the parent chain of the focused frame within the frame tree. In | 571 // is the parent chain of the focused frame within the frame tree. In |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 612 // that made a network request. The PreviewsState is a bitmask of potentially | 620 // that made a network request. The PreviewsState is a bitmask of potentially |
| 613 // several Previews optimizations. | 621 // several Previews optimizations. |
| 614 PreviewsState last_navigation_previews_state() const { | 622 PreviewsState last_navigation_previews_state() const { |
| 615 return last_navigation_previews_state_; | 623 return last_navigation_previews_state_; |
| 616 } | 624 } |
| 617 | 625 |
| 618 bool has_focused_editable_element() const { | 626 bool has_focused_editable_element() const { |
| 619 return has_focused_editable_element_; | 627 return has_focused_editable_element_; |
| 620 } | 628 } |
| 621 | 629 |
| 630 // Returns the set of Content-Security-Policy policies to enforce on the | |
| 631 // browser-side. | |
| 632 const std::vector<ContentSecurityPolicy>& content_security_policies() const { | |
|
alexmos
2017/02/24 06:40:27
I wonder if content's ContentSecurityPolicy should
arthursonzogni
2017/02/24 16:13:29
The name of the classes inside blink confused me.
| |
| 633 return content_security_policies_; | |
| 634 } | |
| 635 | |
| 636 void ResetContentSecurityPolicy() { content_security_policies_.clear(); } | |
|
alexmos
2017/02/24 06:40:27
Should this be ResetContentSecurityPolicies, since
arthursonzogni
2017/02/24 16:13:29
I copied FrameTreeNode::ResetContentSecurityPolicy
| |
| 637 | |
| 638 // Returns the context that must be used to check if a RenderFrameHost is | |
| 639 // allowed to navigate to an URL according to a set of content-security-policy | |
| 640 // policies. RenderFrameHostImpl. Never null. | |
|
alexmos
2017/02/24 06:40:27
Is "RenderFrameHostImpl." needed?
arthursonzogni
2017/02/24 16:13:29
Removed in the latest CL.
| |
| 641 CSPContext* csp_context() { return csp_context_.get(); } | |
| 642 | |
| 622 protected: | 643 protected: |
| 623 friend class RenderFrameHostFactory; | 644 friend class RenderFrameHostFactory; |
| 624 | 645 |
| 625 // |flags| is a combination of CreateRenderFrameFlags. | 646 // |flags| is a combination of CreateRenderFrameFlags. |
| 626 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost | 647 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost |
| 627 // should be the abstraction needed here, but we need RenderViewHost to pass | 648 // should be the abstraction needed here, but we need RenderViewHost to pass |
| 628 // into WebContentsObserver::FrameDetached for now. | 649 // into WebContentsObserver::FrameDetached for now. |
| 629 RenderFrameHostImpl(SiteInstance* site_instance, | 650 RenderFrameHostImpl(SiteInstance* site_instance, |
| 630 RenderViewHostImpl* render_view_host, | 651 RenderViewHostImpl* render_view_host, |
| 631 RenderFrameHostDelegate* delegate, | 652 RenderFrameHostDelegate* delegate, |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1147 std::unique_ptr<AssociatedInterfaceProviderImpl> | 1168 std::unique_ptr<AssociatedInterfaceProviderImpl> |
| 1148 remote_associated_interfaces_; | 1169 remote_associated_interfaces_; |
| 1149 | 1170 |
| 1150 // A bitwise OR of bindings types that have been enabled for this RenderFrame. | 1171 // A bitwise OR of bindings types that have been enabled for this RenderFrame. |
| 1151 // See BindingsPolicy for details. | 1172 // See BindingsPolicy for details. |
| 1152 int enabled_bindings_ = 0; | 1173 int enabled_bindings_ = 0; |
| 1153 | 1174 |
| 1154 // Tracks the feature policy which has been set on this frame. | 1175 // Tracks the feature policy which has been set on this frame. |
| 1155 std::unique_ptr<FeaturePolicy> feature_policy_; | 1176 std::unique_ptr<FeaturePolicy> feature_policy_; |
| 1156 | 1177 |
| 1178 // A set of Content-Security-Policy policies to enforce on the browser-side. | |
| 1179 std::vector<ContentSecurityPolicy> content_security_policies_; | |
|
alexmos
2017/02/24 06:40:27
It might be good to document here why we need this
arthursonzogni
2017/02/24 16:13:29
Removed in the latest CL.
| |
| 1180 | |
| 1181 // Used to check if a frame is allowed to navigate to an URL according to a | |
| 1182 // set of content-security-policy policies. | |
| 1183 std::unique_ptr<CSPContext> csp_context_; | |
| 1184 | |
| 1157 // NOTE: This must be the last member. | 1185 // NOTE: This must be the last member. |
| 1158 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; | 1186 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; |
| 1159 | 1187 |
| 1160 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); | 1188 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); |
| 1161 }; | 1189 }; |
| 1162 | 1190 |
| 1163 } // namespace content | 1191 } // namespace content |
| 1164 | 1192 |
| 1165 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ | 1193 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ |
| OLD | NEW |