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/optional.h" |
22 #include "base/strings/string16.h" | 23 #include "base/strings/string16.h" |
23 #include "base/supports_user_data.h" | 24 #include "base/supports_user_data.h" |
24 #include "base/time/time.h" | 25 #include "base/time/time.h" |
25 #include "build/build_config.h" | 26 #include "build/build_config.h" |
26 #include "content/browser/accessibility/browser_accessibility_manager.h" | 27 #include "content/browser/accessibility/browser_accessibility_manager.h" |
27 #include "content/browser/bad_message.h" | 28 #include "content/browser/bad_message.h" |
28 #include "content/browser/loader/global_routing_id.h" | 29 #include "content/browser/loader/global_routing_id.h" |
29 #include "content/browser/site_instance_impl.h" | 30 #include "content/browser/site_instance_impl.h" |
30 #include "content/browser/webui/web_ui_impl.h" | 31 #include "content/browser/webui/web_ui_impl.h" |
31 #include "content/common/accessibility_mode.h" | 32 #include "content/common/accessibility_mode.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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. |
132 static const int kMaxAccessibilityResets = 5; | 133 static const int kMaxAccessibilityResets = 5; |
133 | 134 |
134 static RenderFrameHostImpl* FromID(int process_id, int routing_id); | 135 static RenderFrameHostImpl* FromID(int process_id, int routing_id); |
135 static RenderFrameHostImpl* FromAXTreeID( | 136 static RenderFrameHostImpl* FromAXTreeID( |
136 ui::AXTreeIDRegistry::AXTreeID ax_tree_id); | 137 ui::AXTreeIDRegistry::AXTreeID ax_tree_id); |
| 138 #if defined(OS_ANDROID) |
| 139 static RenderFrameHostImpl* FromOverlayRoutingToken( |
| 140 const base::UnguessableToken& token); |
| 141 #endif |
137 | 142 |
138 ~RenderFrameHostImpl() override; | 143 ~RenderFrameHostImpl() override; |
139 | 144 |
140 // RenderFrameHost | 145 // RenderFrameHost |
141 int GetRoutingID() override; | 146 int GetRoutingID() override; |
142 ui::AXTreeIDRegistry::AXTreeID GetAXTreeID() override; | 147 ui::AXTreeIDRegistry::AXTreeID GetAXTreeID() override; |
143 SiteInstanceImpl* GetSiteInstance() override; | 148 SiteInstanceImpl* GetSiteInstance() override; |
144 RenderProcessHost* GetProcess() override; | 149 RenderProcessHost* GetProcess() override; |
145 RenderWidgetHostView* GetView() override; | 150 RenderWidgetHostView* GetView() override; |
146 RenderFrameHostImpl* GetParent() override; | 151 RenderFrameHostImpl* GetParent() override; |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 bool has_focused_editable_element() const { | 629 bool has_focused_editable_element() const { |
625 return has_focused_editable_element_; | 630 return has_focused_editable_element_; |
626 } | 631 } |
627 | 632 |
628 // Cancels any blocked request for the frame and its subframes. | 633 // Cancels any blocked request for the frame and its subframes. |
629 void CancelBlockedRequestsForFrame(); | 634 void CancelBlockedRequestsForFrame(); |
630 | 635 |
631 #if defined(OS_ANDROID) | 636 #if defined(OS_ANDROID) |
632 base::android::ScopedJavaLocalRef<jobject> GetJavaRenderFrameHost(); | 637 base::android::ScopedJavaLocalRef<jobject> GetJavaRenderFrameHost(); |
633 service_manager::InterfaceProvider* GetJavaInterfaces() override; | 638 service_manager::InterfaceProvider* GetJavaInterfaces() override; |
| 639 |
| 640 // Returns an unguessable token for this RFHI. This provides a temporary way |
| 641 // to identify a RenderFrameHost that's compatible with IPC. Else, one needs |
| 642 // to send pid + RoutingID, but one cannot send pid. One can get it from the |
| 643 // channel, but this makes it much harder to get wrong. |
| 644 // Once media switches to mojo, we should be able to remove this in favor of |
| 645 // sending a mojo overlay factory. |
| 646 const base::UnguessableToken& GetOverlayRoutingToken(); |
634 #endif | 647 #endif |
635 | 648 |
636 protected: | 649 protected: |
637 friend class RenderFrameHostFactory; | 650 friend class RenderFrameHostFactory; |
638 | 651 |
639 // |flags| is a combination of CreateRenderFrameFlags. | 652 // |flags| is a combination of CreateRenderFrameFlags. |
640 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost | 653 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost |
641 // should be the abstraction needed here, but we need RenderViewHost to pass | 654 // should be the abstraction needed here, but we need RenderViewHost to pass |
642 // into WebContentsObserver::FrameDetached for now. | 655 // into WebContentsObserver::FrameDetached for now. |
643 RenderFrameHostImpl(SiteInstance* site_instance, | 656 RenderFrameHostImpl(SiteInstance* site_instance, |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 void OnFocusedNodeChanged(bool is_editable_element, | 792 void OnFocusedNodeChanged(bool is_editable_element, |
780 const gfx::Rect& bounds_in_frame_widget); | 793 const gfx::Rect& bounds_in_frame_widget); |
781 void OnSetHasReceivedUserGesture(); | 794 void OnSetHasReceivedUserGesture(); |
782 | 795 |
783 #if BUILDFLAG(USE_EXTERNAL_POPUP_MENU) | 796 #if BUILDFLAG(USE_EXTERNAL_POPUP_MENU) |
784 void OnShowPopup(const FrameHostMsg_ShowPopup_Params& params); | 797 void OnShowPopup(const FrameHostMsg_ShowPopup_Params& params); |
785 void OnHidePopup(); | 798 void OnHidePopup(); |
786 #endif | 799 #endif |
787 #if defined(OS_ANDROID) | 800 #if defined(OS_ANDROID) |
788 void OnNavigationHandledByEmbedder(); | 801 void OnNavigationHandledByEmbedder(); |
| 802 |
| 803 // Called when the frame would like an overlay routing token. This will |
| 804 // create one if needed. Either way, it will send it to the frame. |
| 805 void OnRequestOverlayRoutingToken(); |
789 #endif | 806 #endif |
790 void OnShowCreatedWindow(int pending_widget_routing_id, | 807 void OnShowCreatedWindow(int pending_widget_routing_id, |
791 WindowOpenDisposition disposition, | 808 WindowOpenDisposition disposition, |
792 const gfx::Rect& initial_rect, | 809 const gfx::Rect& initial_rect, |
793 bool user_gesture); | 810 bool user_gesture); |
794 | 811 |
795 // Registers Mojo interfaces that this frame host makes available. | 812 // Registers Mojo interfaces that this frame host makes available. |
796 void RegisterMojoInterfaces(); | 813 void RegisterMojoInterfaces(); |
797 | 814 |
798 // Resets any waiting state of this RenderFrameHost that is no longer | 815 // Resets any waiting state of this RenderFrameHost that is no longer |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1157 | 1174 |
1158 // A bitwise OR of bindings types that have been enabled for this RenderFrame. | 1175 // A bitwise OR of bindings types that have been enabled for this RenderFrame. |
1159 // See BindingsPolicy for details. | 1176 // See BindingsPolicy for details. |
1160 int enabled_bindings_ = 0; | 1177 int enabled_bindings_ = 0; |
1161 | 1178 |
1162 // Tracks the feature policy which has been set on this frame. | 1179 // Tracks the feature policy which has been set on this frame. |
1163 std::unique_ptr<FeaturePolicy> feature_policy_; | 1180 std::unique_ptr<FeaturePolicy> feature_policy_; |
1164 | 1181 |
1165 #if defined(OS_ANDROID) | 1182 #if defined(OS_ANDROID) |
1166 std::unique_ptr<service_manager::InterfaceProvider> java_interfaces_; | 1183 std::unique_ptr<service_manager::InterfaceProvider> java_interfaces_; |
| 1184 |
| 1185 // IPC-friendly token that represents this host for AndroidOverlays, if we |
| 1186 // have created one yet. |
| 1187 base::Optional<base::UnguessableToken> overlay_routing_token_; |
1167 #endif | 1188 #endif |
1168 | 1189 |
1169 // NOTE: This must be the last member. | 1190 // NOTE: This must be the last member. |
1170 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; | 1191 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; |
1171 | 1192 |
1172 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); | 1193 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); |
1173 }; | 1194 }; |
1174 | 1195 |
1175 } // namespace content | 1196 } // namespace content |
1176 | 1197 |
1177 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ | 1198 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ |
OLD | NEW |