OLD | NEW |
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 #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/mac_util.h" | 10 #include "base/mac/mac_util.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 77 |
78 // 10.5 includes the Java2 plugin, but as of Java for Mac OS X 10.5 Update 10 | 78 // 10.5 includes the Java2 plugin, but as of Java for Mac OS X 10.5 Update 10 |
79 // no longer has a symlink to it in the Internet Plug-Ins directory. | 79 // no longer has a symlink to it in the Internet Plug-Ins directory. |
80 // Manually include it since there's no other way to support Java. | 80 // Manually include it since there's no other way to support Java. |
81 if (base::mac::IsOSLeopard()) { | 81 if (base::mac::IsOSLeopard()) { |
82 plugin_dirs->push_back(FilePath( | 82 plugin_dirs->push_back(FilePath( |
83 "/System/Library/Java/Support/Deploy.bundle/Contents/Resources")); | 83 "/System/Library/Java/Support/Deploy.bundle/Contents/Resources")); |
84 } | 84 } |
85 } | 85 } |
86 | 86 |
87 void PluginList::LoadPluginsFromDir(const FilePath &path, | 87 void PluginList::GetPluginsInDir( |
88 ScopedVector<PluginGroup>* plugin_groups, | 88 const FilePath& path, std::vector<FilePath>* plugins) { |
89 std::set<FilePath>* visited_plugins) { | |
90 file_util::FileEnumerator enumerator(path, | 89 file_util::FileEnumerator enumerator(path, |
91 false, // not recursive | 90 false, // not recursive |
92 file_util::FileEnumerator::DIRECTORIES); | 91 file_util::FileEnumerator::DIRECTORIES); |
93 for (FilePath path = enumerator.Next(); !path.value().empty(); | 92 for (FilePath path = enumerator.Next(); !path.value().empty(); |
94 path = enumerator.Next()) { | 93 path = enumerator.Next()) { |
95 LoadPlugin(path, plugin_groups); | 94 plugins->push_back(path); |
96 visited_plugins->insert(path); | |
97 } | 95 } |
98 } | 96 } |
99 | 97 |
100 bool PluginList::ShouldLoadPlugin(const WebPluginInfo& info, | 98 bool PluginList::ShouldLoadPlugin(const WebPluginInfo& info, |
101 ScopedVector<PluginGroup>* plugin_groups) { | 99 ScopedVector<PluginGroup>* plugin_groups) { |
102 if (IsBlacklistedPlugin(info)) | 100 if (IsBlacklistedPlugin(info)) |
103 return false; | 101 return false; |
104 | 102 |
105 // Hierarchy check | 103 // Hierarchy check |
106 // (we're loading plugins hierarchically from Library folders, so plugins we | 104 // (we're loading plugins hierarchically from Library folders, so plugins we |
107 // encounter earlier must override plugins we encounter later) | 105 // encounter earlier must override plugins we encounter later) |
108 for (size_t i = 0; i < plugin_groups->size(); ++i) { | 106 for (size_t i = 0; i < plugin_groups->size(); ++i) { |
109 const std::vector<WebPluginInfo>& plugins = | 107 const std::vector<WebPluginInfo>& plugins = |
110 (*plugin_groups)[i]->web_plugin_infos(); | 108 (*plugin_groups)[i]->web_plugin_infos(); |
111 for (size_t j = 0; j < plugins.size(); ++j) { | 109 for (size_t j = 0; j < plugins.size(); ++j) { |
112 if (plugins[j].path.BaseName() == info.path.BaseName()) { | 110 if (plugins[j].path.BaseName() == info.path.BaseName()) { |
113 return false; // Already have a loaded plugin higher in the hierarchy. | 111 return false; // Already have a loaded plugin higher in the hierarchy. |
114 } | 112 } |
115 } | 113 } |
116 } | 114 } |
117 | 115 |
118 return true; | 116 return true; |
119 } | 117 } |
120 | 118 |
121 } // namespace npapi | 119 } // namespace npapi |
122 } // namespace webkit | 120 } // namespace webkit |
OLD | NEW |