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/plugins/npapi/plugin_lib.h" | 5 #include "webkit/glue/plugins/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/plugins/npapi/plugin_list.h" | 24 #include "webkit/glue/plugins/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 { | 30 namespace { |
31 namespace npapi { | |
32 | 31 |
33 namespace { | 32 using NPAPI::PluginList; |
34 | 33 |
35 // Copied from nsplugindefs.h instead of including the file since it has a bunch | 34 // Copied from nsplugindefs.h instead of including the file since it has a bunch |
36 // of dependencies. | 35 // of dependencies. |
37 enum nsPluginVariable { | 36 enum nsPluginVariable { |
38 nsPluginVariable_NameString = 1, | 37 nsPluginVariable_NameString = 1, |
39 nsPluginVariable_DescriptionString = 2 | 38 nsPluginVariable_DescriptionString = 2 |
40 }; | 39 }; |
41 | 40 |
42 // Read the ELF header and return true if it is usable on | 41 // Read the ELF header and return true if it is usable on |
43 // the current architecture (e.g. 32-bit ELF on 32-bit build). | 42 // the current architecture (e.g. 32-bit ELF on 32-bit build). |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 | 127 |
129 // Unload the wrapped plugin, and use the wrapped plugin instead. | 128 // Unload the wrapped plugin, and use the wrapped plugin instead. |
130 LOG_IF(ERROR, PluginList::DebugPluginLoading()) | 129 LOG_IF(ERROR, PluginList::DebugPluginLoading()) |
131 << "Using unwrapped version " << unwrapped_path->value() | 130 << "Using unwrapped version " << unwrapped_path->value() |
132 << " of nspluginwrapper-wrapped plugin."; | 131 << " of nspluginwrapper-wrapped plugin."; |
133 base::UnloadNativeLibrary(*dl); | 132 base::UnloadNativeLibrary(*dl); |
134 *dl = newdl; | 133 *dl = newdl; |
135 *unwrapped_path = path; | 134 *unwrapped_path = path; |
136 } | 135 } |
137 | 136 |
138 } // namespace | 137 } // anonymous namespace |
| 138 |
| 139 namespace NPAPI { |
139 | 140 |
140 bool PluginLib::ReadWebPluginInfo(const FilePath& filename, | 141 bool PluginLib::ReadWebPluginInfo(const FilePath& filename, |
141 WebPluginInfo* info) { | 142 WebPluginInfo* info) { |
142 // The file to reference is: | 143 // The file to reference is: |
143 // http://mxr.mozilla.org/firefox/source/modules/plugin/base/src/nsPluginsDirU
nix.cpp | 144 // http://mxr.mozilla.org/firefox/source/modules/plugin/base/src/nsPluginsDirU
nix.cpp |
144 | 145 |
145 // Skip files that aren't appropriate for our architecture. | 146 // Skip files that aren't appropriate for our architecture. |
146 if (!ELFMatchesCurrentArchitecture(filename)) { | 147 if (!ELFMatchesCurrentArchitecture(filename)) { |
147 LOG_IF(ERROR, PluginList::DebugPluginLoading()) | 148 LOG_IF(ERROR, PluginList::DebugPluginLoading()) |
148 << "Skipping plugin " << filename.value() | 149 << "Skipping plugin " << filename.value() |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 } else { | 246 } else { |
246 mime_type.description = UTF8ToUTF16(description.substr(ofs)); | 247 mime_type.description = UTF8ToUTF16(description.substr(ofs)); |
247 } | 248 } |
248 mime_types->push_back(mime_type); | 249 mime_types->push_back(mime_type); |
249 if (end == std::string::npos) | 250 if (end == std::string::npos) |
250 break; | 251 break; |
251 ofs = end + 1; | 252 ofs = end + 1; |
252 } | 253 } |
253 } | 254 } |
254 | 255 |
255 | 256 } // namespace NPAPI |
256 } // namespace npapi | |
257 } // namespace webkit | |
OLD | NEW |