| 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" | 
 |    26 #include "base/unguessable_token.h" | 
|    25 #include "build/build_config.h" |    27 #include "build/build_config.h" | 
|    26 #include "content/browser/accessibility/browser_accessibility_manager.h" |    28 #include "content/browser/accessibility/browser_accessibility_manager.h" | 
|    27 #include "content/browser/bad_message.h" |    29 #include "content/browser/bad_message.h" | 
|    28 #include "content/browser/loader/global_routing_id.h" |    30 #include "content/browser/loader/global_routing_id.h" | 
|    29 #include "content/browser/site_instance_impl.h" |    31 #include "content/browser/site_instance_impl.h" | 
|    30 #include "content/browser/webui/web_ui_impl.h" |    32 #include "content/browser/webui/web_ui_impl.h" | 
|    31 #include "content/common/accessibility_mode.h" |    33 #include "content/common/accessibility_mode.h" | 
|    32 #include "content/common/ax_content_node_data.h" |    34 #include "content/common/ax_content_node_data.h" | 
|    33 #include "content/common/content_export.h" |    35 #include "content/common/content_export.h" | 
|    34 #include "content/common/content_security_policy/csp_context.h" |    36 #include "content/common/content_security_policy/csp_context.h" | 
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   127                                                 const base::string16& html)>; |   129                                                 const base::string16& html)>; | 
|   128  |   130  | 
|   129   // An accessibility reset is only allowed to prevent very rare corner cases |   131   // 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 |   132   // or race conditions where the browser and renderer get out of sync. If | 
|   131   // this happens more than this many times, kill the renderer. |   133   // this happens more than this many times, kill the renderer. | 
|   132   static const int kMaxAccessibilityResets = 5; |   134   static const int kMaxAccessibilityResets = 5; | 
|   133  |   135  | 
|   134   static RenderFrameHostImpl* FromID(int process_id, int routing_id); |   136   static RenderFrameHostImpl* FromID(int process_id, int routing_id); | 
|   135   static RenderFrameHostImpl* FromAXTreeID( |   137   static RenderFrameHostImpl* FromAXTreeID( | 
|   136       ui::AXTreeIDRegistry::AXTreeID ax_tree_id); |   138       ui::AXTreeIDRegistry::AXTreeID ax_tree_id); | 
 |   139   static RenderFrameHostImpl* FromOverlayRoutingToken( | 
 |   140       const base::UnguessableToken& token); | 
|   137  |   141  | 
|   138   ~RenderFrameHostImpl() override; |   142   ~RenderFrameHostImpl() override; | 
|   139  |   143  | 
|   140   // RenderFrameHost |   144   // RenderFrameHost | 
|   141   int GetRoutingID() override; |   145   int GetRoutingID() override; | 
|   142   ui::AXTreeIDRegistry::AXTreeID GetAXTreeID() override; |   146   ui::AXTreeIDRegistry::AXTreeID GetAXTreeID() override; | 
|   143   SiteInstanceImpl* GetSiteInstance() override; |   147   SiteInstanceImpl* GetSiteInstance() override; | 
|   144   RenderProcessHost* GetProcess() override; |   148   RenderProcessHost* GetProcess() override; | 
|   145   RenderWidgetHostView* GetView() override; |   149   RenderWidgetHostView* GetView() override; | 
|   146   RenderFrameHostImpl* GetParent() override; |   150   RenderFrameHostImpl* GetParent() override; | 
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   617   } |   621   } | 
|   618  |   622  | 
|   619   // Cancels any blocked request for the frame and its subframes. |   623   // Cancels any blocked request for the frame and its subframes. | 
|   620   void CancelBlockedRequestsForFrame(); |   624   void CancelBlockedRequestsForFrame(); | 
|   621  |   625  | 
|   622 #if defined(OS_ANDROID) |   626 #if defined(OS_ANDROID) | 
|   623   base::android::ScopedJavaLocalRef<jobject> GetJavaRenderFrameHost(); |   627   base::android::ScopedJavaLocalRef<jobject> GetJavaRenderFrameHost(); | 
|   624   service_manager::InterfaceProvider* GetJavaInterfaces() override; |   628   service_manager::InterfaceProvider* GetJavaInterfaces() override; | 
|   625 #endif |   629 #endif | 
|   626  |   630  | 
 |   631   // Returns an unguessable token for this RFHI.  This provides a temporary way | 
 |   632   // to identify a RenderFrameHost that's compatible with IPC.  Else, one needs | 
 |   633   // to send pid + RoutingID, but one cannot send pid.  One can get it from the | 
 |   634   // channel, but this makes it much harder to get wrong. | 
 |   635   // Once media switches to mojo, we should be able to remove this in favor of | 
 |   636   // sending a mojo overlay factory. | 
 |   637   const base::UnguessableToken& GetOverlayRoutingToken(); | 
 |   638  | 
