OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BROWSER_PPAPI_HOST_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_BROWSER_PPAPI_HOST_H_ |
6 #define CONTENT_PUBLIC_BROWSER_BROWSER_PPAPI_HOST_H_ | 6 #define CONTENT_PUBLIC_BROWSER_BROWSER_PPAPI_HOST_H_ |
7 | 7 |
8 #include "base/callback_forward.h" | 8 #include "base/callback_forward.h" |
9 #include "base/process.h" | 9 #include "base/process.h" |
10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
11 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
12 #include "content/public/browser/render_view_host.h" | 12 #include "content/public/browser/render_view_host.h" |
13 #include "ppapi/c/pp_instance.h" | 13 #include "ppapi/c/pp_instance.h" |
14 | 14 |
| 15 namespace IPC { |
| 16 class ChannelProxy; |
| 17 struct ChannelHandle; |
| 18 class Sender; |
| 19 } |
| 20 |
| 21 namespace net { |
| 22 class HostResolver; |
| 23 } |
| 24 |
15 namespace ppapi { | 25 namespace ppapi { |
| 26 class PpapiPermissions; |
16 namespace host { | 27 namespace host { |
17 class PpapiHost; | 28 class PpapiHost; |
18 } | 29 } |
19 } | 30 } |
20 | 31 |
21 namespace content { | 32 namespace content { |
22 | 33 |
23 // Interface that allows components in the embedder app to talk to the | 34 // Interface that allows components in the embedder app to talk to the |
24 // PpapiHost in the browser process. | 35 // PpapiHost in the browser process. |
25 // | 36 // |
26 // There will be one of these objects in the browser per plugin process. It | 37 // There will be one of these objects in the browser per plugin process. It |
27 // lives entirely on the I/O thread. | 38 // lives entirely on the I/O thread. |
28 class CONTENT_EXPORT BrowserPpapiHost { | 39 class CONTENT_EXPORT BrowserPpapiHost { |
29 public: | 40 public: |
| 41 // Creates a browser host and sets up an out-of-process proxy for an external |
| 42 // pepper plugin process. |
| 43 static BrowserPpapiHost* CreateExternalPluginProcess( |
| 44 IPC::Sender* sender, |
| 45 ppapi::PpapiPermissions permissions, |
| 46 base::ProcessHandle plugin_child_process, |
| 47 IPC::ChannelProxy* channel, |
| 48 net::HostResolver* host_resolver, |
| 49 int render_process_id, |
| 50 int render_view_id); |
| 51 |
| 52 virtual ~BrowserPpapiHost() {} |
| 53 |
30 // Returns the PpapiHost object. | 54 // Returns the PpapiHost object. |
31 virtual ppapi::host::PpapiHost* GetPpapiHost() = 0; | 55 virtual ppapi::host::PpapiHost* GetPpapiHost() = 0; |
32 | 56 |
33 // Returns the handle to the plugin process. | 57 // Returns the handle to the plugin process. |
34 virtual base::ProcessHandle GetPluginProcessHandle() const = 0; | 58 virtual base::ProcessHandle GetPluginProcessHandle() const = 0; |
35 | 59 |
36 // Returns true if the given PP_Instance is valid. | 60 // Returns true if the given PP_Instance is valid. |
37 virtual bool IsValidInstance(PP_Instance instance) const = 0; | 61 virtual bool IsValidInstance(PP_Instance instance) const = 0; |
38 | 62 |
39 // Retrieves the process/view Ids associated with the RenderView containing | 63 // Retrieves the process/view Ids associated with the RenderView containing |
40 // the given instance and returns true on success. If the instance is | 64 // the given instance and returns true on success. If the instance is |
41 // invalid, the ids will be 0 and false will be returned. | 65 // invalid, the ids will be 0 and false will be returned. |
42 // | 66 // |
43 // When a resource is created, the PP_Instance should already have been | 67 // When a resource is created, the PP_Instance should already have been |
44 // validated, and the resource hosts will be deleted when the resource is | 68 // validated, and the resource hosts will be deleted when the resource is |
45 // destroyed. So it should not generally be necessary to check for errors | 69 // destroyed. So it should not generally be necessary to check for errors |
46 // from this function except as a last-minute sanity check if you convert the | 70 // from this function except as a last-minute sanity check if you convert the |
47 // IDs to a RenderView/ProcessHost on the UI thread. | 71 // IDs to a RenderView/ProcessHost on the UI thread. |
48 virtual bool GetRenderViewIDsForInstance(PP_Instance instance, | 72 virtual bool GetRenderViewIDsForInstance(PP_Instance instance, |
49 int* render_process_id, | 73 int* render_process_id, |
50 int* render_view_id) const = 0; | 74 int* render_view_id) const = 0; |
51 | |
52 protected: | |
53 virtual ~BrowserPpapiHost() {} | |
54 }; | 75 }; |
55 | 76 |
56 } // namespace content | 77 } // namespace content |
57 | 78 |
58 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PPAPI_HOST_H_ | 79 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_PPAPI_HOST_H_ |
OLD | NEW |