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