OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #import <Carbon/Carbon.h> | 5 #import <Carbon/Carbon.h> |
6 | 6 |
7 #include "webkit/plugins/npapi/plugin_lib.h" | 7 #include "webkit/plugins/npapi/plugin_lib.h" |
8 | 8 |
9 #include "base/mac/scoped_cftyperef.h" | 9 #include "base/mac/scoped_cftyperef.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 info->name = base::SysNSStringToUTF16(plugin_name); | 122 info->name = base::SysNSStringToUTF16(plugin_name); |
123 else | 123 else |
124 info->name = UTF8ToUTF16(filename.BaseName().value()); | 124 info->name = UTF8ToUTF16(filename.BaseName().value()); |
125 info->path = filename; | 125 info->path = filename; |
126 if (plugin_vers) | 126 if (plugin_vers) |
127 info->version = base::SysNSStringToUTF16(plugin_vers); | 127 info->version = base::SysNSStringToUTF16(plugin_vers); |
128 if (plugin_desc) | 128 if (plugin_desc) |
129 info->desc = base::SysNSStringToUTF16(plugin_desc); | 129 info->desc = base::SysNSStringToUTF16(plugin_desc); |
130 else | 130 else |
131 info->desc = UTF8ToUTF16(filename.BaseName().value()); | 131 info->desc = UTF8ToUTF16(filename.BaseName().value()); |
132 info->enabled = WebPluginInfo::USER_ENABLED; | |
133 | 132 |
134 return true; | 133 return true; |
135 } | 134 } |
136 | 135 |
137 class ScopedBundleResourceFile { | 136 class ScopedBundleResourceFile { |
138 public: | 137 public: |
139 ScopedBundleResourceFile(CFBundleRef bundle) : bundle_(bundle) { | 138 ScopedBundleResourceFile(CFBundleRef bundle) : bundle_(bundle) { |
140 old_ref_num_ = CurResFile(); | 139 old_ref_num_ = CurResFile(); |
141 bundle_ref_num_ = CFBundleOpenBundleResourceMap(bundle); | 140 bundle_ref_num_ = CFBundleOpenBundleResourceMap(bundle); |
142 UseResFile(bundle_ref_num_); | 141 UseResFile(bundle_ref_num_); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 info->name = UTF8ToUTF16(plugin_descs[1]); | 215 info->name = UTF8ToUTF16(plugin_descs[1]); |
217 else | 216 else |
218 info->name = UTF8ToUTF16(filename.BaseName().value()); | 217 info->name = UTF8ToUTF16(filename.BaseName().value()); |
219 info->path = filename; | 218 info->path = filename; |
220 if (plugin_vers) | 219 if (plugin_vers) |
221 info->version = base::SysNSStringToUTF16(plugin_vers); | 220 info->version = base::SysNSStringToUTF16(plugin_vers); |
222 if (have_plugin_descs && !plugin_descs.empty()) | 221 if (have_plugin_descs && !plugin_descs.empty()) |
223 info->desc = UTF8ToUTF16(plugin_descs[0]); | 222 info->desc = UTF8ToUTF16(plugin_descs[0]); |
224 else | 223 else |
225 info->desc = UTF8ToUTF16(filename.BaseName().value()); | 224 info->desc = UTF8ToUTF16(filename.BaseName().value()); |
226 info->enabled = WebPluginInfo::USER_ENABLED; | |
227 | 225 |
228 return true; | 226 return true; |
229 } | 227 } |
230 | 228 |
231 } // anonymous namespace | 229 } // anonymous namespace |
232 | 230 |
233 bool PluginLib::ReadWebPluginInfo(const FilePath &filename, | 231 bool PluginLib::ReadWebPluginInfo(const FilePath &filename, |
234 WebPluginInfo* info) { | 232 WebPluginInfo* info) { |
235 // There are two ways to get information about plugin capabilities. One is an | 233 // There are two ways to get information about plugin capabilities. One is an |
236 // Info.plist set of keys, documented at | 234 // Info.plist set of keys, documented at |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 if (ReadSTRPluginInfo(filename, bundle.get(), info)) | 339 if (ReadSTRPluginInfo(filename, bundle.get(), info)) |
342 return true; | 340 return true; |
343 | 341 |
344 // ... or not | 342 // ... or not |
345 | 343 |
346 return false; | 344 return false; |
347 } | 345 } |
348 | 346 |
349 } // namespace npapi | 347 } // namespace npapi |
350 } // namespace webkit | 348 } // namespace webkit |
OLD | NEW |