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 // This class responds to requests from renderers for the list of plugins, and | 5 // This class responds to requests from renderers for the list of plugins, and |
6 // also a proxy object for plugin instances. | 6 // also a proxy object for plugin instances. |
7 | 7 |
8 #ifndef CONTENT_BROWSER_PLUGIN_SERVICE_IMPL_H_ | 8 #ifndef CONTENT_BROWSER_PLUGIN_SERVICE_IMPL_H_ |
9 #define CONTENT_BROWSER_PLUGIN_SERVICE_IMPL_H_ | 9 #define CONTENT_BROWSER_PLUGIN_SERVICE_IMPL_H_ |
10 | 10 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 class PluginDirWatcherDelegate; | 52 class PluginDirWatcherDelegate; |
53 class PluginLoaderPosix; | 53 class PluginLoaderPosix; |
54 class PluginServiceFilter; | 54 class PluginServiceFilter; |
55 class ResourceContext; | 55 class ResourceContext; |
56 struct PepperPluginInfo; | 56 struct PepperPluginInfo; |
57 | 57 |
58 // base::Bind() has limited arity, and the filter-related methods tend to | 58 // base::Bind() has limited arity, and the filter-related methods tend to |
59 // surpass that limit. | 59 // surpass that limit. |
60 struct PluginServiceFilterParams { | 60 struct PluginServiceFilterParams { |
61 int render_process_id; | 61 int render_process_id; |
62 int render_view_id; | 62 int render_frame_id; |
63 GURL page_url; | 63 GURL page_url; |
64 ResourceContext* resource_context; | 64 ResourceContext* resource_context; |
65 }; | 65 }; |
66 | 66 |
67 class CONTENT_EXPORT PluginServiceImpl | 67 class CONTENT_EXPORT PluginServiceImpl |
68 : NON_EXPORTED_BASE(public PluginService) { | 68 : NON_EXPORTED_BASE(public PluginService) { |
69 public: | 69 public: |
70 // Returns the PluginServiceImpl singleton. | 70 // Returns the PluginServiceImpl singleton. |
71 static PluginServiceImpl* GetInstance(); | 71 static PluginServiceImpl* GetInstance(); |
72 | 72 |
73 // PluginService implementation: | 73 // PluginService implementation: |
74 virtual void Init() OVERRIDE; | 74 virtual void Init() OVERRIDE; |
75 virtual void StartWatchingPlugins() OVERRIDE; | 75 virtual void StartWatchingPlugins() OVERRIDE; |
76 virtual bool GetPluginInfoArray( | 76 virtual bool GetPluginInfoArray( |
77 const GURL& url, | 77 const GURL& url, |
78 const std::string& mime_type, | 78 const std::string& mime_type, |
79 bool allow_wildcard, | 79 bool allow_wildcard, |
80 std::vector<WebPluginInfo>* info, | 80 std::vector<WebPluginInfo>* info, |
81 std::vector<std::string>* actual_mime_types) OVERRIDE; | 81 std::vector<std::string>* actual_mime_types) OVERRIDE; |
82 virtual bool GetPluginInfo(int render_process_id, | 82 virtual bool GetPluginInfo(int render_process_id, |
83 int render_view_id, | 83 int render_frame_id, |
84 ResourceContext* context, | 84 ResourceContext* context, |
85 const GURL& url, | 85 const GURL& url, |
86 const GURL& page_url, | 86 const GURL& page_url, |
87 const std::string& mime_type, | 87 const std::string& mime_type, |
88 bool allow_wildcard, | 88 bool allow_wildcard, |
89 bool* is_stale, | 89 bool* is_stale, |
90 WebPluginInfo* info, | 90 WebPluginInfo* info, |
91 std::string* actual_mime_type) OVERRIDE; | 91 std::string* actual_mime_type) OVERRIDE; |
92 virtual bool GetPluginInfoByPath(const base::FilePath& plugin_path, | 92 virtual bool GetPluginInfoByPath(const base::FilePath& plugin_path, |
93 WebPluginInfo* info) OVERRIDE; | 93 WebPluginInfo* info) OVERRIDE; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 int render_process_id, | 132 int render_process_id, |
133 const base::FilePath& plugin_path, | 133 const base::FilePath& plugin_path, |
134 const base::FilePath& profile_data_directory); | 134 const base::FilePath& profile_data_directory); |
135 PpapiPluginProcessHost* FindOrStartPpapiBrokerProcess( | 135 PpapiPluginProcessHost* FindOrStartPpapiBrokerProcess( |
136 int render_process_id, const base::FilePath& plugin_path); | 136 int render_process_id, const base::FilePath& plugin_path); |
137 | 137 |
138 // Opens a channel to a plugin process for the given mime type, starting | 138 // Opens a channel to a plugin process for the given mime type, starting |
139 // a new plugin process if necessary. This must be called on the IO thread | 139 // a new plugin process if necessary. This must be called on the IO thread |
140 // or else a deadlock can occur. | 140 // or else a deadlock can occur. |
141 void OpenChannelToNpapiPlugin(int render_process_id, | 141 void OpenChannelToNpapiPlugin(int render_process_id, |
142 int render_view_id, | 142 int render_frame_id, |
143 const GURL& url, | 143 const GURL& url, |
144 const GURL& page_url, | 144 const GURL& page_url, |
145 const std::string& mime_type, | 145 const std::string& mime_type, |
146 PluginProcessHost::Client* client); | 146 PluginProcessHost::Client* client); |
147 void OpenChannelToPpapiPlugin(int render_process_id, | 147 void OpenChannelToPpapiPlugin(int render_process_id, |
148 const base::FilePath& plugin_path, | 148 const base::FilePath& plugin_path, |
149 const base::FilePath& profile_data_directory, | 149 const base::FilePath& profile_data_directory, |
150 PpapiPluginProcessHost::PluginClient* client); | 150 PpapiPluginProcessHost::PluginClient* client); |
151 void OpenChannelToPpapiBroker(int render_process_id, | 151 void OpenChannelToPpapiBroker(int render_process_id, |
152 const base::FilePath& path, | 152 const base::FilePath& path, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 // because more arity is needed <http://crbug.com/98542>. This just forwards. | 188 // because more arity is needed <http://crbug.com/98542>. This just forwards. |
189 void ForwardGetAllowedPluginForOpenChannelToPlugin( | 189 void ForwardGetAllowedPluginForOpenChannelToPlugin( |
190 const PluginServiceFilterParams& params, | 190 const PluginServiceFilterParams& params, |
191 const GURL& url, | 191 const GURL& url, |
192 const std::string& mime_type, | 192 const std::string& mime_type, |
193 PluginProcessHost::Client* client, | 193 PluginProcessHost::Client* client, |
194 const std::vector<WebPluginInfo>&); | 194 const std::vector<WebPluginInfo>&); |
195 // Helper so we can do the plugin lookup on the FILE thread. | 195 // Helper so we can do the plugin lookup on the FILE thread. |
196 void GetAllowedPluginForOpenChannelToPlugin( | 196 void GetAllowedPluginForOpenChannelToPlugin( |
197 int render_process_id, | 197 int render_process_id, |
198 int render_view_id, | 198 int render_frame_id, |
199 const GURL& url, | 199 const GURL& url, |
200 const GURL& page_url, | 200 const GURL& page_url, |
201 const std::string& mime_type, | 201 const std::string& mime_type, |
202 PluginProcessHost::Client* client, | 202 PluginProcessHost::Client* client, |
203 ResourceContext* resource_context); | 203 ResourceContext* resource_context); |
204 | 204 |
205 // Helper so we can finish opening the channel after looking up the | 205 // Helper so we can finish opening the channel after looking up the |
206 // plugin. | 206 // plugin. |
207 void FinishOpenChannelToPlugin(int render_process_id, | 207 void FinishOpenChannelToPlugin(int render_process_id, |
208 const base::FilePath& plugin_path, | 208 const base::FilePath& plugin_path, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 | 244 |
245 // Used to detect if a given plug-in is crashing over and over. | 245 // Used to detect if a given plug-in is crashing over and over. |
246 std::map<base::FilePath, std::vector<base::Time> > crash_times_; | 246 std::map<base::FilePath, std::vector<base::Time> > crash_times_; |
247 | 247 |
248 DISALLOW_COPY_AND_ASSIGN(PluginServiceImpl); | 248 DISALLOW_COPY_AND_ASSIGN(PluginServiceImpl); |
249 }; | 249 }; |
250 | 250 |
251 } // namespace content | 251 } // namespace content |
252 | 252 |
253 #endif // CONTENT_BROWSER_PLUGIN_SERVICE_IMPL_H_ | 253 #endif // CONTENT_BROWSER_PLUGIN_SERVICE_IMPL_H_ |
OLD | NEW |