| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 | 9 |
| 10 namespace NPAPI { | 10 namespace NPAPI { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 PathService::Get(base::DIR_EXE, &dir); | 37 PathService::Get(base::DIR_EXE, &dir); |
| 38 plugin_dirs->push_back(dir.Append("plugins")); | 38 plugin_dirs->push_back(dir.Append("plugins")); |
| 39 | 39 |
| 40 // 4) NS_SYSTEM_PLUGINS_DIR: | 40 // 4) NS_SYSTEM_PLUGINS_DIR: |
| 41 // TODO(evanm): when we support 64-bit platforms, we'll need to fix this | 41 // TODO(evanm): when we support 64-bit platforms, we'll need to fix this |
| 42 // to be conditional. | 42 // to be conditional. |
| 43 COMPILE_ASSERT(sizeof(int)==4, fix_system_lib_path); | 43 COMPILE_ASSERT(sizeof(int)==4, fix_system_lib_path); |
| 44 plugin_dirs->push_back(FilePath("/usr/lib/mozilla/plugins")); | 44 plugin_dirs->push_back(FilePath("/usr/lib/mozilla/plugins")); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void PluginList::LoadPluginsFromDir(const FilePath& path) { | 47 void PluginList::LoadPluginsFromDir(const FilePath& path, |
| 48 std::vector<WebPluginInfo>* plugins) { |
| 48 file_util::FileEnumerator enumerator(path, | 49 file_util::FileEnumerator enumerator(path, |
| 49 false, // not recursive | 50 false, // not recursive |
| 50 file_util::FileEnumerator::FILES); | 51 file_util::FileEnumerator::FILES); |
| 51 for (FilePath path = enumerator.Next(); !path.value().empty(); | 52 for (FilePath path = enumerator.Next(); !path.value().empty(); |
| 52 path = enumerator.Next()) { | 53 path = enumerator.Next()) { |
| 53 // Skip over Mozilla .xpt files. | 54 // Skip over Mozilla .xpt files. |
| 54 if (!path.MatchesExtension(FILE_PATH_LITERAL(".xpt"))) | 55 if (!path.MatchesExtension(FILE_PATH_LITERAL(".xpt"))) |
| 55 LoadPlugin(path); | 56 LoadPlugin(path, plugins); |
| 56 } | 57 } |
| 57 } | 58 } |
| 58 | 59 |
| 59 bool PluginList::ShouldLoadPlugin(const WebPluginInfo& info) { | 60 bool PluginList::ShouldLoadPlugin(const WebPluginInfo& info, |
| 61 std::vector<WebPluginInfo>* plugins) { |
| 60 // The equivalent Windows code verifies we haven't loaded a newer version | 62 // The equivalent Windows code verifies we haven't loaded a newer version |
| 61 // of the same plugin, and then blacklists some known bad plugins. | 63 // of the same plugin, and then blacklists some known bad plugins. |
| 62 // The equivalent Mac code verifies that plugins encountered first in the | 64 // The equivalent Mac code verifies that plugins encountered first in the |
| 63 // plugin list clobber later entries. | 65 // plugin list clobber later entries. |
| 64 // TODO(evanm): figure out which behavior is appropriate for Linux. | 66 // TODO(evanm): figure out which behavior is appropriate for Linux. |
| 65 // We don't need either yet as I'm just testing with Flash for now. | 67 // We don't need either yet as I'm just testing with Flash for now. |
| 66 return true; | 68 return true; |
| 67 } | 69 } |
| 68 | 70 |
| 69 void PluginList::LoadInternalPlugins() { | 71 void PluginList::LoadInternalPlugins(std::vector<WebPluginInfo>* plugins) { |
| 70 // none for now | 72 // none for now |
| 71 } | 73 } |
| 72 | 74 |
| 73 } // namespace NPAPI | 75 } // namespace NPAPI |
| OLD | NEW |