| 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 "content/common/plugin_list.h" | 5 #include "content/common/plugin_list.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <dlfcn.h> | 8 #include <dlfcn.h> |
| 9 #if defined(OS_OPENBSD) | 9 #if defined(OS_OPENBSD) |
| 10 #include <sys/exec_elf.h> | 10 #include <sys/exec_elf.h> |
| 11 #else | 11 #else |
| 12 #include <elf.h> | 12 #include <elf.h> |
| 13 #endif | 13 #endif |
| 14 #include <fcntl.h> | 14 #include <fcntl.h> |
| 15 #include <sys/stat.h> | 15 #include <sys/stat.h> |
| 16 #include <sys/types.h> | 16 #include <sys/types.h> |
| 17 #include <unistd.h> | 17 #include <unistd.h> |
| 18 | 18 |
| 19 #include "base/base_paths.h" |
| 19 #include "base/cpu.h" | 20 #include "base/cpu.h" |
| 20 #include "base/file_util.h" | 21 #include "base/file_util.h" |
| 21 #include "base/files/file_enumerator.h" | 22 #include "base/files/file_enumerator.h" |
| 22 #include "base/native_library.h" | 23 #include "base/native_library.h" |
| 23 #include "base/path_service.h" | 24 #include "base/path_service.h" |
| 24 #include "base/posix/eintr_wrapper.h" | 25 #include "base/posix/eintr_wrapper.h" |
| 25 #include "base/sha1.h" | 26 #include "base/sha1.h" |
| 26 #include "base/strings/string_split.h" | 27 #include "base/strings/string_split.h" |
| 27 #include "base/strings/string_util.h" | 28 #include "base/strings/string_util.h" |
| 28 #include "base/strings/stringprintf.h" | 29 #include "base/strings/stringprintf.h" |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 if (moz_plugin_path) { | 459 if (moz_plugin_path) { |
| 459 std::vector<std::string> paths; | 460 std::vector<std::string> paths; |
| 460 base::SplitString(moz_plugin_path, ':', &paths); | 461 base::SplitString(moz_plugin_path, ':', &paths); |
| 461 for (size_t i = 0; i < paths.size(); ++i) | 462 for (size_t i = 0; i < paths.size(); ++i) |
| 462 plugin_dirs->push_back(base::FilePath(paths[i])); | 463 plugin_dirs->push_back(base::FilePath(paths[i])); |
| 463 } | 464 } |
| 464 | 465 |
| 465 // 2) NS_USER_PLUGINS_DIR: ~/.mozilla/plugins. | 466 // 2) NS_USER_PLUGINS_DIR: ~/.mozilla/plugins. |
| 466 // This is a de-facto standard, so even though we're not Mozilla, let's | 467 // This is a de-facto standard, so even though we're not Mozilla, let's |
| 467 // look in there too. | 468 // look in there too. |
| 468 base::FilePath home = base::GetHomeDir(); | 469 base::FilePath home; |
| 470 PathService::Get(base::DIR_HOME, &home); |
| 469 if (!home.empty()) | 471 if (!home.empty()) |
| 470 plugin_dirs->push_back(home.Append(".mozilla/plugins")); | 472 plugin_dirs->push_back(home.Append(".mozilla/plugins")); |
| 471 | 473 |
| 472 // 3) NS_SYSTEM_PLUGINS_DIR: | 474 // 3) NS_SYSTEM_PLUGINS_DIR: |
| 473 // This varies across different browsers and versions, so check 'em all. | 475 // This varies across different browsers and versions, so check 'em all. |
| 474 plugin_dirs->push_back(base::FilePath("/usr/lib/browser-plugins")); | 476 plugin_dirs->push_back(base::FilePath("/usr/lib/browser-plugins")); |
| 475 plugin_dirs->push_back(base::FilePath("/usr/lib/mozilla/plugins")); | 477 plugin_dirs->push_back(base::FilePath("/usr/lib/mozilla/plugins")); |
| 476 plugin_dirs->push_back(base::FilePath("/usr/lib/firefox/plugins")); | 478 plugin_dirs->push_back(base::FilePath("/usr/lib/firefox/plugins")); |
| 477 plugin_dirs->push_back(base::FilePath("/usr/lib/xulrunner-addons/plugins")); | 479 plugin_dirs->push_back(base::FilePath("/usr/lib/xulrunner-addons/plugins")); |
| 478 | 480 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 } | 587 } |
| 586 | 588 |
| 587 // TODO(evanm): prefer the newest version of flash, etc. here? | 589 // TODO(evanm): prefer the newest version of flash, etc. here? |
| 588 | 590 |
| 589 VLOG_IF(1, PluginList::DebugPluginLoading()) << "Using " << info.path.value(); | 591 VLOG_IF(1, PluginList::DebugPluginLoading()) << "Using " << info.path.value(); |
| 590 | 592 |
| 591 return true; | 593 return true; |
| 592 } | 594 } |
| 593 | 595 |
| 594 } // namespace content | 596 } // namespace content |
| OLD | NEW |