summaryrefslogtreecommitdiffstats
path: root/webkit/plugins/npapi
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-08 00:42:07 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-08 00:42:07 +0000
commitf85d311ae75113511236692fab4132082b939a59 (patch)
treeb2292e1b41b9c95f74374871ecc12fda637cf0a8 /webkit/plugins/npapi
parent54430e2fa0e3ca05a4dfed41aaf6f1e2bd4ee307 (diff)
downloadchromium_src-f85d311ae75113511236692fab4132082b939a59.zip
chromium_src-f85d311ae75113511236692fab4132082b939a59.tar.gz
chromium_src-f85d311ae75113511236692fab4132082b939a59.tar.bz2
Pepper: Store file extensions and description on a per-mime-type basis.
Also eliminate stupid and unnecessary conversion of data to a big string, only to be parsed back. BUG=none TEST=everything still works Review URL: http://codereview.chromium.org/6635009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77215 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/plugins/npapi')
-rw-r--r--webkit/plugins/npapi/plugin_list.h9
-rw-r--r--webkit/plugins/npapi/webplugininfo.cc12
-rw-r--r--webkit/plugins/npapi/webplugininfo.h6
3 files changed, 21 insertions, 6 deletions
diff --git a/webkit/plugins/npapi/plugin_list.h b/webkit/plugins/npapi/plugin_list.h
index 62c74c5..626e14a 100644
--- a/webkit/plugins/npapi/plugin_list.h
+++ b/webkit/plugins/npapi/plugin_list.h
@@ -111,11 +111,10 @@ class PluginList {
WebPluginInfo* info,
const PluginEntryPoints** entry_points);
- // In Windows and Pepper plugins, the mime types are passed as a specially
- // formatted list of strings. This function parses those strings into
- // a WebPluginMimeType vector.
- // TODO(evan): make Pepper pass around formatted data and move this code
- // into plugin_list_win.
+ // In Windows plugins, the mime types are passed as a specially formatted list
+ // of strings. This function parses those strings into a WebPluginMimeType
+ // vector.
+ // TODO(evan): move this code into plugin_list_win.
static bool ParseMimeTypes(const std::string& mime_types,
const std::string& file_extensions,
const string16& mime_type_descriptions,
diff --git a/webkit/plugins/npapi/webplugininfo.cc b/webkit/plugins/npapi/webplugininfo.cc
index 772a7d0..94fb8548 100644
--- a/webkit/plugins/npapi/webplugininfo.cc
+++ b/webkit/plugins/npapi/webplugininfo.cc
@@ -1,16 +1,26 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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/webplugininfo.h"
#include "base/logging.h"
+#include "base/utf_string_conversions.h"
namespace webkit {
namespace npapi {
WebPluginMimeType::WebPluginMimeType() {}
+WebPluginMimeType::WebPluginMimeType(const std::string& m,
+ const std::string& f,
+ const std::string& d)
+ : mime_type(m),
+ file_extensions(),
+ description(ASCIIToUTF16(d)) {
+ file_extensions.push_back(f);
+}
+
WebPluginMimeType::~WebPluginMimeType() {}
WebPluginInfo::WebPluginInfo()
diff --git a/webkit/plugins/npapi/webplugininfo.h b/webkit/plugins/npapi/webplugininfo.h
index c4e58ed..461415f 100644
--- a/webkit/plugins/npapi/webplugininfo.h
+++ b/webkit/plugins/npapi/webplugininfo.h
@@ -15,8 +15,14 @@ namespace webkit {
namespace npapi {
// Describes a mime type entry for a plugin.
+// TODO(viettrungluu): This isn't NPAPI-specific. Move this somewhere else.
struct WebPluginMimeType {
WebPluginMimeType();
+ // A constructor for the common case of a single file extension and an ASCII
+ // description.
+ WebPluginMimeType(const std::string& m,
+ const std::string& f,
+ const std::string& d);
~WebPluginMimeType();
// The name of the mime type (e.g., "application/x-shockwave-flash").