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_BROWSER_RENDERER_HOST_PEPPER_BROWSER_PPAPI_HOST_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_PEPPER_BROWSER_PPAPI_HOST_IMPL_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_PEPPER_BROWSER_PPAPI_HOST_IMPL_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_PEPPER_BROWSER_PPAPI_HOST_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
14 #include "content/browser/renderer_host/pepper/content_browser_pepper_host_facto
ry.h" | 14 #include "content/browser/renderer_host/pepper/content_browser_pepper_host_facto
ry.h" |
15 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
16 #include "content/public/browser/browser_ppapi_host.h" | 16 #include "content/public/browser/browser_ppapi_host.h" |
| 17 #include "content/public/common/process_type.h" |
17 #include "ipc/ipc_channel_proxy.h" | 18 #include "ipc/ipc_channel_proxy.h" |
18 #include "ppapi/host/ppapi_host.h" | 19 #include "ppapi/host/ppapi_host.h" |
19 | 20 |
20 namespace content { | 21 namespace content { |
21 | 22 |
22 class CONTENT_EXPORT BrowserPpapiHostImpl : public BrowserPpapiHost { | 23 class CONTENT_EXPORT BrowserPpapiHostImpl : public BrowserPpapiHost { |
23 public: | 24 public: |
24 // The creator is responsible for calling set_plugin_process_handle as soon | 25 // The creator is responsible for calling set_plugin_process_handle as soon |
25 // as it is known (we start the process asynchronously so it won't be known | 26 // as it is known (we start the process asynchronously so it won't be known |
26 // when this object is created). | 27 // when this object is created). |
27 BrowserPpapiHostImpl(IPC::Sender* sender, | 28 BrowserPpapiHostImpl(IPC::Sender* sender, |
28 const ppapi::PpapiPermissions& permissions, | 29 const ppapi::PpapiPermissions& permissions, |
29 const std::string& plugin_name, | 30 const std::string& plugin_name, |
30 const FilePath& profile_data_directory, | 31 const FilePath& profile_data_directory, |
31 int plugin_process_id); | 32 int plugin_process_id, |
| 33 ProcessType plugin_process_type); |
32 virtual ~BrowserPpapiHostImpl(); | 34 virtual ~BrowserPpapiHostImpl(); |
33 | 35 |
34 // BrowserPpapiHost. | 36 // BrowserPpapiHost. |
35 virtual ppapi::host::PpapiHost* GetPpapiHost() OVERRIDE; | 37 virtual ppapi::host::PpapiHost* GetPpapiHost() OVERRIDE; |
36 virtual base::ProcessHandle GetPluginProcessHandle() const OVERRIDE; | 38 virtual base::ProcessHandle GetPluginProcessHandle() const OVERRIDE; |
37 virtual bool IsValidInstance(PP_Instance instance) const OVERRIDE; | 39 virtual bool IsValidInstance(PP_Instance instance) const OVERRIDE; |
38 virtual bool GetRenderViewIDsForInstance(PP_Instance instance, | 40 virtual bool GetRenderViewIDsForInstance(PP_Instance instance, |
39 int* render_process_id, | 41 int* render_process_id, |
40 int* render_view_id) const OVERRIDE; | 42 int* render_view_id) const OVERRIDE; |
41 virtual const std::string& GetPluginName() OVERRIDE; | 43 virtual const std::string& GetPluginName() OVERRIDE; |
42 virtual const FilePath& GetProfileDataDirectory() OVERRIDE; | 44 virtual const FilePath& GetProfileDataDirectory() OVERRIDE; |
43 virtual int GetPluginProcessID() OVERRIDE; | 45 virtual int GetPluginProcessID() OVERRIDE; |
44 | 46 |
45 void set_plugin_process_handle(base::ProcessHandle handle) { | 47 void set_plugin_process_handle(base::ProcessHandle handle) { |
46 plugin_process_handle_ = handle; | 48 plugin_process_handle_ = handle; |
47 } | 49 } |
48 | 50 |
| 51 ProcessType plugin_process_type() { return plugin_process_type_; } |
| 52 |
49 // These two functions are notifications that an instance has been created | 53 // These two functions are notifications that an instance has been created |
50 // or destroyed. They allow us to maintain a mapping of PP_Instance to view | 54 // or destroyed. They allow us to maintain a mapping of PP_Instance to view |
51 // IDs in the browser process. | 55 // IDs in the browser process. |
52 void AddInstanceForView(PP_Instance instance, | 56 void AddInstanceForView(PP_Instance instance, |
53 int render_process_id, | 57 int render_process_id, |
54 int render_view_id); | 58 int render_view_id); |
55 void DeleteInstanceForView(PP_Instance instance); | 59 void DeleteInstanceForView(PP_Instance instance); |
56 | 60 |
57 scoped_refptr<IPC::ChannelProxy::MessageFilter> message_filter() { | 61 scoped_refptr<IPC::ChannelProxy::MessageFilter> message_filter() { |
58 return message_filter_; | 62 return message_filter_; |
(...skipping 24 matching lines...) Expand all Loading... |
83 virtual ~HostMessageFilter() {} | 87 virtual ~HostMessageFilter() {} |
84 | 88 |
85 ppapi::host::PpapiHost* ppapi_host_; | 89 ppapi::host::PpapiHost* ppapi_host_; |
86 }; | 90 }; |
87 | 91 |
88 ppapi::host::PpapiHost ppapi_host_; | 92 ppapi::host::PpapiHost ppapi_host_; |
89 base::ProcessHandle plugin_process_handle_; | 93 base::ProcessHandle plugin_process_handle_; |
90 std::string plugin_name_; | 94 std::string plugin_name_; |
91 FilePath profile_data_directory_; | 95 FilePath profile_data_directory_; |
92 int plugin_process_id_; | 96 int plugin_process_id_; |
| 97 ProcessType plugin_process_type_; |
93 | 98 |
94 // Tracks all PP_Instances in this plugin and maps them to | 99 // Tracks all PP_Instances in this plugin and maps them to |
95 // RenderProcess/RenderView IDs. | 100 // RenderProcess/RenderView IDs. |
96 InstanceToViewMap instance_to_view_; | 101 InstanceToViewMap instance_to_view_; |
97 | 102 |
98 scoped_refptr<HostMessageFilter> message_filter_; | 103 scoped_refptr<HostMessageFilter> message_filter_; |
99 | 104 |
100 DISALLOW_COPY_AND_ASSIGN(BrowserPpapiHostImpl); | 105 DISALLOW_COPY_AND_ASSIGN(BrowserPpapiHostImpl); |
101 }; | 106 }; |
102 | 107 |
103 } // namespace content | 108 } // namespace content |
104 | 109 |
105 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_BROWSER_PPAPI_HOST_IMPL_H_ | 110 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_BROWSER_PPAPI_HOST_IMPL_H_ |
OLD | NEW |