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 "chrome/browser/plugin_service.h" | 5 #include "chrome/browser/plugin_service.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 } | 296 } |
297 | 297 |
298 void PluginService::GetAllowedPluginForOpenChannelToPlugin( | 298 void PluginService::GetAllowedPluginForOpenChannelToPlugin( |
299 const GURL& url, | 299 const GURL& url, |
300 const std::string& mime_type, | 300 const std::string& mime_type, |
301 PluginProcessHost::Client* client) { | 301 PluginProcessHost::Client* client) { |
302 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 302 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
303 webkit::npapi::WebPluginInfo info; | 303 webkit::npapi::WebPluginInfo info; |
304 bool found = GetFirstAllowedPluginInfo(url, mime_type, &info, NULL); | 304 bool found = GetFirstAllowedPluginInfo(url, mime_type, &info, NULL); |
305 FilePath plugin_path; | 305 FilePath plugin_path; |
306 if (found && info.enabled) | 306 if (found && webkit::npapi::IsPluginEnabled(info)) |
307 plugin_path = FilePath(info.path); | 307 plugin_path = FilePath(info.path); |
308 | 308 |
309 // Now we jump back to the IO thread to finish opening the channel. | 309 // Now we jump back to the IO thread to finish opening the channel. |
310 BrowserThread::PostTask( | 310 BrowserThread::PostTask( |
311 BrowserThread::IO, FROM_HERE, | 311 BrowserThread::IO, FROM_HERE, |
312 NewRunnableMethod( | 312 NewRunnableMethod( |
313 this, &PluginService::FinishOpenChannelToPlugin, | 313 this, &PluginService::FinishOpenChannelToPlugin, |
314 plugin_path, client)); | 314 plugin_path, client)); |
315 } | 315 } |
316 | 316 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 | 424 |
425 #if defined(OS_MACOSX) | 425 #if defined(OS_MACOSX) |
426 case NotificationType::APP_ACTIVATED: { | 426 case NotificationType::APP_ACTIVATED: { |
427 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 427 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
428 NewRunnableFunction(&NotifyPluginsOfActivation)); | 428 NewRunnableFunction(&NotifyPluginsOfActivation)); |
429 break; | 429 break; |
430 } | 430 } |
431 #endif | 431 #endif |
432 | 432 |
433 case NotificationType::PLUGIN_ENABLE_STATUS_CHANGED: { | 433 case NotificationType::PLUGIN_ENABLE_STATUS_CHANGED: { |
| 434 webkit::npapi::PluginList::Singleton()->RefreshPlugins(); |
434 PurgePluginListCache(false); | 435 PurgePluginListCache(false); |
435 break; | 436 break; |
436 } | 437 } |
437 default: | 438 default: |
438 NOTREACHED(); | 439 NOTREACHED(); |
439 } | 440 } |
440 } | 441 } |
441 | 442 |
442 bool PluginService::PrivatePluginAllowedForURL(const FilePath& plugin_path, | 443 bool PluginService::PrivatePluginAllowedForURL(const FilePath& plugin_path, |
443 const GURL& url) { | 444 const GURL& url) { |
(...skipping 14 matching lines...) Expand all Loading... |
458 void PluginService::RegisterPepperPlugins() { | 459 void PluginService::RegisterPepperPlugins() { |
459 std::vector<PepperPluginInfo> plugins; | 460 std::vector<PepperPluginInfo> plugins; |
460 PepperPluginRegistry::GetList(&plugins); | 461 PepperPluginRegistry::GetList(&plugins); |
461 for (size_t i = 0; i < plugins.size(); ++i) { | 462 for (size_t i = 0; i < plugins.size(); ++i) { |
462 webkit::npapi::WebPluginInfo info; | 463 webkit::npapi::WebPluginInfo info; |
463 info.path = plugins[i].path; | 464 info.path = plugins[i].path; |
464 info.name = plugins[i].name.empty() ? | 465 info.name = plugins[i].name.empty() ? |
465 WideToUTF16(plugins[i].path.BaseName().ToWStringHack()) : | 466 WideToUTF16(plugins[i].path.BaseName().ToWStringHack()) : |
466 ASCIIToUTF16(plugins[i].name); | 467 ASCIIToUTF16(plugins[i].name); |
467 info.desc = ASCIIToUTF16(plugins[i].description); | 468 info.desc = ASCIIToUTF16(plugins[i].description); |
468 info.enabled = true; | 469 info.enabled = webkit::npapi::WebPluginInfo::USER_ENABLED_POLICY_UNMANAGED; |
469 | 470 |
470 // TODO(evan): Pepper shouldn't require us to parse strings to get | 471 // TODO(evan): Pepper shouldn't require us to parse strings to get |
471 // the list of mime types out. | 472 // the list of mime types out. |
472 if (!webkit::npapi::PluginList::ParseMimeTypes( | 473 if (!webkit::npapi::PluginList::ParseMimeTypes( |
473 JoinString(plugins[i].mime_types, '|'), | 474 JoinString(plugins[i].mime_types, '|'), |
474 plugins[i].file_extensions, | 475 plugins[i].file_extensions, |
475 ASCIIToUTF16(plugins[i].type_descriptions), | 476 ASCIIToUTF16(plugins[i].type_descriptions), |
476 &info.mime_types)) { | 477 &info.mime_types)) { |
477 LOG(ERROR) << "Error parsing mime types for " | 478 LOG(ERROR) << "Error parsing mime types for " |
478 << plugins[i].path.ToWStringHack(); | 479 << plugins[i].path.ToWStringHack(); |
479 return; | 480 return; |
480 } | 481 } |
481 | 482 |
482 webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin(info); | 483 webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin(info); |
483 } | 484 } |
484 } | 485 } |
485 | 486 |
486 #if defined(OS_LINUX) | 487 #if defined(OS_LINUX) |
487 // static | 488 // static |
488 void PluginService::RegisterFilePathWatcher( | 489 void PluginService::RegisterFilePathWatcher( |
489 FilePathWatcher *watcher, | 490 FilePathWatcher *watcher, |
490 const FilePath& path, | 491 const FilePath& path, |
491 FilePathWatcher::Delegate* delegate) { | 492 FilePathWatcher::Delegate* delegate) { |
492 bool result = watcher->Watch(path, delegate); | 493 bool result = watcher->Watch(path, delegate); |
493 DCHECK(result); | 494 DCHECK(result); |
494 } | 495 } |
495 #endif | 496 #endif |
OLD | NEW |