summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authorstuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-23 21:44:57 +0000
committerstuartmorgan@chromium.org <stuartmorgan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-23 21:44:57 +0000
commitc9d8113703584a262972858475a560c78733a7dd (patch)
tree89fdd28a63032b7c1277c2fcd39f111a2522db91 /webkit
parent40e93e58ffd857435bfd509772a621efea1e8746 (diff)
downloadchromium_src-c9d8113703584a262972858475a560c78733a7dd.zip
chromium_src-c9d8113703584a262972858475a560c78733a7dd.tar.gz
chromium_src-c9d8113703584a262972858475a560c78733a7dd.tar.bz2
Convert WebPluginInfo from wstring to string16
BUG=None TEST=No behavioral change; plugins should continue to work. Review URL: http://codereview.chromium.org/2866014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50650 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/plugins/plugin_host.cc4
-rw-r--r--webkit/glue/plugins/plugin_lib_mac.mm24
-rw-r--r--webkit/glue/plugins/plugin_lib_posix.cc8
-rw-r--r--webkit/glue/plugins/plugin_lib_unittest.cc9
-rw-r--r--webkit/glue/plugins/plugin_list.cc14
-rw-r--r--webkit/glue/plugins/webplugin_delegate_impl_mac.mm4
-rw-r--r--webkit/glue/plugins/webplugininfo.h8
-rw-r--r--webkit/glue/webkitclient_impl.cc6
8 files changed, 38 insertions, 39 deletions
diff --git a/webkit/glue/plugins/plugin_host.cc b/webkit/glue/plugins/plugin_host.cc
index f104199..87503a9 100644
--- a/webkit/glue/plugins/plugin_host.cc
+++ b/webkit/glue/plugins/plugin_host.cc
@@ -577,8 +577,8 @@ const char* NPN_UserAgent(NPP id) {
plugin = FindInstance(id);
if (plugin.get()) {
WebPluginInfo plugin_info = plugin->plugin_lib()->plugin_info();
- if (plugin_info.name == L"Silverlight Plug-In" &&
- StartsWith(plugin_info.version, L"4.", false)) {
+ if (plugin_info.name == ASCIIToUTF16("Silverlight Plug-In") &&
+ StartsWith(plugin_info.version, ASCIIToUTF16("4."), false)) {
return "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-us) "
"AppleWebKit/534.1+ (KHTML, like Gecko) Version/5.0 Safari/533.16";
}
diff --git a/webkit/glue/plugins/plugin_lib_mac.mm b/webkit/glue/plugins/plugin_lib_mac.mm
index da9910d..263b3b4 100644
--- a/webkit/glue/plugins/plugin_lib_mac.mm
+++ b/webkit/glue/plugins/plugin_lib_mac.mm
@@ -97,7 +97,7 @@ bool ReadPlistPluginInfo(const FilePath& filename, CFBundleRef bundle,
}
if (mime_desc)
- mime.description = base::SysNSStringToWide(mime_desc);
+ mime.description = base::SysNSStringToUTF16(mime_desc);
for (NSString* ext in mime_exts)
mime.file_extensions.push_back(
base::SysNSStringToUTF8([ext lowercaseString]));
@@ -116,16 +116,16 @@ bool ReadPlistPluginInfo(const FilePath& filename, CFBundleRef bundle,
CFSTR("WebPluginDescription"));
if (plugin_name)
- info->name = base::SysNSStringToWide(plugin_name);
+ info->name = base::SysNSStringToUTF16(plugin_name);
else
- info->name = UTF8ToWide(filename.BaseName().value());
+ info->name = UTF8ToUTF16(filename.BaseName().value());
info->path = filename;
if (plugin_vers)
- info->version = base::SysNSStringToWide(plugin_vers);
+ info->version = base::SysNSStringToUTF16(plugin_vers);
if (plugin_desc)
- info->desc = base::SysNSStringToWide(plugin_desc);
+ info->desc = base::SysNSStringToUTF16(plugin_desc);
else
- info->desc = UTF8ToWide(filename.BaseName().value());
+ info->desc = UTF8ToUTF16(filename.BaseName().value());
info->enabled = true;
return true;
@@ -198,7 +198,7 @@ bool ReadSTRPluginInfo(const FilePath& filename, CFBundleRef bundle,
WebPluginMimeType mime;
mime.mime_type = StringToLowerASCII(type_strings[2*i]);
if (have_type_descs && i < type_descs.size())
- mime.description = UTF8ToWide(type_descs[i]);
+ mime.description = UTF8ToUTF16(type_descs[i]);
SplitString(StringToLowerASCII(type_strings[2*i+1]), ',',
&mime.file_extensions);
@@ -210,16 +210,16 @@ bool ReadSTRPluginInfo(const FilePath& filename, CFBundleRef bundle,
CFSTR("CFBundleShortVersionString"));
if (have_plugin_descs && plugin_descs.size() > 1)
- info->name = UTF8ToWide(plugin_descs[1]);
+ info->name = UTF8ToUTF16(plugin_descs[1]);
else
- info->name = UTF8ToWide(filename.BaseName().value());
+ info->name = UTF8ToUTF16(filename.BaseName().value());
info->path = filename;
if (plugin_vers)
- info->version = base::SysNSStringToWide(plugin_vers);
+ info->version = base::SysNSStringToUTF16(plugin_vers);
if (have_plugin_descs && plugin_descs.size() > 0)
- info->desc = UTF8ToWide(plugin_descs[0]);
+ info->desc = UTF8ToUTF16(plugin_descs[0]);
else
- info->desc = UTF8ToWide(filename.BaseName().value());
+ info->desc = UTF8ToUTF16(filename.BaseName().value());
info->enabled = true;
return true;
diff --git a/webkit/glue/plugins/plugin_lib_posix.cc b/webkit/glue/plugins/plugin_lib_posix.cc
index 00e85e4..0bf7786 100644
--- a/webkit/glue/plugins/plugin_lib_posix.cc
+++ b/webkit/glue/plugins/plugin_lib_posix.cc
@@ -170,12 +170,12 @@ bool PluginLib::ReadWebPluginInfo(const FilePath& filename,
const char* name = NULL;
NP_GetValue(NULL, nsPluginVariable_NameString, &name);
if (name)
- info->name = UTF8ToWide(name);
+ info->name = UTF8ToUTF16(name);
const char* description = NULL;
NP_GetValue(NULL, nsPluginVariable_DescriptionString, &description);
if (description)
- info->desc = UTF8ToWide(description);
+ info->desc = UTF8ToUTF16(description);
}
// Intentionally not unloading the plugin here, it can lead to crashes.
@@ -216,9 +216,9 @@ void PluginLib::ParseMIMEDescription(
// It's ok for end to run off the string here. If there's no
// trailing semicolon we consume the remainder of the string.
if (end != std::string::npos) {
- mime_type.description = UTF8ToWide(description.substr(ofs, end - ofs));
+ mime_type.description = UTF8ToUTF16(description.substr(ofs, end - ofs));
} else {
- mime_type.description = UTF8ToWide(description.substr(ofs));
+ mime_type.description = UTF8ToUTF16(description.substr(ofs));
}
mime_types->push_back(mime_type);
if (end == std::string::npos)
diff --git a/webkit/glue/plugins/plugin_lib_unittest.cc b/webkit/glue/plugins/plugin_lib_unittest.cc
index 7204629..a52510b 100644
--- a/webkit/glue/plugins/plugin_lib_unittest.cc
+++ b/webkit/glue/plugins/plugin_lib_unittest.cc
@@ -4,6 +4,7 @@
#include "webkit/glue/plugins/plugin_lib.h"
+#include "base/string_util.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -68,7 +69,7 @@ TEST(MIMEDescriptionParse, Simple) {
EXPECT_EQ("audio/x-pn-realaudio-plugin", type.mime_type);
ASSERT_EQ(1U, type.file_extensions.size());
EXPECT_EQ("rpm", type.file_extensions[0]);
- EXPECT_EQ(L"RealAudio document", type.description);
+ EXPECT_EQ(ASCIIToUTF16("RealAudio document"), type.description);
}
// Test parsing a multi-entry description: QuickTime as provided by Totem.
@@ -89,7 +90,7 @@ TEST(MIMEDescriptionParse, Multi) {
EXPECT_EQ("image/x-quicktime", type.mime_type);
ASSERT_EQ(3U, type.file_extensions.size());
EXPECT_EQ("pict2", type.file_extensions[2]);
- EXPECT_EQ(L"QuickTime image", type.description);
+ EXPECT_EQ(ASCIIToUTF16("QuickTime image"), type.description);
}
// Test parsing a Japanese description, since we got this wrong in the past.
@@ -118,7 +119,7 @@ TEST(MIMEDescriptionParse, CornerCases) {
EXPECT_EQ("mime/type", types[0].mime_type);
EXPECT_EQ(1U, types[0].file_extensions.size());
EXPECT_EQ("ext1", types[0].file_extensions[0]);
- EXPECT_EQ(L"", types[0].description);
+ EXPECT_EQ(string16(), types[0].description);
}
// This Java plugin has embedded semicolons in the mime type.
@@ -141,7 +142,7 @@ TEST(MIMEDescriptionParse, ComplicatedJava) {
ASSERT_EQ(12U, types.size());
for (size_t i = 0; i < types.size(); ++i)
- EXPECT_EQ(L"IcedTea", types[i].description);
+ EXPECT_EQ(ASCIIToUTF16("IcedTea"), types[i].description);
// Verify that the mime types with semis are coming through ok.
EXPECT_TRUE(types[4].mime_type.find(';') != std::string::npos);
diff --git a/webkit/glue/plugins/plugin_list.cc b/webkit/glue/plugins/plugin_list.cc
index 487420f..1d164ea 100644
--- a/webkit/glue/plugins/plugin_list.cc
+++ b/webkit/glue/plugins/plugin_list.cc
@@ -93,19 +93,19 @@ bool PluginList::ReadPluginInfo(const FilePath& filename,
bool PluginList::CreateWebPluginInfo(const PluginVersionInfo& pvi,
WebPluginInfo* info) {
std::vector<std::string> mime_types, file_extensions;
- std::vector<std::wstring> descriptions;
+ std::vector<string16> descriptions;
SplitString(WideToUTF8(pvi.mime_types), '|', &mime_types);
SplitString(WideToUTF8(pvi.file_extensions), '|', &file_extensions);
- SplitString(pvi.type_descriptions, '|', &descriptions);
+ SplitString(WideToUTF16(pvi.type_descriptions), '|', &descriptions);
info->mime_types.clear();
if (mime_types.empty())
return false;
- info->name = pvi.product_name;
- info->desc = pvi.file_description;
- info->version = pvi.file_version;
+ info->name = WideToUTF16(pvi.product_name);
+ info->desc = WideToUTF16(pvi.file_description);
+ info->version = WideToUTF16(pvi.file_version);
info->path = pvi.path;
info->enabled = true;
@@ -121,8 +121,8 @@ bool PluginList::CreateWebPluginInfo(const PluginVersionInfo& pvi,
// On Windows, the description likely has a list of file extensions
// embedded in it (e.g. "SurfWriter file (*.swr)"). Remove an extension
// list from the description if it is present.
- size_t ext = mime_type.description.find(L"(*");
- if (ext != std::wstring::npos) {
+ size_t ext = mime_type.description.find(ASCIIToUTF16("(*"));
+ if (ext != string16::npos) {
if (ext > 1 && mime_type.description[ext -1] == ' ')
ext--;
diff --git a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm
index 23eefda..3bcff4c 100644
--- a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm
+++ b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm
@@ -317,7 +317,7 @@ bool WebPluginDelegateImpl::PlatformInitialize() {
// TODO(stuartmorgan): Test other QuickDraw plugins that we support and
// see if any others can use the fast path.
const WebPluginInfo& plugin_info = instance_->plugin_lib()->plugin_info();
- if (plugin_info.name.find(L"QuickTime") != std::wstring::npos)
+ if (plugin_info.name.find(ASCIIToUTF16("QuickTime")) != string16::npos)
quirks_ |= PLUGIN_QUIRK_ALLOW_FASTER_QUICKDRAW_PATH;
}
#endif
@@ -410,7 +410,7 @@ bool WebPluginDelegateImpl::PlatformInitialize() {
#ifndef NP_NO_QUICKDRAW
if (instance()->drawing_model() == NPDrawingModelQuickDraw) {
const WebPluginInfo& plugin_info = instance_->plugin_lib()->plugin_info();
- if (plugin_info.name.find(L"QuickTime") != std::wstring::npos)
+ if (plugin_info.name.find(ASCIIToUTF16("QuickTime")) != string16::npos)
WindowlessSetWindow();
}
#endif
diff --git a/webkit/glue/plugins/webplugininfo.h b/webkit/glue/plugins/webplugininfo.h
index 21f34df..9d2ab6e 100644
--- a/webkit/glue/plugins/webplugininfo.h
+++ b/webkit/glue/plugins/webplugininfo.h
@@ -20,22 +20,22 @@ struct WebPluginMimeType {
std::vector<std::string> file_extensions;
// Description of the mime type.
- std::wstring description;
+ string16 description;
};
// Describes an available NPAPI plugin.
struct WebPluginInfo {
// The name of the plugin (i.e. Flash).
- std::wstring name;
+ string16 name;
// The path to the plugin file (DLL/bundle/library).
FilePath path;
// The version number of the plugin file (may be OS-specific)
- std::wstring version;
+ string16 version;
// A description of the plugin that we get from its version info.
- std::wstring desc;
+ string16 desc;
// A list of all the mime types that this plugin supports.
std::vector<WebPluginMimeType> mime_types;
diff --git a/webkit/glue/webkitclient_impl.cc b/webkit/glue/webkitclient_impl.cc
index ff0d93b..9808339 100644
--- a/webkit/glue/webkitclient_impl.cc
+++ b/webkit/glue/webkitclient_impl.cc
@@ -194,16 +194,14 @@ void WebKitClientImpl::getPluginList(bool refresh,
const WebPluginInfo& plugin = plugins[i];
builder->addPlugin(
- WideToUTF16Hack(plugin.name),
- WideToUTF16Hack(plugin.desc),
+ plugin.name, plugin.desc,
FilePathStringToWebString(plugin.path.BaseName().value()));
for (size_t j = 0; j < plugin.mime_types.size(); ++j) {
const WebPluginMimeType& mime_type = plugin.mime_types[j];
builder->addMediaTypeToLastPlugin(
- WebString::fromUTF8(mime_type.mime_type),
- WideToUTF16Hack(mime_type.description));
+ WebString::fromUTF8(mime_type.mime_type), mime_type.description);
for (size_t k = 0; k < mime_type.file_extensions.size(); ++k) {
builder->addFileExtensionToLastMediaType(