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