| 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 "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 #include "base/sha1.h" | 9 #include "base/sha1.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 114 |
| 115 // Note: "extra" plugin dirs, including the Plugins subdirectory of | 115 // Note: "extra" plugin dirs, including the Plugins subdirectory of |
| 116 // your Chrome config, are examined before these. See the logic | 116 // your Chrome config, are examined before these. See the logic |
| 117 // related to extra_plugin_dirs in plugin_list.cc. | 117 // related to extra_plugin_dirs in plugin_list.cc. |
| 118 | 118 |
| 119 // The Chrome binary dir + "plugins/". | 119 // The Chrome binary dir + "plugins/". |
| 120 FilePath dir; | 120 FilePath dir; |
| 121 PathService::Get(base::DIR_EXE, &dir); | 121 PathService::Get(base::DIR_EXE, &dir); |
| 122 plugin_dirs->push_back(dir.Append("plugins")); | 122 plugin_dirs->push_back(dir.Append("plugins")); |
| 123 | 123 |
| 124 // Chrome OS only loads plugins from /opt/google/chrome/plugins. |
| 125 #if !defined(OS_CHROMEOS) |
| 124 // Mozilla code to reference: | 126 // Mozilla code to reference: |
| 125 // http://mxr.mozilla.org/firefox/ident?i=NS_APP_PLUGINS_DIR_LIST | 127 // http://mxr.mozilla.org/firefox/ident?i=NS_APP_PLUGINS_DIR_LIST |
| 126 // and tens of accompanying files (mxr is very helpful). | 128 // and tens of accompanying files (mxr is very helpful). |
| 127 // This code carefully matches their behavior for compat reasons. | 129 // This code carefully matches their behavior for compat reasons. |
| 128 | 130 |
| 129 // 1) MOZ_PLUGIN_PATH env variable. | 131 // 1) MOZ_PLUGIN_PATH env variable. |
| 130 const char* moz_plugin_path = getenv("MOZ_PLUGIN_PATH"); | 132 const char* moz_plugin_path = getenv("MOZ_PLUGIN_PATH"); |
| 131 if (moz_plugin_path) { | 133 if (moz_plugin_path) { |
| 132 std::vector<std::string> paths; | 134 std::vector<std::string> paths; |
| 133 SplitString(moz_plugin_path, ':', &paths); | 135 SplitString(moz_plugin_path, ':', &paths); |
| 134 for (size_t i = 0; i < paths.size(); ++i) | 136 for (size_t i = 0; i < paths.size(); ++i) |
| 135 plugin_dirs->push_back(FilePath(paths[i])); | 137 plugin_dirs->push_back(FilePath(paths[i])); |
| 136 } | 138 } |
| 137 | 139 |
| 138 #if !defined(OS_CHROMEOS) | |
| 139 // 2) NS_USER_PLUGINS_DIR: ~/.mozilla/plugins. | 140 // 2) NS_USER_PLUGINS_DIR: ~/.mozilla/plugins. |
| 140 // This is a de-facto standard, so even though we're not Mozilla, let's | 141 // This is a de-facto standard, so even though we're not Mozilla, let's |
| 141 // look in there too. | 142 // look in there too. |
| 142 FilePath home = file_util::GetHomeDir(); | 143 FilePath home = file_util::GetHomeDir(); |
| 143 if (!home.empty()) | 144 if (!home.empty()) |
| 144 plugin_dirs->push_back(home.Append(".mozilla/plugins")); | 145 plugin_dirs->push_back(home.Append(".mozilla/plugins")); |
| 145 #endif | |
| 146 | 146 |
| 147 // 3) NS_SYSTEM_PLUGINS_DIR: | 147 // 3) NS_SYSTEM_PLUGINS_DIR: |
| 148 // This varies across different browsers and versions, so check 'em all. | 148 // This varies across different browsers and versions, so check 'em all. |
| 149 plugin_dirs->push_back(FilePath("/usr/lib/browser-plugins")); | 149 plugin_dirs->push_back(FilePath("/usr/lib/browser-plugins")); |
| 150 plugin_dirs->push_back(FilePath("/usr/lib/mozilla/plugins")); | 150 plugin_dirs->push_back(FilePath("/usr/lib/mozilla/plugins")); |
| 151 plugin_dirs->push_back(FilePath("/usr/lib/firefox/plugins")); | 151 plugin_dirs->push_back(FilePath("/usr/lib/firefox/plugins")); |
| 152 plugin_dirs->push_back(FilePath("/usr/lib/xulrunner-addons/plugins")); | 152 plugin_dirs->push_back(FilePath("/usr/lib/xulrunner-addons/plugins")); |
| 153 | 153 |
| 154 #if defined(ARCH_CPU_64_BITS) | 154 #if defined(ARCH_CPU_64_BITS) |
| 155 // On my Ubuntu system, /usr/lib64 is a symlink to /usr/lib. | 155 // On my Ubuntu system, /usr/lib64 is a symlink to /usr/lib. |
| 156 // But a user reported on their Fedora system they are separate. | 156 // But a user reported on their Fedora system they are separate. |
| 157 plugin_dirs->push_back(FilePath("/usr/lib64/browser-plugins")); | 157 plugin_dirs->push_back(FilePath("/usr/lib64/browser-plugins")); |
| 158 plugin_dirs->push_back(FilePath("/usr/lib64/mozilla/plugins")); | 158 plugin_dirs->push_back(FilePath("/usr/lib64/mozilla/plugins")); |
| 159 plugin_dirs->push_back(FilePath("/usr/lib64/firefox/plugins")); | 159 plugin_dirs->push_back(FilePath("/usr/lib64/firefox/plugins")); |
| 160 plugin_dirs->push_back(FilePath("/usr/lib64/xulrunner-addons/plugins")); | 160 plugin_dirs->push_back(FilePath("/usr/lib64/xulrunner-addons/plugins")); |
| 161 #endif | 161 #endif // defined(ARCH_CPU_64_BITS) |
| 162 #endif // !defined(OS_CHROMEOS) |
| 162 } | 163 } |
| 163 | 164 |
| 164 void PluginList::LoadPluginsFromDir(const FilePath& dir_path, | 165 void PluginList::LoadPluginsFromDir(const FilePath& dir_path, |
| 165 std::vector<WebPluginInfo>* plugins, | 166 std::vector<WebPluginInfo>* plugins, |
| 166 std::set<FilePath>* visited_plugins) { | 167 std::set<FilePath>* visited_plugins) { |
| 167 // See ScanPluginsDirectory near | 168 // See ScanPluginsDirectory near |
| 168 // http://mxr.mozilla.org/firefox/source/modules/plugin/base/src/nsPluginHostI
mpl.cpp#5052 | 169 // http://mxr.mozilla.org/firefox/source/modules/plugin/base/src/nsPluginHostI
mpl.cpp#5052 |
| 169 | 170 |
| 170 // Construct and stat a list of all filenames under consideration, for | 171 // Construct and stat a list of all filenames under consideration, for |
| 171 // later sorting by mtime. | 172 // later sorting by mtime. |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 | 261 |
| 261 // TODO(evanm): prefer the newest version of flash, etc. here? | 262 // TODO(evanm): prefer the newest version of flash, etc. here? |
| 262 | 263 |
| 263 LOG_IF(INFO, PluginList::DebugPluginLoading()) | 264 LOG_IF(INFO, PluginList::DebugPluginLoading()) |
| 264 << "Using " << info.path.value(); | 265 << "Using " << info.path.value(); |
| 265 | 266 |
| 266 return true; | 267 return true; |
| 267 } | 268 } |
| 268 | 269 |
| 269 } // namespace NPAPI | 270 } // namespace NPAPI |
| OLD | NEW |