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