|   627  protected: |   639  protected: | 
|   628   friend class RenderFrameHostFactory; |   640   friend class RenderFrameHostFactory; | 
|   629  |   641  | 
|   630   // |flags| is a combination of CreateRenderFrameFlags. |   642   // |flags| is a combination of CreateRenderFrameFlags. | 
|   631   // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost |   643   // TODO(nasko): Remove dependency on RenderViewHost here. RenderProcessHost | 
|   632   // should be the abstraction needed here, but we need RenderViewHost to pass |   644   // should be the abstraction needed here, but we need RenderViewHost to pass | 
|   633   // into WebContentsObserver::FrameDetached for now. |   645   // into WebContentsObserver::FrameDetached for now. | 
|   634   RenderFrameHostImpl(SiteInstance* site_instance, |   646   RenderFrameHostImpl(SiteInstance* site_instance, | 
|   635                       RenderViewHostImpl* render_view_host, |   647                       RenderViewHostImpl* render_view_host, | 
|   636                       RenderFrameHostDelegate* delegate, |   648                       RenderFrameHostDelegate* delegate, | 
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   776  |   788  | 
|   777 #if BUILDFLAG(USE_EXTERNAL_POPUP_MENU) |   789 #if BUILDFLAG(USE_EXTERNAL_POPUP_MENU) | 
|   778   void OnShowPopup(const FrameHostMsg_ShowPopup_Params& params); |   790   void OnShowPopup(const FrameHostMsg_ShowPopup_Params& params); | 
|   779   void OnHidePopup(); |   791   void OnHidePopup(); | 
|   780 #endif |   792 #endif | 
|   781 #if defined(OS_ANDROID) |   793 #if defined(OS_ANDROID) | 
|   782   void OnNavigationHandledByEmbedder(); |   794   void OnNavigationHandledByEmbedder(); | 
|   783   void ForwardGetInterfaceToRenderFrame(const std::string& interface_name, |   795   void ForwardGetInterfaceToRenderFrame(const std::string& interface_name, | 
|   784                                         mojo::ScopedMessagePipeHandle pipe); |   796                                         mojo::ScopedMessagePipeHandle pipe); | 
|   785 #endif |   797 #endif | 
 |   798  | 
 |   799   // Called when the frame would like an overlay routing token.  This will | 
 |   800   // create one if needed.  Either way, it will send it to the frame. | 
 |   801   void OnRequestOverlayRoutingToken(); | 
 |   802  | 
|   786   void OnShowCreatedWindow(int pending_widget_routing_id, |   803   void OnShowCreatedWindow(int pending_widget_routing_id, | 
|   787                            WindowOpenDisposition disposition, |   804                            WindowOpenDisposition disposition, | 
|   788                            const gfx::Rect& initial_rect, |   805                            const gfx::Rect& initial_rect, | 
|   789                            bool user_gesture); |   806                            bool user_gesture); | 
|   790  |   807  | 
|   791   // mojom::FrameHost |   808   // mojom::FrameHost | 
|   792   void CreateNewWindow(mojom::CreateNewWindowParamsPtr params, |   809   void CreateNewWindow(mojom::CreateNewWindowParamsPtr params, | 
|   793                        CreateNewWindowCallback callback) override; |   810                        CreateNewWindowCallback callback) override; | 
|   794  |   811  | 
|   795   void RunCreateWindowCompleteCallback(CreateNewWindowCallback callback, |   812   void RunCreateWindowCompleteCallback(CreateNewWindowCallback callback, | 
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1178   // An InterfaceRegistry that forwards interface requests from Java to the |  1195   // An InterfaceRegistry that forwards interface requests from Java to the | 
|  1179   // RenderFrame. This provides access to interfaces implemented in the renderer |  1196   // RenderFrame. This provides access to interfaces implemented in the renderer | 
|  1180   // to Java code in the browser process. |  1197   // to Java code in the browser process. | 
|  1181   class JavaInterfaceProvider; |  1198   class JavaInterfaceProvider; | 
|  1182   std::unique_ptr<JavaInterfaceProvider> java_interface_registry_; |  1199   std::unique_ptr<JavaInterfaceProvider> java_interface_registry_; | 
|  1183 #endif |  1200 #endif | 
|  1184  |  1201  | 
|  1185   mojo::BindingSet<service_manager::mojom::InterfaceProvider> |  1202   mojo::BindingSet<service_manager::mojom::InterfaceProvider> | 
|  1186       interface_provider_bindings_; |  1203       interface_provider_bindings_; | 
|  1187  |  1204  | 
 |  1205   // IPC-friendly token that represents this host for AndroidOverlays, if we | 
 |  1206   // have created one yet. | 
 |  1207   base::Optional<base::UnguessableToken> overlay_routing_token_; | 
 |  1208  | 
|  1188   // NOTE: This must be the last member. |  1209   // NOTE: This must be the last member. | 
|  1189   base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; |  1210   base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; | 
|  1190  |  1211  | 
|  1191   DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); |  1212   DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); | 
|  1192 }; |  1213 }; | 
|  1193  |  1214  | 
|  1194 }  // namespace content |  1215 }  // namespace content | 
|  1195  |  1216  | 
|  1196 #endif  // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ |  1217 #endif  // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ | 
| OLD | NEW |