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 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 bool has_focused_editable_element() const { | 632 bool has_focused_editable_element() const { |
628 return has_focused_editable_element_; | 633 return has_focused_editable_element_; |
629 } | 634 } |
630 | 635 |
631 // Cancels any blocked request for the frame and its subframes. | 636 // Cancels any blocked request for the frame and its subframes. |
632 void CancelBlockedRequestsForFrame(); | 637 void CancelBlockedRequestsForFrame(); |
633 | 638 |
634 #if defined(OS_ANDROID) | 639 #if defined(OS_ANDROID) |
635 base::android::ScopedJavaLocalRef<jobject> GetJavaRenderFrameHost(); | 640 base::android::ScopedJavaLocalRef<jobject> GetJavaRenderFrameHost(); |
636 service_manager::InterfaceProvider* GetJavaInterfaces() override; | 641 service_manager::InterfaceProvider* GetJavaInterfaces() override; |
| 642 |
| 643 // Returns an unguessable token for this RFHI. This provides a temporary way |
| 644 // to identify a RenderFrameHost that's compatible with IPC. Else, one needs |
| 645 // to send pid + RoutingID, but one cannot send pid. One can get it from the |
| 646 // channel, but this makes it much harder to get wrong. |
| 647 // Once media switches to mojo, we should be able to remove this in favor of |
| 648 // sending a mojo overlay factory. |
| 649 const base::UnguessableToken& GetOverlayRoutingToken(); |
637 #endif | 650 #endif |
638 | 651 |
639 protected: | 652 protected: |
640 friend class RenderFrameHostFactory; | 653 friend class RenderFrameHostFactory; |
641 | 654 |
642 // |flags| is a combination of CreateRenderFrameFlags. | 655 // |flags| is a combination of CreateRenderFrameFlags. |
643 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost | 656 // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost |
644 // should be the abstraction needed here, but we need RenderViewHost to pass | 657 // should be the abstraction needed here, but we need RenderViewHost to pass |
645 // into WebContentsObserver::FrameDetached for now. | 658 // into WebContentsObserver::FrameDetached for now. |
646 RenderFrameHostImpl(SiteInstance* site_instance, | 659 RenderFrameHostImpl(SiteInstance* site_instance, |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 void OnFocusedNodeChanged(bool is_editable_element, | 795 void OnFocusedNodeChanged(bool is_editable_element, |
783 const gfx::Rect& bounds_in_frame_widget); | 796 const gfx::Rect& bounds_in_frame_widget); |
784 void OnSetHasReceivedUserGesture(); | 797 void OnSetHasReceivedUserGesture(); |
785 | 798 |
786 #if BUILDFLAG(USE_EXTERNAL_POPUP_MENU) | 799 #if BUILDFLAG(USE_EXTERNAL_POPUP_MENU) |
787 void OnShowPopup(const FrameHostMsg_ShowPopup_Params& params); | 800 void OnShowPopup(const FrameHostMsg_ShowPopup_Params& params); |
788 void OnHidePopup(); | 801 void OnHidePopup(); |
789 #endif | 802 #endif |
790 #if defined(OS_ANDROID) | 803 #if defined(OS_ANDROID) |
791 void OnNavigationHandledByEmbedder(); | 804 void OnNavigationHandledByEmbedder(); |
| 805 |
| 806 // Called when the frame would like an overlay routing token. This will |
| 807 // create one if needed. Either way, it will send it to the frame. |
| 808 void OnRequestOverlayRoutingToken(); |
792 #endif | 809 #endif |
793 void OnShowCreatedWindow(int pending_widget_routing_id, | 810 void OnShowCreatedWindow(int pending_widget_routing_id, |
794 WindowOpenDisposition disposition, | 811 WindowOpenDisposition disposition, |
795 const gfx::Rect& initial_rect, | 812 const gfx::Rect& initial_rect, |
796 bool user_gesture); | 813 bool user_gesture); |
797 | 814 |
798 // Registers Mojo interfaces that this frame host makes available. | 815 // Registers Mojo interfaces that this frame host makes available. |
799 void RegisterMojoInterfaces(); | 816 void RegisterMojoInterfaces(); |
800 | 817 |
801 // Resets any waiting state of this RenderFrameHost that is no longer | 818 // Resets any waiting state of this RenderFrameHost that is no longer |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1164 | 1181 |
1165 // A bitwise OR of bindings types that have been enabled for this RenderFrame. | 1182 // A bitwise OR of bindings types that have been enabled for this RenderFrame. |
1166 // See BindingsPolicy for details. | 1183 // See BindingsPolicy for details. |
1167 int enabled_bindings_ = 0; | 1184 int enabled_bindings_ = 0; |
1168 | 1185 |
1169 // Tracks the feature policy which has been set on this frame. | 1186 // Tracks the feature policy which has been set on this frame. |
1170 std::unique_ptr<FeaturePolicy> feature_policy_; | 1187 std::unique_ptr<FeaturePolicy> feature_policy_; |
1171 | 1188 |
1172 #if defined(OS_ANDROID) | 1189 #if defined(OS_ANDROID) |
1173 std::unique_ptr<service_manager::InterfaceProvider> java_interfaces_; | 1190 std::unique_ptr<service_manager::InterfaceProvider> java_interfaces_; |
| 1191 |
| 1192 // IPC-friendly token that represents this host for AndroidOverlays, if we |
| 1193 // have created one yet. |
| 1194 base::Optional<base::UnguessableToken> overlay_routing_token_; |
1174 #endif | 1195 #endif |
1175 | 1196 |
1176 // NOTE: This must be the last member. | 1197 // NOTE: This must be the last member. |
1177 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; | 1198 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; |
1178 | 1199 |
1179 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); | 1200 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); |
1180 }; | 1201 }; |
1181 | 1202 |
1182 } // namespace content | 1203 } // namespace content |
1183 | 1204 |
1184 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ | 1205 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ |
OLD | NEW |