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_PUBLIC_BROWSER_RENDER_FRAME_HOST_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_RENDER_FRAME_HOST_H_ |
6 #define CONTENT_PUBLIC_BROWSER_RENDER_FRAME_HOST_H_ | 6 #define CONTENT_PUBLIC_BROWSER_RENDER_FRAME_HOST_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 class SiteInstance; | 28 class SiteInstance; |
29 | 29 |
30 // The interface provides a communication conduit with a frame in the renderer. | 30 // The interface provides a communication conduit with a frame in the renderer. |
31 class CONTENT_EXPORT RenderFrameHost : public IPC::Listener, | 31 class CONTENT_EXPORT RenderFrameHost : public IPC::Listener, |
32 public IPC::Sender { | 32 public IPC::Sender { |
33 public: | 33 public: |
34 // Returns the RenderFrameHost given its ID and the ID of its render process. | 34 // Returns the RenderFrameHost given its ID and the ID of its render process. |
35 // Returns nullptr if the IDs do not correspond to a live RenderFrameHost. | 35 // Returns nullptr if the IDs do not correspond to a live RenderFrameHost. |
36 static RenderFrameHost* FromID(int render_process_id, int render_frame_id); | 36 static RenderFrameHost* FromID(int render_process_id, int render_frame_id); |
37 | 37 |
38 // Globally allows for injecting JavaScript into the main world. This feature | |
39 // is present only to support Android WebView and must not be used in other | |
40 // configurations. | |
41 static void AllowInjectingJavaScriptForAndroidWebView(); | |
42 | |
43 ~RenderFrameHost() override {} | 38 ~RenderFrameHost() override {} |
44 | 39 |
45 // Returns the route id for this frame. | 40 // Returns the route id for this frame. |
46 virtual int GetRoutingID() = 0; | 41 virtual int GetRoutingID() = 0; |
47 | 42 |
48 // Returns the SiteInstance grouping all RenderFrameHosts that have script | 43 // Returns the SiteInstance grouping all RenderFrameHosts that have script |
49 // access to this RenderFrameHost, and must therefore live in the same | 44 // access to this RenderFrameHost, and must therefore live in the same |
50 // process. | 45 // process. |
51 virtual SiteInstance* GetSiteInstance() = 0; | 46 virtual SiteInstance* GetSiteInstance() = 0; |
52 | 47 |
(...skipping 19 matching lines...) Expand all Loading... |
72 | 67 |
73 // Returns the associated widget's native view. | 68 // Returns the associated widget's native view. |
74 virtual gfx::NativeView GetNativeView() = 0; | 69 virtual gfx::NativeView GetNativeView() = 0; |
75 | 70 |
76 // Adds |message| to the DevTools console. | 71 // Adds |message| to the DevTools console. |
77 virtual void AddMessageToConsole(ConsoleMessageLevel level, | 72 virtual void AddMessageToConsole(ConsoleMessageLevel level, |
78 const std::string& message) = 0; | 73 const std::string& message) = 0; |
79 | 74 |
80 // Runs some JavaScript in this frame's context. If a callback is provided, it | 75 // Runs some JavaScript in this frame's context. If a callback is provided, it |
81 // will be used to return the result, when the result is available. | 76 // will be used to return the result, when the result is available. |
82 // This API can only be called on chrome:// or chrome-devtools:// URLs. | |
83 typedef base::Callback<void(const base::Value*)> JavaScriptResultCallback; | 77 typedef base::Callback<void(const base::Value*)> JavaScriptResultCallback; |
84 virtual void ExecuteJavaScript(const base::string16& javascript) = 0; | 78 virtual void ExecuteJavaScript(const base::string16& javascript) = 0; |
85 virtual void ExecuteJavaScript(const base::string16& javascript, | 79 virtual void ExecuteJavaScript(const base::string16& javascript, |
86 const JavaScriptResultCallback& callback) = 0; | 80 const JavaScriptResultCallback& callback) = 0; |
87 | |
88 // Runs some JavaScript in an isolated world of top of this frame's context. | |
89 virtual void ExecuteJavaScriptInIsolatedWorld( | 81 virtual void ExecuteJavaScriptInIsolatedWorld( |
90 const base::string16& javascript, | 82 const base::string16& javascript, |
91 const JavaScriptResultCallback& callback, | 83 const JavaScriptResultCallback& callback, |
92 int world_id) = 0; | 84 int world_id) = 0; |
93 | 85 |
94 // ONLY FOR TESTS: Same as above but without restrictions. Optionally, adds a | 86 // ONLY FOR TESTS: Same as above but adds a fake UserGestureIndicator around |
95 // fake UserGestureIndicator around execution. (crbug.com/408426) | 87 // execution. (crbug.com/408426) |
96 virtual void ExecuteJavaScriptForTests(const base::string16& javascript) = 0; | |
97 virtual void ExecuteJavaScriptForTests( | |
98 const base::string16& javascript, | |
99 const JavaScriptResultCallback& callback) = 0; | |
100 virtual void ExecuteJavaScriptWithUserGestureForTests( | 88 virtual void ExecuteJavaScriptWithUserGestureForTests( |
101 const base::string16& javascript) = 0; | 89 const base::string16& javascript) = 0; |
102 | 90 |
103 // Accessibility actions - these send a message to the RenderFrame | 91 // Accessibility actions - these send a message to the RenderFrame |
104 // to trigger an action on an accessibility object. | 92 // to trigger an action on an accessibility object. |
105 virtual void AccessibilitySetFocus(int acc_obj_id) = 0; | 93 virtual void AccessibilitySetFocus(int acc_obj_id) = 0; |
106 virtual void AccessibilityDoDefaultAction(int acc_obj_id) = 0; | 94 virtual void AccessibilityDoDefaultAction(int acc_obj_id) = 0; |
107 virtual void AccessibilityScrollToMakeVisible( | 95 virtual void AccessibilityScrollToMakeVisible( |
108 int acc_obj_id, const gfx::Rect& subfocus) = 0; | 96 int acc_obj_id, const gfx::Rect& subfocus) = 0; |
109 virtual void AccessibilityShowContextMenu(int acc_obj_id) = 0; | 97 virtual void AccessibilityShowContextMenu(int acc_obj_id) = 0; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 130 |
143 private: | 131 private: |
144 // This interface should only be implemented inside content. | 132 // This interface should only be implemented inside content. |
145 friend class RenderFrameHostImpl; | 133 friend class RenderFrameHostImpl; |
146 RenderFrameHost() {} | 134 RenderFrameHost() {} |
147 }; | 135 }; |
148 | 136 |
149 } // namespace content | 137 } // namespace content |
150 | 138 |
151 #endif // CONTENT_PUBLIC_BROWSER_RENDER_FRAME_HOST_H_ | 139 #endif // CONTENT_PUBLIC_BROWSER_RENDER_FRAME_HOST_H_ |
OLD | NEW |