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

Side by Side Diff: webkit/glue/plugins/plugin_list_mac.mm

Issue 5699005: Policy: Re-enabled plugin still disabled (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed PluginGroup::DisableOutdatedPlugins Created 10 years 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
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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/glue/plugins/plugin_list.h" 5 #include "webkit/glue/plugins/plugin_list.h"
6 6
7 #import <Foundation/Foundation.h> 7 #import <Foundation/Foundation.h>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/mac_util.h" 10 #include "base/mac_util.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 void PluginList::GetPluginDirectories(std::vector<FilePath>* plugin_dirs) { 71 void PluginList::GetPluginDirectories(std::vector<FilePath>* plugin_dirs) {
72 // Load from the user's area 72 // Load from the user's area
73 GetPluginCommonDirectory(plugin_dirs, true); 73 GetPluginCommonDirectory(plugin_dirs, true);
74 74
75 // Load from the machine-wide area 75 // Load from the machine-wide area
76 GetPluginCommonDirectory(plugin_dirs, false); 76 GetPluginCommonDirectory(plugin_dirs, false);
77 } 77 }
78 78
79 void PluginList::LoadPluginsFromDir(const FilePath &path, 79 void PluginList::LoadPluginsFromDir(const FilePath &path,
80 std::vector<WebPluginInfo>* plugins,
81 std::set<FilePath>* visited_plugins) { 80 std::set<FilePath>* visited_plugins) {
82 file_util::FileEnumerator enumerator(path, 81 file_util::FileEnumerator enumerator(path,
83 false, // not recursive 82 false, // not recursive
84 file_util::FileEnumerator::DIRECTORIES); 83 file_util::FileEnumerator::DIRECTORIES);
85 for (FilePath path = enumerator.Next(); !path.value().empty(); 84 for (FilePath path = enumerator.Next(); !path.value().empty();
86 path = enumerator.Next()) { 85 path = enumerator.Next()) {
87 LoadPlugin(path, plugins); 86 LoadPlugin(path);
88 visited_plugins->insert(path); 87 visited_plugins->insert(path);
89 } 88 }
90 } 89 }
91 90
92 bool PluginList::ShouldLoadPlugin(const WebPluginInfo& info, 91 bool PluginList::ShouldLoadPlugin(const WebPluginInfo& info) {
93 std::vector<WebPluginInfo>* plugins) {
94 if (IsBlacklistedPlugin(info)) 92 if (IsBlacklistedPlugin(info))
95 return false; 93 return false;
96 94
97 // Hierarchy check 95 // Hierarchy check
98 // (we're loading plugins hierarchically from Library folders, so plugins we 96 // (we're loading plugins hierarchically from Library folders, so plugins we
99 // encounter earlier must override plugins we encounter later) 97 // encounter earlier must override plugins we encounter later)
100 for (size_t i = 0; i < plugins->size(); ++i) { 98 std::vector<WebPluginInfo*> new_plugins;
101 if ((*plugins)[i].path.BaseName() == info.path.BaseName()) { 99 for (PluginGroup::PluginMap::iterator current_group = plugin_groups_.begin();
102 return false; // We already have a loaded plugin higher in the hierarchy. 100 current_group != plugin_groups_.end(); ++current_group) {
101 std::list<WebPluginInfo>& group_plugins =
102 current_group->second->GetPlugins();
103 for (std::list<WebPluginInfo>::iterator it = group_plugins.begin();
104 it != group_plugins.end();
105 ++it) {
106 if (it->path.BaseName() == info.path.BaseName()) {
107 // We already have a loaded plugin higher in the hierarchy.
108 return false;
109 }
103 } 110 }
104 } 111 }
105 112
106 return true; 113 return true;
107 } 114 }
108 115
109 } // namespace NPAPI 116 } // namespace NPAPI
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698