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