From f85d311ae75113511236692fab4132082b939a59 Mon Sep 17 00:00:00 2001 From: "viettrungluu@chromium.org" Date: Tue, 8 Mar 2011 00:42:07 +0000 Subject: 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 --- webkit/plugins/npapi/plugin_list.h | 9 ++++----- webkit/plugins/npapi/webplugininfo.cc | 12 +++++++++++- webkit/plugins/npapi/webplugininfo.h | 6 ++++++ 3 files changed, 21 insertions(+), 6 deletions(-) (limited to 'webkit') 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"). -- cgit v1.1