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_lib.h" | 5 #include "webkit/plugins/npapi/plugin_lib.h" |
6 | 6 |
7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
8 #if defined(OS_OPENBSD) | 8 #if defined(OS_OPENBSD) |
9 #include <sys/exec_elf.h> | 9 #include <sys/exec_elf.h> |
10 #else | 10 #else |
11 #include <elf.h> | 11 #include <elf.h> |
12 #include <fcntl.h> | 12 #include <fcntl.h> |
13 #endif | 13 #endif |
14 #include <sys/stat.h> | 14 #include <sys/stat.h> |
15 #include <sys/types.h> | 15 #include <sys/types.h> |
16 #include <unistd.h> | 16 #include <unistd.h> |
17 | 17 |
18 #include "base/eintr_wrapper.h" | 18 #include "base/eintr_wrapper.h" |
19 #include "base/file_util.h" | 19 #include "base/file_util.h" |
20 #include "base/string_split.h" | 20 #include "base/string_split.h" |
21 #include "base/string_util.h" | 21 #include "base/string_util.h" |
22 #include "base/sys_string_conversions.h" | 22 #include "base/sys_string_conversions.h" |
23 #include "base/utf_string_conversions.h" | 23 #include "base/utf_string_conversions.h" |
24 #include "webkit/glue/plugins/plugin_list.h" | 24 #include "webkit/plugins/npapi/plugin_list.h" |
25 | 25 |
26 // These headers must be included in this order to make the declaration gods | 26 // These headers must be included in this order to make the declaration gods |
27 // happy. | 27 // happy. |
28 #include "base/third_party/nspr/prcpucfg_linux.h" | 28 #include "base/third_party/nspr/prcpucfg_linux.h" |
29 | 29 |
| 30 namespace webkit { |
| 31 namespace npapi { |
| 32 |
30 namespace { | 33 namespace { |
31 | 34 |
32 using NPAPI::PluginList; | |
33 | |
34 // Copied from nsplugindefs.h instead of including the file since it has a bunch | 35 // Copied from nsplugindefs.h instead of including the file since it has a bunch |
35 // of dependencies. | 36 // of dependencies. |
36 enum nsPluginVariable { | 37 enum nsPluginVariable { |
37 nsPluginVariable_NameString = 1, | 38 nsPluginVariable_NameString = 1, |
38 nsPluginVariable_DescriptionString = 2 | 39 nsPluginVariable_DescriptionString = 2 |
39 }; | 40 }; |
40 | 41 |
41 // Read the ELF header and return true if it is usable on | 42 // Read the ELF header and return true if it is usable on |
42 // the current architecture (e.g. 32-bit ELF on 32-bit build). | 43 // the current architecture (e.g. 32-bit ELF on 32-bit build). |
43 // Returns false on other errors as well. | 44 // Returns false on other errors as well. |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 128 |
128 // Unload the wrapped plugin, and use the wrapped plugin instead. | 129 // Unload the wrapped plugin, and use the wrapped plugin instead. |
129 LOG_IF(ERROR, PluginList::DebugPluginLoading()) | 130 LOG_IF(ERROR, PluginList::DebugPluginLoading()) |
130 << "Using unwrapped version " << unwrapped_path->value() | 131 << "Using unwrapped version " << unwrapped_path->value() |
131 << " of nspluginwrapper-wrapped plugin."; | 132 << " of nspluginwrapper-wrapped plugin."; |
132 base::UnloadNativeLibrary(*dl); | 133 base::UnloadNativeLibrary(*dl); |
133 *dl = newdl; | 134 *dl = newdl; |
134 *unwrapped_path = path; | 135 *unwrapped_path = path; |
135 } | 136 } |
136 | 137 |
137 } // anonymous namespace | 138 } // namespace |
138 | |
139 namespace NPAPI { | |
140 | 139 |
141 bool PluginLib::ReadWebPluginInfo(const FilePath& filename, | 140 bool PluginLib::ReadWebPluginInfo(const FilePath& filename, |
142 WebPluginInfo* info) { | 141 WebPluginInfo* info) { |
143 // The file to reference is: | 142 // The file to reference is: |
144 // http://mxr.mozilla.org/firefox/source/modules/plugin/base/src/nsPluginsDirU
nix.cpp | 143 // http://mxr.mozilla.org/firefox/source/modules/plugin/base/src/nsPluginsDirU
nix.cpp |
145 | 144 |
146 // Skip files that aren't appropriate for our architecture. | 145 // Skip files that aren't appropriate for our architecture. |
147 if (!ELFMatchesCurrentArchitecture(filename)) { | 146 if (!ELFMatchesCurrentArchitecture(filename)) { |
148 LOG_IF(ERROR, PluginList::DebugPluginLoading()) | 147 LOG_IF(ERROR, PluginList::DebugPluginLoading()) |
149 << "Skipping plugin " << filename.value() | 148 << "Skipping plugin " << filename.value() |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 } else { | 245 } else { |
247 mime_type.description = UTF8ToUTF16(description.substr(ofs)); | 246 mime_type.description = UTF8ToUTF16(description.substr(ofs)); |
248 } | 247 } |
249 mime_types->push_back(mime_type); | 248 mime_types->push_back(mime_type); |
250 if (end == std::string::npos) | 249 if (end == std::string::npos) |
251 break; | 250 break; |
252 ofs = end + 1; | 251 ofs = end + 1; |
253 } | 252 } |
254 } | 253 } |
255 | 254 |
256 } // namespace NPAPI | 255 |
| 256 } // namespace npapi |
| 257 } // namespace webkit |
OLD | NEW |