Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(387)

Unified Diff: webkit/glue/webplugin_impl.cc

Issue 196012: This changelist fixes some issues with the NPAPI WMP plugin work in Chrome. ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/glue/webplugin_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/webplugin_impl.cc
===================================================================
--- webkit/glue/webplugin_impl.cc (revision 25381)
+++ webkit/glue/webplugin_impl.cc (working copy)
@@ -197,30 +197,6 @@
}
}
-// Utility function to convert a vector to an array of char*'s.
-// Caller is responsible to free memory with DeleteArray().
-static char** ToArray(const WebVector<WebString>& input) {
- char** array = new char*[input.size() + 1];
- size_t index;
- for (index = 0; index < input.size(); ++index) {
- const WebCString& src = input[index].utf8();
- array[index] = new char[src.length() + 1];
- base::strlcpy(array[index], src.data(), src.length() + 1);
- array[index][src.length()] = '\0';
- }
- array[index] = 0;
- return array;
-}
-
-static void DeleteArray(char** array) {
- char** ptr = array;
- while (*ptr) {
- delete[] *ptr;
- ++ptr;
- }
- delete[] array;
-}
-
} // namespace
// WebKit::WebPlugin ----------------------------------------------------------
@@ -234,9 +210,9 @@
#if defined(OS_WIN)
std::string clsid, version;
if (activex_shim::IsMimeTypeActiveX(mime_type_)) {
- for (size_t i = 0; i < arg_count_; i++) {
- const char* param_name = arg_names_[i];
- const char* param_value = arg_values_[i];
+ for (size_t i = 0; i < arg_names_.size(); i++) {
+ const char* param_name = arg_names_[i].c_str();
+ const char* param_value = arg_values_[i].c_str();
if (base::strcasecmp(param_name, "classid") == 0) {
activex_shim::GetClsidFromClassidAttribute(param_value, &clsid);
} else if (base::strcasecmp(param_name, "codebase") == 0) {
@@ -265,7 +241,7 @@
return NULL;
bool ok = plugin_delegate->Initialize(
- plugin_url_, arg_names_, arg_values_, arg_count_, this, load_manually_);
+ plugin_url_, arg_names_, arg_values_, this, load_manually_);
if (!ok) {
plugin_delegate->PluginDestroyed();
return false;
@@ -437,19 +413,17 @@
first_geometry_update_(true),
ignore_response_error_(false),
mime_type_(params.mimeType.utf8()),
- arg_names_(ToArray(params.attributeNames)),
- arg_values_(ToArray(params.attributeValues)),
- arg_count_(params.attributeNames.size()),
ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) {
DCHECK_EQ(params.attributeNames.size(), params.attributeValues.size());
StringToLowerASCII(&mime_type_);
+
+ for (size_t i = 0; i < params.attributeNames.size(); ++i) {
+ arg_names_.push_back(params.attributeNames[i].utf8());
+ arg_values_.push_back(params.attributeValues[i].utf8());
+ }
}
WebPluginImpl::~WebPluginImpl() {
- if (arg_names_)
- DeleteArray(arg_names_);
- if (arg_values_)
- DeleteArray(arg_values_);
}
void WebPluginImpl::SetWindow(gfx::PluginWindowHandle window) {
@@ -1053,7 +1027,7 @@
plugin_url_, mime_type_, std::string(), &actual_mime_type);
bool ok = plugin_delegate->Initialize(
- plugin_url_, arg_names_, arg_values_, arg_count_, this, load_manually_);
+ plugin_url_, arg_names_, arg_values_, this, load_manually_);
if (!ok) {
container_ = NULL;
« no previous file with comments | « webkit/glue/webplugin_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698