summaryrefslogtreecommitdiffstats
path: root/webkit/plugins/npapi/plugin_lib_win.cc
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-21 06:27:50 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-21 06:27:50 +0000
commit191eb3f7ee90f8ce1d1bee4a37f3acee0c10068c (patch)
treeb982048e66a62646694c16c2cb10cb7ad30d8912 /webkit/plugins/npapi/plugin_lib_win.cc
parentcfef856dd2ccece3cea13ccc96ac9579fd2b30b5 (diff)
downloadchromium_src-191eb3f7ee90f8ce1d1bee4a37f3acee0c10068c.zip
chromium_src-191eb3f7ee90f8ce1d1bee4a37f3acee0c10068c.tar.gz
chromium_src-191eb3f7ee90f8ce1d1bee4a37f3acee0c10068c.tar.bz2
Re-land earlier patch that moves the NPAPI implementation from webkit/glue/plugins to webkit/plugins/npapi
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69808 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/plugins/npapi/plugin_lib_win.cc')
-rw-r--r--webkit/plugins/npapi/plugin_lib_win.cc48
1 files changed, 48 insertions, 0 deletions
diff --git a/webkit/plugins/npapi/plugin_lib_win.cc b/webkit/plugins/npapi/plugin_lib_win.cc
new file mode 100644
index 0000000..6132d45
--- /dev/null
+++ b/webkit/plugins/npapi/plugin_lib_win.cc
@@ -0,0 +1,48 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "webkit/plugins/npapi/plugin_lib.h"
+
+#include "base/file_version_info.h"
+#include "base/file_version_info_win.h"
+#include "base/logging.h"
+#include "base/path_service.h"
+#include "webkit/plugins/npapi/plugin_constants_win.h"
+#include "webkit/plugins/npapi/plugin_list.h"
+
+namespace webkit {
+namespace npapi {
+
+bool PluginLib::ReadWebPluginInfo(const FilePath &filename,
+ WebPluginInfo* info) {
+ // On windows, the way we get the mime types for the library is
+ // to check the version information in the DLL itself. This
+ // will be a string of the format: <type1>|<type2>|<type3>|...
+ // For example:
+ // video/quicktime|audio/aiff|image/jpeg
+ scoped_ptr<FileVersionInfo> version_info(
+ FileVersionInfo::CreateFileVersionInfo(filename.value()));
+ if (!version_info.get()) {
+ LOG_IF(ERROR, PluginList::DebugPluginLoading())
+ << "Could not get version info for plugin "
+ << filename.value();
+ return false;
+ }
+
+ FileVersionInfoWin* version_info_win =
+ static_cast<FileVersionInfoWin*>(version_info.get());
+ PluginVersionInfo pvi;
+ pvi.mime_types = version_info_win->GetStringValue(L"MIMEType");
+ pvi.file_extensions = version_info_win->GetStringValue(L"FileExtents");
+ pvi.type_descriptions = version_info_win->GetStringValue(L"FileOpenName");
+ pvi.product_name = version_info->product_name();
+ pvi.file_description = version_info->file_description();
+ pvi.file_version = version_info->file_version();
+ pvi.path = filename;
+
+ return PluginList::CreateWebPluginInfo(pvi, info);
+}
+
+} // namespace npapi
+} // namespace webkit