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 #include <unordered_map> | 10 #include <unordered_map> |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 const base::Process& GetPluginProcess() const override; | 64 const base::Process& GetPluginProcess() const override; |
65 bool IsValidInstance(PP_Instance instance) const override; | 65 bool IsValidInstance(PP_Instance instance) const override; |
66 bool GetRenderFrameIDsForInstance(PP_Instance instance, | 66 bool GetRenderFrameIDsForInstance(PP_Instance instance, |
67 int* render_process_id, | 67 int* render_process_id, |
68 int* render_frame_id) const override; | 68 int* render_frame_id) const override; |
69 const std::string& GetPluginName() override; | 69 const std::string& GetPluginName() override; |
70 const base::FilePath& GetPluginPath() override; | 70 const base::FilePath& GetPluginPath() override; |
71 const base::FilePath& GetProfileDataDirectory() override; | 71 const base::FilePath& GetProfileDataDirectory() override; |
72 GURL GetDocumentURLForInstance(PP_Instance instance) override; | 72 GURL GetDocumentURLForInstance(PP_Instance instance) override; |
73 GURL GetPluginURLForInstance(PP_Instance instance) override; | 73 GURL GetPluginURLForInstance(PP_Instance instance) override; |
74 void SetOnKeepaliveCallback( | |
75 const BrowserPpapiHost::OnKeepaliveCallback& callback) override; | |
76 | 74 |
77 // Whether the plugin context is secure. That is, it is served from a secure | 75 // Whether the plugin context is secure. That is, it is served from a secure |
78 // origin and it is embedded within a hierarchy of secure frames. This value | 76 // origin and it is embedded within a hierarchy of secure frames. This value |
79 // comes from the renderer so should not be trusted. It is used for metrics. | 77 // comes from the renderer so should not be trusted. It is used for metrics. |
80 bool IsPotentiallySecurePluginContext(PP_Instance instance); | 78 bool IsPotentiallySecurePluginContext(PP_Instance instance); |
81 | 79 |
82 void set_plugin_process(base::Process process) { | 80 void set_plugin_process(base::Process process) { |
83 plugin_process_ = std::move(process); | 81 plugin_process_ = std::move(process); |
84 } | 82 } |
85 | 83 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 BrowserPpapiHostImpl* browser_ppapi_host_impl); | 116 BrowserPpapiHostImpl* browser_ppapi_host_impl); |
119 | 117 |
120 // IPC::MessageFilter. | 118 // IPC::MessageFilter. |
121 bool OnMessageReceived(const IPC::Message& msg) override; | 119 bool OnMessageReceived(const IPC::Message& msg) override; |
122 | 120 |
123 void OnHostDestroyed(); | 121 void OnHostDestroyed(); |
124 | 122 |
125 private: | 123 private: |
126 ~HostMessageFilter() override; | 124 ~HostMessageFilter() override; |
127 | 125 |
128 void OnKeepalive(); | |
129 void OnHostMsgLogInterfaceUsage(int hash) const; | 126 void OnHostMsgLogInterfaceUsage(int hash) const; |
130 | 127 |
131 // Non owning pointers cleared in OnHostDestroyed() | 128 // Non owning pointers cleared in OnHostDestroyed() |
132 ppapi::host::PpapiHost* ppapi_host_; | 129 ppapi::host::PpapiHost* ppapi_host_; |
133 BrowserPpapiHostImpl* browser_ppapi_host_impl_; | 130 BrowserPpapiHostImpl* browser_ppapi_host_impl_; |
134 }; | 131 }; |
135 | 132 |
136 struct InstanceData { | 133 struct InstanceData { |
137 InstanceData(const PepperRendererInstanceData& renderer_data); | 134 InstanceData(const PepperRendererInstanceData& renderer_data); |
138 ~InstanceData(); | 135 ~InstanceData(); |
139 | 136 |
140 PepperRendererInstanceData renderer_data; | 137 PepperRendererInstanceData renderer_data; |
141 bool is_throttled; | 138 bool is_throttled; |
142 | 139 |
143 base::ObserverList<InstanceObserver> observer_list; | 140 base::ObserverList<InstanceObserver> observer_list; |
144 }; | 141 }; |
145 | 142 |
146 // Reports plugin activity to the callback set with SetOnKeepaliveCallback. | |
147 void OnKeepalive(); | |
148 | |
149 std::unique_ptr<ppapi::host::PpapiHost> ppapi_host_; | 143 std::unique_ptr<ppapi::host::PpapiHost> ppapi_host_; |
150 base::Process plugin_process_; | 144 base::Process plugin_process_; |
151 std::string plugin_name_; | 145 std::string plugin_name_; |
152 base::FilePath plugin_path_; | 146 base::FilePath plugin_path_; |
153 base::FilePath profile_data_directory_; | 147 base::FilePath profile_data_directory_; |
154 | 148 |
155 // If true, this refers to a plugin running in the renderer process. | 149 // If true, this refers to a plugin running in the renderer process. |
156 bool in_process_; | 150 bool in_process_; |
157 | 151 |
158 // If true, this is an external plugin, i.e. created by the embedder using | 152 // If true, this is an external plugin, i.e. created by the embedder using |
159 // BrowserPpapiHost::CreateExternalPluginProcess. | 153 // BrowserPpapiHost::CreateExternalPluginProcess. |
160 bool external_plugin_; | 154 bool external_plugin_; |
161 | 155 |
162 scoped_refptr<SSLContextHelper> ssl_context_helper_; | 156 scoped_refptr<SSLContextHelper> ssl_context_helper_; |
163 | 157 |
164 // Tracks all PP_Instances in this plugin and associated data. | 158 // Tracks all PP_Instances in this plugin and associated data. |
165 std::unordered_map<PP_Instance, std::unique_ptr<InstanceData>> instance_map_; | 159 std::unordered_map<PP_Instance, std::unique_ptr<InstanceData>> instance_map_; |
166 | 160 |
167 scoped_refptr<HostMessageFilter> message_filter_; | 161 scoped_refptr<HostMessageFilter> message_filter_; |
168 | 162 |
169 BrowserPpapiHost::OnKeepaliveCallback on_keepalive_callback_; | |
170 | |
171 DISALLOW_COPY_AND_ASSIGN(BrowserPpapiHostImpl); | 163 DISALLOW_COPY_AND_ASSIGN(BrowserPpapiHostImpl); |
172 }; | 164 }; |
173 | 165 |
174 } // namespace content | 166 } // namespace content |
175 | 167 |
176 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_BROWSER_PPAPI_HOST_IMPL_H_ | 168 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_BROWSER_PPAPI_HOST_IMPL_H_ |
OLD | NEW |