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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 renderer_msg_filter, url, mime_type, reply_msg)); |
264 } | 264 } |
| 265 |
265 void PluginService::GetAllowedPluginForOpenChannelToPlugin( | 266 void PluginService::GetAllowedPluginForOpenChannelToPlugin( |
266 ResourceMessageFilter* renderer_msg_filter, | 267 ResourceMessageFilter* renderer_msg_filter, |
267 const GURL& url, | 268 const GURL& url, |
268 const std::string& mime_type, | 269 const std::string& mime_type, |
269 IPC::Message* reply_msg) { | 270 IPC::Message* reply_msg) { |
270 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 271 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
271 WebPluginInfo info; | 272 WebPluginInfo info; |
272 bool found = GetFirstAllowedPluginInfo(url, mime_type, &info, NULL); | 273 bool found = GetFirstAllowedPluginInfo(url, mime_type, &info, NULL); |
273 FilePath plugin_path; | 274 FilePath plugin_path; |
274 if (found && info.enabled) | 275 if (found && info.enabled) |
275 plugin_path = FilePath(info.path); | 276 plugin_path = FilePath(info.path); |
| 277 |
276 // 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. |
277 BrowserThread::PostTask( | 279 BrowserThread::PostTask( |
278 BrowserThread::IO, FROM_HERE, | 280 BrowserThread::IO, FROM_HERE, |
279 NewRunnableMethod( | 281 NewRunnableMethod( |
280 this, &PluginService::FinishOpenChannelToPlugin, | 282 this, &PluginService::FinishOpenChannelToPlugin, |
281 renderer_msg_filter, mime_type, plugin_path, reply_msg)); | 283 renderer_msg_filter, mime_type, plugin_path, reply_msg)); |
282 } | 284 } |
283 | 285 |
284 void PluginService::FinishOpenChannelToPlugin( | 286 void PluginService::FinishOpenChannelToPlugin( |
285 ResourceMessageFilter* renderer_msg_filter, | 287 ResourceMessageFilter* renderer_msg_filter, |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 info.mime_types = ASCIIToWide(JoinString(plugins[i].mime_types, '|')); | 445 info.mime_types = ASCIIToWide(JoinString(plugins[i].mime_types, '|')); |
444 | 446 |
445 // These NPAPI entry points will never be called. TODO(darin): Come up | 447 // These NPAPI entry points will never be called. TODO(darin): Come up |
446 // with a cleaner way to register pepper plugins with the NPAPI PluginList, | 448 // with a cleaner way to register pepper plugins with the NPAPI PluginList, |
447 // or perhaps refactor the PluginList to be less specific to NPAPI. | 449 // or perhaps refactor the PluginList to be less specific to NPAPI. |
448 memset(&info.entry_points, 0, sizeof(info.entry_points)); | 450 memset(&info.entry_points, 0, sizeof(info.entry_points)); |
449 | 451 |
450 NPAPI::PluginList::Singleton()->RegisterInternalPlugin(info); | 452 NPAPI::PluginList::Singleton()->RegisterInternalPlugin(info); |
451 } | 453 } |
452 } | 454 } |
OLD | NEW |