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 |
(...skipping 24 matching lines...) Expand all Loading... |
35 // when this object is created). | 35 // when this object is created). |
36 // |external_plugin| signfies that this is a proxy created for an embedder's | 36 // |external_plugin| signfies that this is a proxy created for an embedder's |
37 // plugin, i.e. using BrowserPpapiHost::CreateExternalPluginProcess. | 37 // plugin, i.e. using BrowserPpapiHost::CreateExternalPluginProcess. |
38 BrowserPpapiHostImpl(IPC::Sender* sender, | 38 BrowserPpapiHostImpl(IPC::Sender* sender, |
39 const ppapi::PpapiPermissions& permissions, | 39 const ppapi::PpapiPermissions& permissions, |
40 const std::string& plugin_name, | 40 const std::string& plugin_name, |
41 const base::FilePath& plugin_path, | 41 const base::FilePath& plugin_path, |
42 const base::FilePath& profile_data_directory, | 42 const base::FilePath& profile_data_directory, |
43 bool in_process, | 43 bool in_process, |
44 bool external_plugin); | 44 bool external_plugin); |
45 virtual ~BrowserPpapiHostImpl(); | 45 ~BrowserPpapiHostImpl() override; |
46 | 46 |
47 // BrowserPpapiHost. | 47 // BrowserPpapiHost. |
48 virtual ppapi::host::PpapiHost* GetPpapiHost() override; | 48 ppapi::host::PpapiHost* GetPpapiHost() override; |
49 virtual base::ProcessHandle GetPluginProcessHandle() const override; | 49 base::ProcessHandle GetPluginProcessHandle() const override; |
50 virtual bool IsValidInstance(PP_Instance instance) const override; | 50 bool IsValidInstance(PP_Instance instance) const override; |
51 virtual bool GetRenderFrameIDsForInstance(PP_Instance instance, | 51 bool GetRenderFrameIDsForInstance(PP_Instance instance, |
52 int* render_process_id, | 52 int* render_process_id, |
53 int* render_frame_id) const | 53 int* render_frame_id) const override; |
54 override; | 54 const std::string& GetPluginName() override; |
55 virtual const std::string& GetPluginName() override; | 55 const base::FilePath& GetPluginPath() override; |
56 virtual const base::FilePath& GetPluginPath() override; | 56 const base::FilePath& GetProfileDataDirectory() override; |
57 virtual const base::FilePath& GetProfileDataDirectory() override; | 57 GURL GetDocumentURLForInstance(PP_Instance instance) override; |
58 virtual GURL GetDocumentURLForInstance(PP_Instance instance) override; | 58 GURL GetPluginURLForInstance(PP_Instance instance) override; |
59 virtual GURL GetPluginURLForInstance(PP_Instance instance) override; | 59 void SetOnKeepaliveCallback( |
60 virtual void SetOnKeepaliveCallback( | |
61 const BrowserPpapiHost::OnKeepaliveCallback& callback) override; | 60 const BrowserPpapiHost::OnKeepaliveCallback& callback) override; |
62 | 61 |
63 void set_plugin_process_handle(base::ProcessHandle handle) { | 62 void set_plugin_process_handle(base::ProcessHandle handle) { |
64 plugin_process_handle_ = handle; | 63 plugin_process_handle_ = handle; |
65 } | 64 } |
66 | 65 |
67 bool external_plugin() const { return external_plugin_; } | 66 bool external_plugin() const { return external_plugin_; } |
68 | 67 |
69 // These two functions are notifications that an instance has been created | 68 // These two functions are notifications that an instance has been created |
70 // or destroyed. They allow us to maintain a mapping of PP_Instance to data | 69 // or destroyed. They allow us to maintain a mapping of PP_Instance to data |
(...skipping 15 matching lines...) Expand all Loading... |
86 | 85 |
87 // Implementing MessageFilter on BrowserPpapiHostImpl makes it ref-counted, | 86 // Implementing MessageFilter on BrowserPpapiHostImpl makes it ref-counted, |
88 // preventing us from returning these to embedders without holding a | 87 // preventing us from returning these to embedders without holding a |
89 // reference. To avoid that, define a message filter object. | 88 // reference. To avoid that, define a message filter object. |
90 class HostMessageFilter : public IPC::MessageFilter { | 89 class HostMessageFilter : public IPC::MessageFilter { |
91 public: | 90 public: |
92 HostMessageFilter(ppapi::host::PpapiHost* ppapi_host, | 91 HostMessageFilter(ppapi::host::PpapiHost* ppapi_host, |
93 BrowserPpapiHostImpl* browser_ppapi_host_impl); | 92 BrowserPpapiHostImpl* browser_ppapi_host_impl); |
94 | 93 |
95 // IPC::MessageFilter. | 94 // IPC::MessageFilter. |
96 virtual bool OnMessageReceived(const IPC::Message& msg) override; | 95 bool OnMessageReceived(const IPC::Message& msg) override; |
97 | 96 |
98 void OnHostDestroyed(); | 97 void OnHostDestroyed(); |
99 | 98 |
100 private: | 99 private: |
101 virtual ~HostMessageFilter(); | 100 ~HostMessageFilter() override; |
102 | 101 |
103 void OnKeepalive(); | 102 void OnKeepalive(); |
104 void OnHostMsgLogInterfaceUsage(int hash) const; | 103 void OnHostMsgLogInterfaceUsage(int hash) const; |
105 | 104 |
106 // Non owning pointers cleared in OnHostDestroyed() | 105 // Non owning pointers cleared in OnHostDestroyed() |
107 ppapi::host::PpapiHost* ppapi_host_; | 106 ppapi::host::PpapiHost* ppapi_host_; |
108 BrowserPpapiHostImpl* browser_ppapi_host_impl_; | 107 BrowserPpapiHostImpl* browser_ppapi_host_impl_; |
109 }; | 108 }; |
110 | 109 |
111 // Reports plugin activity to the callback set with SetOnKeepaliveCallback. | 110 // Reports plugin activity to the callback set with SetOnKeepaliveCallback. |
(...skipping 22 matching lines...) Expand all Loading... |
134 scoped_refptr<HostMessageFilter> message_filter_; | 133 scoped_refptr<HostMessageFilter> message_filter_; |
135 | 134 |
136 BrowserPpapiHost::OnKeepaliveCallback on_keepalive_callback_; | 135 BrowserPpapiHost::OnKeepaliveCallback on_keepalive_callback_; |
137 | 136 |
138 DISALLOW_COPY_AND_ASSIGN(BrowserPpapiHostImpl); | 137 DISALLOW_COPY_AND_ASSIGN(BrowserPpapiHostImpl); |
139 }; | 138 }; |
140 | 139 |
141 } // namespace content | 140 } // namespace content |
142 | 141 |
143 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_BROWSER_PPAPI_HOST_IMPL_H_ | 142 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_BROWSER_PPAPI_HOST_IMPL_H_ |
OLD | NEW |