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" |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
| 13 #include "content/public/browser/render_process_host.h" |
13 #include "content/public/common/console_message_level.h" | 14 #include "content/public/common/console_message_level.h" |
14 #include "content/public/common/file_chooser_params.h" | 15 #include "content/public/common/file_chooser_params.h" |
15 #include "ipc/ipc_listener.h" | 16 #include "ipc/ipc_listener.h" |
16 #include "ipc/ipc_sender.h" | 17 #include "ipc/ipc_sender.h" |
| 18 #include "mojo/public/cpp/bindings/associated_interface_ptr.h" |
| 19 #include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h" |
17 #include "third_party/WebKit/public/platform/WebPageVisibilityState.h" | 20 #include "third_party/WebKit/public/platform/WebPageVisibilityState.h" |
18 #include "ui/gfx/geometry/rect.h" | 21 #include "ui/gfx/geometry/rect.h" |
19 #include "ui/gfx/native_widget_types.h" | 22 #include "ui/gfx/native_widget_types.h" |
20 #include "url/gurl.h" | 23 #include "url/gurl.h" |
21 #include "url/origin.h" | 24 #include "url/origin.h" |
22 | 25 |
23 namespace base { | 26 namespace base { |
24 class Value; | 27 class Value; |
25 } | 28 } |
26 | 29 |
27 namespace shell { | 30 namespace shell { |
28 class InterfaceRegistry; | 31 class InterfaceRegistry; |
29 class InterfaceProvider; | 32 class InterfaceProvider; |
30 } | 33 } |
31 | 34 |
32 namespace content { | 35 namespace content { |
33 class RenderProcessHost; | |
34 class RenderViewHost; | 36 class RenderViewHost; |
35 class RenderWidgetHostView; | 37 class RenderWidgetHostView; |
36 class SiteInstance; | 38 class SiteInstance; |
37 struct FileChooserFileInfo; | 39 struct FileChooserFileInfo; |
38 | 40 |
39 // The interface provides a communication conduit with a frame in the renderer. | 41 // The interface provides a communication conduit with a frame in the renderer. |
40 class CONTENT_EXPORT RenderFrameHost : public IPC::Listener, | 42 class CONTENT_EXPORT RenderFrameHost : public IPC::Listener, |
41 public IPC::Sender { | 43 public IPC::Sender { |
42 public: | 44 public: |
43 // Returns the RenderFrameHost given its ID and the ID of its render process. | 45 // Returns the RenderFrameHost given its ID and the ID of its render process. |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 virtual RenderViewHost* GetRenderViewHost() = 0; | 186 virtual RenderViewHost* GetRenderViewHost() = 0; |
185 | 187 |
186 // Returns the InterfaceRegistry that this process uses to expose interfaces | 188 // Returns the InterfaceRegistry that this process uses to expose interfaces |
187 // to the application running in this frame. | 189 // to the application running in this frame. |
188 virtual shell::InterfaceRegistry* GetInterfaceRegistry() = 0; | 190 virtual shell::InterfaceRegistry* GetInterfaceRegistry() = 0; |
189 | 191 |
190 // Returns the InterfaceProvider that this process can use to bind | 192 // Returns the InterfaceProvider that this process can use to bind |
191 // interfaces exposed to it by the application running in this frame. | 193 // interfaces exposed to it by the application running in this frame. |
192 virtual shell::InterfaceProvider* GetRemoteInterfaces() = 0; | 194 virtual shell::InterfaceProvider* GetRemoteInterfaces() = 0; |
193 | 195 |
| 196 using RoutedInterfaceFactory = |
| 197 base::Callback<void(mojo::ScopedInterfaceEndpointHandle)>; |
| 198 |
| 199 // Adds an associated interface factory to this host, allowing the remote |
| 200 // RenderFrame to acquire a proxy to the interface on this specific host. |
| 201 virtual void AddRoutedInterface(const base::StringPiece& name, |
| 202 const RoutedInterfaceFactory& factory) = 0; |
| 203 |
| 204 virtual void RemoveRoutedInterface(const base::StringPiece& name) = 0; |
| 205 |
| 206 // Binds an interface proxy to be associated with the remote RenderFrame in |
| 207 // the render process. |
| 208 virtual void GetRemoteRoutedInterface( |
| 209 const base::StringPiece& name, |
| 210 mojo::ScopedInterfaceEndpointHandle handle) = 0; |
| 211 |
194 // Returns the visibility state of the frame. The different visibility states | 212 // Returns the visibility state of the frame. The different visibility states |
195 // of a frame are defined in Blink. | 213 // of a frame are defined in Blink. |
196 virtual blink::WebPageVisibilityState GetVisibilityState() = 0; | 214 virtual blink::WebPageVisibilityState GetVisibilityState() = 0; |
197 | 215 |
198 // Returns whether the RenderFrame in the renderer process has been created | 216 // Returns whether the RenderFrame in the renderer process has been created |
199 // and still has a connection. This is valid for all frames. | 217 // and still has a connection. This is valid for all frames. |
200 virtual bool IsRenderFrameLive() = 0; | 218 virtual bool IsRenderFrameLive() = 0; |
201 | 219 |
202 // Get the number of proxies to this frame, in all processes. Exposed for | 220 // Get the number of proxies to this frame, in all processes. Exposed for |
203 // use by resource metrics. | 221 // use by resource metrics. |
204 virtual int GetProxyCount() = 0; | 222 virtual int GetProxyCount() = 0; |
205 | 223 |
206 // Notifies the Listener that one or more files have been chosen by the user | 224 // Notifies the Listener that one or more files have been chosen by the user |
207 // from a file chooser dialog for the form. |permissions| is the file | 225 // from a file chooser dialog for the form. |permissions| is the file |
208 // selection mode in which the chooser dialog was created. | 226 // selection mode in which the chooser dialog was created. |
209 virtual void FilesSelectedInChooser( | 227 virtual void FilesSelectedInChooser( |
210 const std::vector<content::FileChooserFileInfo>& files, | 228 const std::vector<content::FileChooserFileInfo>& files, |
211 FileChooserParams::Mode permissions) = 0; | 229 FileChooserParams::Mode permissions) = 0; |
212 | 230 |
213 // Text surrounding selection. | 231 // Text surrounding selection. |
214 typedef base::Callback< | 232 typedef base::Callback< |
215 void(const base::string16& content, int start_offset, int end_offset)> | 233 void(const base::string16& content, int start_offset, int end_offset)> |
216 TextSurroundingSelectionCallback; | 234 TextSurroundingSelectionCallback; |
217 virtual void RequestTextSurroundingSelection( | 235 virtual void RequestTextSurroundingSelection( |
218 const TextSurroundingSelectionCallback& callback, | 236 const TextSurroundingSelectionCallback& callback, |
219 int max_length) = 0; | 237 int max_length) = 0; |
220 | 238 |
| 239 template <typename Interface> |
| 240 void GetRemoteRoutedInterface( |
| 241 mojo::AssociatedInterfacePtr<Interface>* proxy) { |
| 242 mojo::AssociatedInterfaceRequest<Interface> request = |
| 243 mojo::GetProxy(proxy, GetProcess()->GetRoutedInterfaceGroup()); |
| 244 GetRemoteRoutedInterface(Interface::Name_, request.PassHandle()); |
| 245 } |
| 246 |
221 private: | 247 private: |
222 // This interface should only be implemented inside content. | 248 // This interface should only be implemented inside content. |
223 friend class RenderFrameHostImpl; | 249 friend class RenderFrameHostImpl; |
224 RenderFrameHost() {} | 250 RenderFrameHost() {} |
225 }; | 251 }; |
226 | 252 |
227 } // namespace content | 253 } // namespace content |
228 | 254 |
229 #endif // CONTENT_PUBLIC_BROWSER_RENDER_FRAME_HOST_H_ | 255 #endif // CONTENT_PUBLIC_BROWSER_RENDER_FRAME_HOST_H_ |
OLD | NEW |