| 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 struct PepperRendererInstanceData; | 23 struct PepperRendererInstanceData; |
| 23 | 24 |
| 24 class CONTENT_EXPORT BrowserPpapiHostImpl : public BrowserPpapiHost { | 25 class CONTENT_EXPORT BrowserPpapiHostImpl : public BrowserPpapiHost { |
| 25 public: | 26 public: |
| 26 // The creator is responsible for calling set_plugin_process_handle as soon | 27 // The creator is responsible for calling set_plugin_process_handle as soon |
| 27 // as it is known (we start the process asynchronously so it won't be known | 28 // as it is known (we start the process asynchronously so it won't be known |
| 28 // when this object is created). | 29 // when this object is created). |
| 29 BrowserPpapiHostImpl(IPC::Sender* sender, | 30 BrowserPpapiHostImpl(IPC::Sender* sender, |
| 30 const ppapi::PpapiPermissions& permissions, | 31 const ppapi::PpapiPermissions& permissions, |
| 31 const std::string& plugin_name, | 32 const std::string& plugin_name, |
| 32 const FilePath& profile_data_directory); | 33 const FilePath& profile_data_directory, |
| 34 ProcessType plugin_process_type); |
| 33 virtual ~BrowserPpapiHostImpl(); | 35 virtual ~BrowserPpapiHostImpl(); |
| 34 | 36 |
| 35 // BrowserPpapiHost. | 37 // BrowserPpapiHost. |
| 36 virtual ppapi::host::PpapiHost* GetPpapiHost() OVERRIDE; | 38 virtual ppapi::host::PpapiHost* GetPpapiHost() OVERRIDE; |
| 37 virtual base::ProcessHandle GetPluginProcessHandle() const OVERRIDE; | 39 virtual base::ProcessHandle GetPluginProcessHandle() const OVERRIDE; |
| 38 virtual bool IsValidInstance(PP_Instance instance) const OVERRIDE; | 40 virtual bool IsValidInstance(PP_Instance instance) const OVERRIDE; |
| 39 virtual bool GetRenderViewIDsForInstance(PP_Instance instance, | 41 virtual bool GetRenderViewIDsForInstance(PP_Instance instance, |
| 40 int* render_process_id, | 42 int* render_process_id, |
| 41 int* render_view_id) const OVERRIDE; | 43 int* render_view_id) const OVERRIDE; |
| 42 virtual const std::string& GetPluginName() OVERRIDE; | 44 virtual const std::string& GetPluginName() OVERRIDE; |
| 43 virtual const FilePath& GetProfileDataDirectory() OVERRIDE; | 45 virtual const FilePath& GetProfileDataDirectory() OVERRIDE; |
| 44 virtual GURL GetDocumentURLForInstance(PP_Instance instance) OVERRIDE; | 46 virtual GURL GetDocumentURLForInstance(PP_Instance instance) OVERRIDE; |
| 45 virtual GURL GetPluginURLForInstance(PP_Instance instance) OVERRIDE; | 47 virtual GURL GetPluginURLForInstance(PP_Instance instance) OVERRIDE; |
| 46 | 48 |
| 47 void set_plugin_process_handle(base::ProcessHandle handle) { | 49 void set_plugin_process_handle(base::ProcessHandle handle) { |
| 48 plugin_process_handle_ = handle; | 50 plugin_process_handle_ = handle; |
| 49 } | 51 } |
| 50 | 52 |
| 53 ProcessType plugin_process_type() { return plugin_process_type_; } |
| 54 |
| 51 // These two functions are notifications that an instance has been created | 55 // These two functions are notifications that an instance has been created |
| 52 // or destroyed. They allow us to maintain a mapping of PP_Instance to data | 56 // or destroyed. They allow us to maintain a mapping of PP_Instance to data |
| 53 // associated with the instance including view IDs in the browser process. | 57 // associated with the instance including view IDs in the browser process. |
| 54 void AddInstance(PP_Instance instance, | 58 void AddInstance(PP_Instance instance, |
| 55 const PepperRendererInstanceData& instance_data); | 59 const PepperRendererInstanceData& instance_data); |
| 56 void DeleteInstance(PP_Instance instance); | 60 void DeleteInstance(PP_Instance instance); |
| 57 | 61 |
| 58 scoped_refptr<IPC::ChannelProxy::MessageFilter> message_filter() { | 62 scoped_refptr<IPC::ChannelProxy::MessageFilter> message_filter() { |
| 59 return message_filter_; | 63 return message_filter_; |
| 60 } | 64 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 77 private: | 81 private: |
| 78 virtual ~HostMessageFilter() {} | 82 virtual ~HostMessageFilter() {} |
| 79 | 83 |
| 80 ppapi::host::PpapiHost* ppapi_host_; | 84 ppapi::host::PpapiHost* ppapi_host_; |
| 81 }; | 85 }; |
| 82 | 86 |
| 83 scoped_ptr<ppapi::host::PpapiHost> ppapi_host_; | 87 scoped_ptr<ppapi::host::PpapiHost> ppapi_host_; |
| 84 base::ProcessHandle plugin_process_handle_; | 88 base::ProcessHandle plugin_process_handle_; |
| 85 std::string plugin_name_; | 89 std::string plugin_name_; |
| 86 FilePath profile_data_directory_; | 90 FilePath profile_data_directory_; |
| 91 ProcessType plugin_process_type_; |
| 87 | 92 |
| 88 // Tracks all PP_Instances in this plugin and associated renderer-related | 93 // Tracks all PP_Instances in this plugin and associated renderer-related |
| 89 // data. | 94 // data. |
| 90 typedef std::map<PP_Instance, PepperRendererInstanceData> InstanceMap; | 95 typedef std::map<PP_Instance, PepperRendererInstanceData> InstanceMap; |
| 91 InstanceMap instance_map_; | 96 InstanceMap instance_map_; |
| 92 | 97 |
| 93 scoped_refptr<HostMessageFilter> message_filter_; | 98 scoped_refptr<HostMessageFilter> message_filter_; |
| 94 | 99 |
| 95 DISALLOW_COPY_AND_ASSIGN(BrowserPpapiHostImpl); | 100 DISALLOW_COPY_AND_ASSIGN(BrowserPpapiHostImpl); |
| 96 }; | 101 }; |
| 97 | 102 |
| 98 } // namespace content | 103 } // namespace content |
| 99 | 104 |
| 100 #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 |