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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 if (moz_plugin_path) { | 455 if (moz_plugin_path) { |
455 std::vector<std::string> paths; | 456 std::vector<std::string> paths; |
456 base::SplitString(moz_plugin_path, ':', &paths); | 457 base::SplitString(moz_plugin_path, ':', &paths); |
457 for (size_t i = 0; i < paths.size(); ++i) | 458 for (size_t i = 0; i < paths.size(); ++i) |
458 plugin_dirs->push_back(base::FilePath(paths[i])); | 459 plugin_dirs->push_back(base::FilePath(paths[i])); |
459 } | 460 } |
460 | 461 |
461 // 2) NS_USER_PLUGINS_DIR: ~/.mozilla/plugins. | 462 // 2) NS_USER_PLUGINS_DIR: ~/.mozilla/plugins. |
462 // This is a de-facto standard, so even though we're not Mozilla, let's | 463 // This is a de-facto standard, so even though we're not Mozilla, let's |
463 // look in there too. | 464 // look in there too. |
464 base::FilePath home = base::GetHomeDir(); | 465 base::FilePath home; |
| 466 PathService::Get(base::DIR_HOME, &home); |
465 if (!home.empty()) | 467 if (!home.empty()) |
466 plugin_dirs->push_back(home.Append(".mozilla/plugins")); | 468 plugin_dirs->push_back(home.Append(".mozilla/plugins")); |
467 | 469 |
468 // 3) NS_SYSTEM_PLUGINS_DIR: | 470 // 3) NS_SYSTEM_PLUGINS_DIR: |
469 // This varies across different browsers and versions, so check 'em all. | 471 // This varies across different browsers and versions, so check 'em all. |
470 plugin_dirs->push_back(base::FilePath("/usr/lib/browser-plugins")); | 472 plugin_dirs->push_back(base::FilePath("/usr/lib/browser-plugins")); |
471 plugin_dirs->push_back(base::FilePath("/usr/lib/mozilla/plugins")); | 473 plugin_dirs->push_back(base::FilePath("/usr/lib/mozilla/plugins")); |
472 plugin_dirs->push_back(base::FilePath("/usr/lib/firefox/plugins")); | 474 plugin_dirs->push_back(base::FilePath("/usr/lib/firefox/plugins")); |
473 plugin_dirs->push_back(base::FilePath("/usr/lib/xulrunner-addons/plugins")); | 475 plugin_dirs->push_back(base::FilePath("/usr/lib/xulrunner-addons/plugins")); |
474 | 476 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 } | 583 } |
582 | 584 |
583 // TODO(evanm): prefer the newest version of flash, etc. here? | 585 // TODO(evanm): prefer the newest version of flash, etc. here? |
584 | 586 |
585 VLOG_IF(1, PluginList::DebugPluginLoading()) << "Using " << info.path.value(); | 587 VLOG_IF(1, PluginList::DebugPluginLoading()) << "Using " << info.path.value(); |
586 | 588 |
587 return true; | 589 return true; |
588 } | 590 } |
589 | 591 |
590 } // namespace content | 592 } // namespace content |
OLD | NEW |