OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/file_version_info.h" | 7 #include "base/file_version_info.h" |
| 8 #include "base/file_version_info_win.h" |
8 #include "base/path_service.h" | 9 #include "base/path_service.h" |
9 #include "webkit/glue/plugins/plugin_constants_win.h" | 10 #include "webkit/glue/plugins/plugin_constants_win.h" |
10 #include "webkit/glue/plugins/plugin_list.h" | 11 #include "webkit/glue/plugins/plugin_list.h" |
11 | 12 |
12 namespace NPAPI | 13 namespace NPAPI |
13 { | 14 { |
14 bool PluginLib::ReadWebPluginInfo(const FilePath &filename, | 15 bool PluginLib::ReadWebPluginInfo(const FilePath &filename, |
15 WebPluginInfo* info) { | 16 WebPluginInfo* info) { |
16 // On windows, the way we get the mime types for the library is | 17 // On windows, the way we get the mime types for the library is |
17 // to check the version information in the DLL itself. This | 18 // to check the version information in the DLL itself. This |
18 // will be a string of the format: <type1>|<type2>|<type3>|... | 19 // will be a string of the format: <type1>|<type2>|<type3>|... |
19 // For example: | 20 // For example: |
20 // video/quicktime|audio/aiff|image/jpeg | 21 // video/quicktime|audio/aiff|image/jpeg |
21 scoped_ptr<FileVersionInfo> version_info( | 22 scoped_ptr<FileVersionInfo> version_info( |
22 FileVersionInfo::CreateFileVersionInfo(filename.value())); | 23 FileVersionInfo::CreateFileVersionInfo(filename.value())); |
23 if (!version_info.get()) | 24 if (!version_info.get()) |
24 return false; | 25 return false; |
25 | 26 |
| 27 FileVersionInfoWin* version_info_win = |
| 28 static_cast<FileVersionInfoWin*>(version_info.get()); |
26 PluginVersionInfo pvi; | 29 PluginVersionInfo pvi; |
27 pvi.mime_types = version_info->GetStringValue(L"MIMEType"); | 30 pvi.mime_types = version_info_win->GetStringValue(L"MIMEType"); |
28 pvi.file_extensions = version_info->GetStringValue(L"FileExtents"); | 31 pvi.file_extensions = version_info_win->GetStringValue(L"FileExtents"); |
29 pvi.type_descriptions = version_info->GetStringValue(L"FileOpenName"); | 32 pvi.type_descriptions = version_info_win->GetStringValue(L"FileOpenName"); |
30 pvi.product_name = version_info->product_name(); | 33 pvi.product_name = version_info->product_name(); |
31 pvi.file_description = version_info->file_description(); | 34 pvi.file_description = version_info->file_description(); |
32 pvi.file_version = version_info->file_version(); | 35 pvi.file_version = version_info->file_version(); |
33 pvi.path = filename; | 36 pvi.path = filename; |
34 | 37 |
35 return PluginList::CreateWebPluginInfo(pvi, info); | 38 return PluginList::CreateWebPluginInfo(pvi, info); |
36 } | 39 } |
37 | 40 |
38 } // namespace NPAPI | 41 } // namespace NPAPI |
OLD | NEW |