OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #include "chrome/browser/plugin_service.h" | 7 #include "chrome/browser/plugin_service.h" |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 ResourceMessageFilter* renderer_msg_filter, | 253 ResourceMessageFilter* renderer_msg_filter, |
254 const GURL& url, | 254 const GURL& url, |
255 const std::string& mime_type, | 255 const std::string& mime_type, |
256 IPC::Message* reply_msg) { | 256 IPC::Message* reply_msg) { |
257 // The PluginList::GetFirstAllowedPluginInfo may need to load the | 257 // The PluginList::GetFirstAllowedPluginInfo may need to load the |
258 // plugins. Don't do it on the IO thread. | 258 // plugins. Don't do it on the IO thread. |
259 BrowserThread::PostTask( | 259 BrowserThread::PostTask( |
260 BrowserThread::FILE, FROM_HERE, | 260 BrowserThread::FILE, FROM_HERE, |
261 NewRunnableMethod( | 261 NewRunnableMethod( |
262 this, &PluginService::GetAllowedPluginForOpenChannelToPlugin, | 262 this, &PluginService::GetAllowedPluginForOpenChannelToPlugin, |
263 renderer_msg_filter, url, mime_type, reply_msg)); | 263 make_scoped_refptr(renderer_msg_filter), url, mime_type, reply_msg)); |
264 } | 264 } |
265 | 265 |
266 void PluginService::GetAllowedPluginForOpenChannelToPlugin( | 266 void PluginService::GetAllowedPluginForOpenChannelToPlugin( |
267 ResourceMessageFilter* renderer_msg_filter, | 267 ResourceMessageFilter* renderer_msg_filter, |
268 const GURL& url, | 268 const GURL& url, |
269 const std::string& mime_type, | 269 const std::string& mime_type, |
270 IPC::Message* reply_msg) { | 270 IPC::Message* reply_msg) { |
271 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 271 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
272 WebPluginInfo info; | 272 WebPluginInfo info; |
273 bool found = GetFirstAllowedPluginInfo(url, mime_type, &info, NULL); | 273 bool found = GetFirstAllowedPluginInfo(url, mime_type, &info, NULL); |
274 FilePath plugin_path; | 274 FilePath plugin_path; |
275 if (found && info.enabled) | 275 if (found && info.enabled) |
276 plugin_path = FilePath(info.path); | 276 plugin_path = FilePath(info.path); |
277 | 277 |
278 // Now we jump back to the IO thread to finish opening the channel. | 278 // Now we jump back to the IO thread to finish opening the channel. |
279 BrowserThread::PostTask( | 279 BrowserThread::PostTask( |
280 BrowserThread::IO, FROM_HERE, | 280 BrowserThread::IO, FROM_HERE, |
281 NewRunnableMethod( | 281 NewRunnableMethod( |
282 this, &PluginService::FinishOpenChannelToPlugin, | 282 this, &PluginService::FinishOpenChannelToPlugin, |
283 renderer_msg_filter, mime_type, plugin_path, reply_msg)); | 283 make_scoped_refptr(renderer_msg_filter), mime_type, plugin_path, |
| 284 reply_msg)); |
284 } | 285 } |
285 | 286 |
286 void PluginService::FinishOpenChannelToPlugin( | 287 void PluginService::FinishOpenChannelToPlugin( |
287 ResourceMessageFilter* renderer_msg_filter, | 288 ResourceMessageFilter* renderer_msg_filter, |
288 const std::string& mime_type, | 289 const std::string& mime_type, |
289 const FilePath& plugin_path, | 290 const FilePath& plugin_path, |
290 IPC::Message* reply_msg) { | 291 IPC::Message* reply_msg) { |
291 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 292 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
292 | 293 |
293 PluginProcessHost* plugin_host = FindOrStartPluginProcess(plugin_path); | 294 PluginProcessHost* plugin_host = FindOrStartPluginProcess(plugin_path); |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 info.mime_types = ASCIIToWide(JoinString(plugins[i].mime_types, '|')); | 446 info.mime_types = ASCIIToWide(JoinString(plugins[i].mime_types, '|')); |
446 | 447 |
447 // These NPAPI entry points will never be called. TODO(darin): Come up | 448 // These NPAPI entry points will never be called. TODO(darin): Come up |
448 // with a cleaner way to register pepper plugins with the NPAPI PluginList, | 449 // with a cleaner way to register pepper plugins with the NPAPI PluginList, |
449 // or perhaps refactor the PluginList to be less specific to NPAPI. | 450 // or perhaps refactor the PluginList to be less specific to NPAPI. |
450 memset(&info.entry_points, 0, sizeof(info.entry_points)); | 451 memset(&info.entry_points, 0, sizeof(info.entry_points)); |
451 | 452 |
452 NPAPI::PluginList::Singleton()->RegisterInternalPlugin(info); | 453 NPAPI::PluginList::Singleton()->RegisterInternalPlugin(info); |
453 } | 454 } |
454 } | 455 } |
OLD | NEW |