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); |
27 virtual ~BrowserPpapiHostImpl(); | 31 virtual ~BrowserPpapiHostImpl(); |
28 | 32 |
29 // BrowserPpapiHost. | 33 // BrowserPpapiHost. |
30 virtual ppapi::host::PpapiHost* GetPpapiHost() OVERRIDE; | 34 virtual ppapi::host::PpapiHost* GetPpapiHost() OVERRIDE; |
31 virtual base::ProcessHandle GetPluginProcessHandle() const OVERRIDE; | 35 virtual base::ProcessHandle GetPluginProcessHandle() const OVERRIDE; |
32 virtual bool IsValidInstance(PP_Instance instance) const OVERRIDE; | 36 virtual bool IsValidInstance(PP_Instance instance) const OVERRIDE; |
33 virtual bool GetRenderViewIDsForInstance(PP_Instance instance, | 37 virtual bool GetRenderViewIDsForInstance(PP_Instance instance, |
34 int* render_process_id, | 38 int* render_process_id, |
35 int* render_view_id) const OVERRIDE; | 39 int* render_view_id) const OVERRIDE; |
| 40 virtual const std::string& GetPluginName() OVERRIDE; |
| 41 virtual const FilePath& GetProfileDataDirectory() OVERRIDE; |
36 | 42 |
37 void set_plugin_process_handle(base::ProcessHandle handle) { | 43 void set_plugin_process_handle(base::ProcessHandle handle) { |
38 plugin_process_handle_ = handle; | 44 plugin_process_handle_ = handle; |
39 } | 45 } |
40 | 46 |
41 // These two functions are notifications that an instance has been created | 47 // 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 | 48 // or destroyed. They allow us to maintain a mapping of PP_Instance to view |
43 // IDs in the browser process. | 49 // IDs in the browser process. |
44 void AddInstanceForView(PP_Instance instance, | 50 void AddInstanceForView(PP_Instance instance, |
45 int render_process_id, | 51 int render_process_id, |
(...skipping 26 matching lines...) Expand all Loading... |
72 void OnHostDestroyed(); | 78 void OnHostDestroyed(); |
73 | 79 |
74 private: | 80 private: |
75 virtual ~HostMessageFilter() {} | 81 virtual ~HostMessageFilter() {} |
76 | 82 |
77 ppapi::host::PpapiHost* ppapi_host_; | 83 ppapi::host::PpapiHost* ppapi_host_; |
78 }; | 84 }; |
79 | 85 |
80 ppapi::host::PpapiHost ppapi_host_; | 86 ppapi::host::PpapiHost ppapi_host_; |
81 base::ProcessHandle plugin_process_handle_; | 87 base::ProcessHandle plugin_process_handle_; |
| 88 std::string plugin_name_; |
| 89 FilePath profile_data_directory_; |
82 | 90 |
83 // Tracks all PP_Instances in this plugin and maps them to | 91 // Tracks all PP_Instances in this plugin and maps them to |
84 // RenderProcess/RenderView IDs. | 92 // RenderProcess/RenderView IDs. |
85 InstanceToViewMap instance_to_view_; | 93 InstanceToViewMap instance_to_view_; |
86 | 94 |
87 scoped_refptr<HostMessageFilter> message_filter_; | 95 scoped_refptr<HostMessageFilter> message_filter_; |
88 | 96 |
89 DISALLOW_COPY_AND_ASSIGN(BrowserPpapiHostImpl); | 97 DISALLOW_COPY_AND_ASSIGN(BrowserPpapiHostImpl); |
90 }; | 98 }; |
91 | 99 |
92 } // namespace content | 100 } // namespace content |
93 | 101 |
94 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_BROWSER_PPAPI_HOST_IMPL_H_ | 102 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_BROWSER_PPAPI_HOST_IMPL_H_ |
OLD | NEW |