| 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 | 8 |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 std::vector<std::string> fields; | 51 std::vector<std::string> fields; |
| 52 SplitString(descriptions[i], ':', &fields); | 52 SplitString(descriptions[i], ':', &fields); |
| 53 if (fields.size() != 3) { | 53 if (fields.size() != 3) { |
| 54 LOG(WARNING) << "Couldn't parse plugin info: " << descriptions[i]; | 54 LOG(WARNING) << "Couldn't parse plugin info: " << descriptions[i]; |
| 55 continue; | 55 continue; |
| 56 } | 56 } |
| 57 | 57 |
| 58 WebPluginMimeType mime_type; | 58 WebPluginMimeType mime_type; |
| 59 mime_type.mime_type = fields[0]; | 59 mime_type.mime_type = fields[0]; |
| 60 SplitString(fields[1], ',', &mime_type.file_extensions); | 60 SplitString(fields[1], ',', &mime_type.file_extensions); |
| 61 mime_type.description = ASCIIToWide(fields[2]); | 61 mime_type.description = UTF8ToWide(fields[2]); |
| 62 info->mime_types.push_back(mime_type); | 62 info->mime_types.push_back(mime_type); |
| 63 } | 63 } |
| 64 } | 64 } |
| 65 | 65 |
| 66 // The plugin name and description live behind NP_GetValue calls. | 66 // The plugin name and description live behind NP_GetValue calls. |
| 67 typedef NPError (*NP_GetValueType)(void* unused, | 67 typedef NPError (*NP_GetValueType)(void* unused, |
| 68 nsPluginVariable variable, | 68 nsPluginVariable variable, |
| 69 void* value_out); | 69 void* value_out); |
| 70 NP_GetValueType NP_GetValue = | 70 NP_GetValueType NP_GetValue = |
| 71 reinterpret_cast<NP_GetValueType>(dlsym(dl, "NP_GetValue")); | 71 reinterpret_cast<NP_GetValueType>(dlsym(dl, "NP_GetValue")); |
| 72 if (NP_GetValue) { | 72 if (NP_GetValue) { |
| 73 const char* name = NULL; | 73 const char* name = NULL; |
| 74 NP_GetValue(NULL, nsPluginVariable_NameString, &name); | 74 NP_GetValue(NULL, nsPluginVariable_NameString, &name); |
| 75 if (name) | 75 if (name) |
| 76 info->name = UTF8ToWide(name); | 76 info->name = UTF8ToWide(name); |
| 77 | 77 |
| 78 const char* description = NULL; | 78 const char* description = NULL; |
| 79 NP_GetValue(NULL, nsPluginVariable_DescriptionString, &description); | 79 NP_GetValue(NULL, nsPluginVariable_DescriptionString, &description); |
| 80 if (description) | 80 if (description) |
| 81 info->desc = UTF8ToWide(description); | 81 info->desc = UTF8ToWide(description); |
| 82 } | 82 } |
| 83 | 83 |
| 84 base::UnloadNativeLibrary(dl); | 84 base::UnloadNativeLibrary(dl); |
| 85 | 85 |
| 86 return true; | 86 return true; |
| 87 } | 87 } |
| 88 | 88 |
| 89 } // namespace NPAPI | 89 } // namespace NPAPI |
| OLD | NEW |