Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(620)

Side by Side Diff: webkit/glue/plugins/plugin_lib_linux.cc

Issue 174078: linux: Plugin descriptions can be UTF-8. (Closed)
Patch Set: Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698