| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/glue/plugins/plugin_lib.h" |
| 6 | 6 |
| 7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
| 8 #include <elf.h> | 8 #include <elf.h> |
| 9 | 9 |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 if (elf_class == ELFCLASS32) | 52 if (elf_class == ELFCLASS32) |
| 53 return true; | 53 return true; |
| 54 #elif defined(ARCH_CPU_64_BITS) | 54 #elif defined(ARCH_CPU_64_BITS) |
| 55 if (elf_class == ELFCLASS64) | 55 if (elf_class == ELFCLASS64) |
| 56 return true; | 56 return true; |
| 57 #endif | 57 #endif |
| 58 | 58 |
| 59 return false; | 59 return false; |
| 60 } | 60 } |
| 61 | 61 |
| 62 // TODO(thestig) This is a hack to work around the crash in bug 25245. Remove |
| 63 // this once we read plugins out of process. |
| 64 bool SkipPluginUnloadHack(const WebPluginInfo& info) { |
| 65 std::string filename = info.path.BaseName().value(); |
| 66 return (filename.find("npo3dautoplugin") != std::string::npos); // O3D |
| 67 } |
| 62 | 68 |
| 63 } // anonymous namespace | 69 } // anonymous namespace |
| 64 namespace NPAPI { | 70 namespace NPAPI { |
| 65 | 71 |
| 66 bool PluginLib::ReadWebPluginInfo(const FilePath& filename, | 72 bool PluginLib::ReadWebPluginInfo(const FilePath& filename, |
| 67 WebPluginInfo* info) { | 73 WebPluginInfo* info) { |
| 68 // The file to reference is: | 74 // The file to reference is: |
| 69 // http://mxr.mozilla.org/firefox/source/modules/plugin/base/src/nsPluginsDirU
nix.cpp | 75 // http://mxr.mozilla.org/firefox/source/modules/plugin/base/src/nsPluginsDirU
nix.cpp |
| 70 | 76 |
| 71 // Skip files that aren't appropriate for our architecture. | 77 // Skip files that aren't appropriate for our architecture. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 101 NP_GetValue(NULL, nsPluginVariable_NameString, &name); | 107 NP_GetValue(NULL, nsPluginVariable_NameString, &name); |
| 102 if (name) | 108 if (name) |
| 103 info->name = UTF8ToWide(name); | 109 info->name = UTF8ToWide(name); |
| 104 | 110 |
| 105 const char* description = NULL; | 111 const char* description = NULL; |
| 106 NP_GetValue(NULL, nsPluginVariable_DescriptionString, &description); | 112 NP_GetValue(NULL, nsPluginVariable_DescriptionString, &description); |
| 107 if (description) | 113 if (description) |
| 108 info->desc = UTF8ToWide(description); | 114 info->desc = UTF8ToWide(description); |
| 109 } | 115 } |
| 110 | 116 |
| 111 base::UnloadNativeLibrary(dl); | 117 if (!SkipPluginUnloadHack(*info)) |
| 118 base::UnloadNativeLibrary(dl); |
| 112 | 119 |
| 113 return true; | 120 return true; |
| 114 } | 121 } |
| 115 | 122 |
| 116 // static | 123 // static |
| 117 void PluginLib::ParseMIMEDescription( | 124 void PluginLib::ParseMIMEDescription( |
| 118 const std::string& description, | 125 const std::string& description, |
| 119 std::vector<WebPluginMimeType>* mime_types) { | 126 std::vector<WebPluginMimeType>* mime_types) { |
| 120 // We parse the description here into WebPluginMimeType structures. | 127 // We parse the description here into WebPluginMimeType structures. |
| 121 // Naively from the NPAPI docs you'd think you could use | 128 // Naively from the NPAPI docs you'd think you could use |
| (...skipping 29 matching lines...) Expand all Loading... |
| 151 mime_type.description = UTF8ToWide(description.substr(ofs)); | 158 mime_type.description = UTF8ToWide(description.substr(ofs)); |
| 152 } | 159 } |
| 153 mime_types->push_back(mime_type); | 160 mime_types->push_back(mime_type); |
| 154 if (end == std::string::npos) | 161 if (end == std::string::npos) |
| 155 break; | 162 break; |
| 156 ofs = end + 1; | 163 ofs = end + 1; |
| 157 } | 164 } |
| 158 } | 165 } |
| 159 | 166 |
| 160 } // namespace NPAPI | 167 } // namespace NPAPI |
| OLD | NEW |