Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(459)

Side by Side Diff: webkit/plugins/npapi/plugin_list.cc

Issue 7477044: Use PluginPrefs in ChromePluginServiceFilter to check whether a plugin is enabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/renderer/webplugin_delegate_proxy.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "webkit/plugins/npapi/plugin_list.h" 5 #include "webkit/plugins/npapi/plugin_list.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 LoadPlugins(); 515 LoadPlugins();
516 base::AutoLock lock(lock_); 516 base::AutoLock lock(lock_);
517 if (use_stale) 517 if (use_stale)
518 *use_stale = plugins_need_refresh_; 518 *use_stale = plugins_need_refresh_;
519 info->clear(); 519 info->clear();
520 if (actual_mime_types) 520 if (actual_mime_types)
521 actual_mime_types->clear(); 521 actual_mime_types->clear();
522 522
523 std::set<FilePath> visited_plugins; 523 std::set<FilePath> visited_plugins;
524 524
525 // Add in enabled plugins by mime type. 525 // Add in plugins by mime type.
526 for (size_t i = 0; i < plugin_groups_.size(); ++i) { 526 for (size_t i = 0; i < plugin_groups_.size(); ++i) {
527 const std::vector<WebPluginInfo>& plugins = 527 const std::vector<WebPluginInfo>& plugins =
528 plugin_groups_[i]->web_plugins_info(); 528 plugin_groups_[i]->web_plugins_info();
529 for (size_t i = 0; i < plugins.size(); ++i) { 529 for (size_t i = 0; i < plugins.size(); ++i) {
530 if (IsPluginEnabled(plugins[i]) && SupportsType(plugins[i], 530 if (SupportsType(plugins[i], mime_type, allow_wildcard)) {
531 mime_type, allow_wildcard)) {
532 FilePath path = plugins[i].path; 531 FilePath path = plugins[i].path;
533 if (path.value() != kDefaultPluginLibraryName && 532 if (path.value() != kDefaultPluginLibraryName &&
534 visited_plugins.insert(path).second) { 533 visited_plugins.insert(path).second) {
535 info->push_back(plugins[i]); 534 info->push_back(plugins[i]);
536 if (actual_mime_types) 535 if (actual_mime_types)
537 actual_mime_types->push_back(mime_type); 536 actual_mime_types->push_back(mime_type);
538 } 537 }
539 } 538 }
540 } 539 }
541 } 540 }
542 541
543 // Add in enabled plugins by url. 542 // Add in plugins by url.
544 std::string path = url.path(); 543 std::string path = url.path();
545 std::string::size_type last_dot = path.rfind('.'); 544 std::string::size_type last_dot = path.rfind('.');
546 if (last_dot != std::string::npos) { 545 if (last_dot != std::string::npos) {
547 std::string extension = StringToLowerASCII(std::string(path, last_dot+1)); 546 std::string extension = StringToLowerASCII(std::string(path, last_dot+1));
548 std::string actual_mime_type; 547 std::string actual_mime_type;
549 for (size_t i = 0; i < plugin_groups_.size(); ++i) { 548 for (size_t i = 0; i < plugin_groups_.size(); ++i) {
550 const std::vector<WebPluginInfo>& plugins = 549 const std::vector<WebPluginInfo>& plugins =
551 plugin_groups_[i]->web_plugins_info(); 550 plugin_groups_[i]->web_plugins_info();
552 for (size_t i = 0; i < plugins.size(); ++i) { 551 for (size_t i = 0; i < plugins.size(); ++i) {
553 if (IsPluginEnabled(plugins[i]) && 552 if (SupportsExtension(plugins[i], extension, &actual_mime_type)) {
554 SupportsExtension(plugins[i], extension, &actual_mime_type)) {
555 FilePath path = plugins[i].path; 553 FilePath path = plugins[i].path;
556 if (path.value() != kDefaultPluginLibraryName && 554 if (path.value() != kDefaultPluginLibraryName &&
557 visited_plugins.insert(path).second) { 555 visited_plugins.insert(path).second) {
558 info->push_back(plugins[i]); 556 info->push_back(plugins[i]);
559 if (actual_mime_types) 557 if (actual_mime_types)
560 actual_mime_types->push_back(actual_mime_type); 558 actual_mime_types->push_back(actual_mime_type);
561 } 559 }
562 } 560 }
563 } 561 }
564 } 562 }
565 } 563 }
566 564
567 // Add in disabled plugins by mime type.
568 for (size_t i = 0; i < plugin_groups_.size(); ++i) {
569 const std::vector<WebPluginInfo>& plugins =
570 plugin_groups_[i]->web_plugins_info();
571 for (size_t i = 0; i < plugins.size(); ++i) {
572 if (!IsPluginEnabled(plugins[i]) &&
573 SupportsType(plugins[i], mime_type, allow_wildcard)) {
574 FilePath path = plugins[i].path;
575 if (path.value() != kDefaultPluginLibraryName &&
576 visited_plugins.insert(path).second) {
577 info->push_back(plugins[i]);
578 if (actual_mime_types)
579 actual_mime_types->push_back(mime_type);
580 }
581 }
582 }
583 }
584
585 // Add the default plugin at the end if it supports the mime type given, 565 // Add the default plugin at the end if it supports the mime type given,
586 // and the default plugin is enabled. 566 // and the default plugin is enabled.
587 for (size_t i = 0; i < plugin_groups_.size(); ++i) { 567 for (size_t i = 0; i < plugin_groups_.size(); ++i) {
588 #if defined(OS_WIN) 568 #if defined(OS_WIN)
589 if (plugin_groups_[i]->identifier().compare( 569 if (plugin_groups_[i]->identifier().compare(
590 WideToUTF8(kDefaultPluginLibraryName)) == 0) { 570 WideToUTF8(kDefaultPluginLibraryName)) == 0) {
591 #else 571 #else
592 if (plugin_groups_[i]->identifier().compare( 572 if (plugin_groups_[i]->identifier().compare(
593 kDefaultPluginLibraryName) == 0) { 573 kDefaultPluginLibraryName) == 0) {
594 #endif 574 #endif
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 void PluginList::DisableOutdatedPluginGroups() { 764 void PluginList::DisableOutdatedPluginGroups() {
785 disable_outdated_plugins_ = true; 765 disable_outdated_plugins_ = true;
786 } 766 }
787 767
788 PluginList::~PluginList() { 768 PluginList::~PluginList() {
789 } 769 }
790 770
791 771
792 } // namespace npapi 772 } // namespace npapi
793 } // namespace webkit 773 } // namespace webkit
OLDNEW
« no previous file with comments | « content/renderer/webplugin_delegate_proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698