diff options
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/default_plugin/plugins2.xml | 17 | ||||
-rw-r--r-- | webkit/glue/plugins/webplugin_delegate_impl.cc | 31 | ||||
-rw-r--r-- | webkit/glue/plugins/webplugin_delegate_impl.h | 27 | ||||
-rw-r--r-- | webkit/glue/plugins/webplugin_delegate_impl_mac.mm | 23 | ||||
-rw-r--r-- | webkit/glue/plugins/webplugin_delegate_impl_win.cc | 3 | ||||
-rw-r--r-- | webkit/glue/webplugin_delegate.h | 36 | ||||
-rw-r--r-- | webkit/glue/webplugin_impl.cc | 46 | ||||
-rw-r--r-- | webkit/glue/webplugin_impl.h | 5 |
8 files changed, 96 insertions, 92 deletions
diff --git a/webkit/default_plugin/plugins2.xml b/webkit/default_plugin/plugins2.xml index 7188119..472a04b 100644 --- a/webkit/default_plugin/plugins2.xml +++ b/webkit/default_plugin/plugins2.xml @@ -10,36 +10,43 @@ <plugin> <mime_types>audio/x-pn-realaudio-plugin;audio/x-pn-realaudio;audio/vnd.rn-realaudio;video/vnd.rn-realvideo</mime_types> <lang>en-us</lang> - <name>Real player</name> + <name>RealPlayer</name> <url>http://software-dl.real.com/free/windows/installer/R41R02F/RealPlayer11GOLD.exe</url> </plugin> <plugin> <mime_types>application/x-shockwave-flash;application/futuresplash</mime_types> <lang>en-us</lang> - <name>Adobe Flash Movie</name> + <name>Adobe Flash Player</name> <url>http://fpdownload.adobe.com/get/flashplayer/current/install_flash_player.exe</url> </plugin> <plugin> <mime_types>application/x-director</mime_types> <lang>en-us</lang> - <name>Adobe Shockwave Movie</name> + <name>Adobe Shockwave Player</name> <url>http://fpdownload.macromedia.com/get/shockwave/default/english/win95nt/latest/Shockwave_Installer_Slim.exe</url> </plugin> <plugin> <mime_types>application/pdf;application/vnd.adobe.x-mars;application/vnd.fdf;application/vnd.adobe.xfdf;application/vnd.adobe.xdp+xml;application/vnd.adobe.xfd+xml;</mime_types> <lang>en-us</lang> - <name>Adobe Acrobat</name> + <name>Adobe Reader</name> <url>http://ardownload.adobe.com/pub/adobe/reader/win/9.x/9.1/enu/AdbeRdr910_en_US.exe</url> </plugin> <plugin> <mime_types>video/quicktime;application/sdp;application/x-sdp;application/x-rtsp;video/flc;audio/x-wav;audio/wav;audio/aiff;audio/x-aiff;audio/basic;audio/mid;audio/x-midi;audio/midi;audio/vnd.qcelp;audio/x-gsm;audio/amr;audio/aac;audio/x-aac;audio/x-caf;audio/ac3;audio/x-ac3;video/x-mpeg;video/mpeg;audio/mpeg;audio/x-mpeg;video/3ggp;audio/3ggp;video/3ggp2;audio/3ggp2;video/sd-video;application/x-mpeg;video/mp4;audio/mp4;audio/x-m4a;audio/x-m4p;audio/x-m4b;video/x-m4v;image/x-macpaint;image/pict;image/x-pict;image/png;image/x-png;image/x-quicktime;image/x-sgi;image/x-targa;image/jp2;image/jpeg2000;image/jpeg2000-image;image/x-jpeg2000-image</mime_types> <lang>en-us</lang> - <name>Quicktime player</name> + <name>QuickTime Player</name> <url>http://appldnld.apple.com.edgesuite.net/content.info.apple.com/QuickTime/061-6118.20090601.Pq3V9/QuickTimeInstaller.exe</url> </plugin> + <plugin> + <mime_types>application/x-ms-wmp;application/asx;video/x-ms-asf-plugin;application/x-mplayer2;video/x-ms-asf;video/x-ms-wm;audio/x-ms-wma;audio/x-ms-wax;video/x-ms-wmv;video/x-ms-wvx</mime_types> + <lang>en-us</lang> + <name>Windows Media Player Plugin</name> + <url>http://port25.technet.com/videos/downloads/wmpfirefoxplugin.exe</url> + </plugin> + </plugins>
\ No newline at end of file diff --git a/webkit/glue/plugins/webplugin_delegate_impl.cc b/webkit/glue/plugins/webplugin_delegate_impl.cc index 078b6cf..4cb45ec 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl.cc +++ b/webkit/glue/plugins/webplugin_delegate_impl.cc @@ -10,6 +10,7 @@ #include "base/file_util.h" #include "base/message_loop.h" #include "base/process_util.h" +#include "base/scoped_ptr.h" #include "base/stats_counters.h" #include "base/string_util.h" #include "webkit/api/public/WebInputEvent.h" @@ -29,7 +30,7 @@ using WebKit::WebKeyboardEvent; using WebKit::WebInputEvent; using WebKit::WebMouseEvent; -WebPluginDelegate* WebPluginDelegate::Create( +WebPluginDelegateImpl* WebPluginDelegateImpl::Create( const FilePath& filename, const std::string& mime_type, gfx::PluginWindowHandle containing_view) { @@ -47,12 +48,12 @@ WebPluginDelegate* WebPluginDelegate::Create( return new WebPluginDelegateImpl(containing_view, instance.get()); } -bool WebPluginDelegateImpl::Initialize(const GURL& url, - char** argn, - char** argv, - int argc, - WebPlugin* plugin, - bool load_manually) { +bool WebPluginDelegateImpl::Initialize( + const GURL& url, + const std::vector<std::string>& arg_names, + const std::vector<std::string>& arg_values, + WebPlugin* plugin, + bool load_manually) { plugin_ = plugin; instance_->set_web_plugin(plugin_); @@ -69,7 +70,21 @@ bool WebPluginDelegateImpl::Initialize(const GURL& url, if (quirks_ & PLUGIN_QUIRK_DIE_AFTER_UNLOAD) webkit_glue::SetForcefullyTerminatePluginProcess(true); - bool start_result = instance_->Start(url, argn, argv, argc, load_manually); + int argc = 0; + scoped_array<char*> argn(new char*[arg_names.size()]); + scoped_array<char*> argv(new char*[arg_names.size()]); + for (size_t i = 0; i < arg_names.size(); ++i) { + if (quirks_ & PLUGIN_QUIRK_NO_WINDOWLESS && + LowerCaseEqualsASCII(arg_names[i], "windowlessvideo")) { + continue; + } + argn[argc] = const_cast<char*>(arg_names[i].c_str()); + argv[argc] = const_cast<char*>(arg_values[i].c_str()); + argc++; + } + + bool start_result = instance_->Start( + url, argn.get(), argv.get(), argc, load_manually); NPAPI::PluginInstance::SetInitializingInstance(old_instance); diff --git a/webkit/glue/plugins/webplugin_delegate_impl.h b/webkit/glue/plugins/webplugin_delegate_impl.h index 51f3839..1ceb8f5 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl.h +++ b/webkit/glue/plugins/webplugin_delegate_impl.h @@ -31,6 +31,24 @@ class PluginInstance; // the plugin process. class WebPluginDelegateImpl : public webkit_glue::WebPluginDelegate { public: + enum PluginQuirks { + PLUGIN_QUIRK_SETWINDOW_TWICE = 1, // Win32 + PLUGIN_QUIRK_THROTTLE_WM_USER_PLUS_ONE = 2, // Win32 + PLUGIN_QUIRK_DONT_CALL_WND_PROC_RECURSIVELY = 4, // Win32 + PLUGIN_QUIRK_DONT_SET_NULL_WINDOW_HANDLE_ON_DESTROY = 8, // Win32 + PLUGIN_QUIRK_DONT_ALLOW_MULTIPLE_INSTANCES = 16, // Win32 + PLUGIN_QUIRK_DIE_AFTER_UNLOAD = 32, // Win32 + PLUGIN_QUIRK_PATCH_SETCURSOR = 64, // Win32 + PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS = 128, // Win32 + PLUGIN_QUIRK_WINDOWLESS_OFFSET_WINDOW_TO_DRAW = 256, // Linux + PLUGIN_QUIRK_WINDOWLESS_INVALIDATE_AFTER_SET_WINDOW = 512, // Linux + PLUGIN_QUIRK_NO_WINDOWLESS = 1024, // Windows + }; + + static WebPluginDelegateImpl* Create(const FilePath& filename, + const std::string& mime_type, + gfx::PluginWindowHandle containing_view); + static bool IsPluginDelegateWindow(gfx::NativeWindow window); static bool GetPluginNameFromWindow(gfx::NativeWindow window, std::wstring *plugin_name); @@ -42,9 +60,8 @@ class WebPluginDelegateImpl : public webkit_glue::WebPluginDelegate { // WebPluginDelegate implementation virtual void PluginDestroyed(); virtual bool Initialize(const GURL& url, - char** argn, - char** argv, - int argc, + const std::vector<std::string>& arg_names, + const std::vector<std::string>& arg_values, webkit_glue::WebPlugin* plugin, bool load_manually); virtual void UpdateGeometry(const gfx::Rect& window_rect, @@ -86,7 +103,9 @@ class WebPluginDelegateImpl : public webkit_glue::WebPluginDelegate { virtual bool IsWindowless() const { return windowless_ ; } virtual gfx::Rect GetRect() const { return window_rect_; } virtual gfx::Rect GetClipRect() const { return clip_rect_; } - virtual int GetQuirks() const { return quirks_; } + + // Returns a combination of PluginQuirks. + int GetQuirks() const { return quirks_; } #if defined(OS_MACOSX) // Informs the delegate that the context used for painting windowless plugins diff --git a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm index 08e91bc..826f60c 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm +++ b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm @@ -12,6 +12,7 @@ #include "base/file_util.h" #include "base/lazy_instance.h" #include "base/message_loop.h" +#include "base/scoped_ptr.h" #include "base/stats_counters.h" #include "base/string_util.h" #include "webkit/api/public/WebInputEvent.h" @@ -64,7 +65,7 @@ int g_current_y_offset = 0; } // namespace -WebPluginDelegate* WebPluginDelegate::Create( +WebPluginDelegateImpl* WebPluginDelegateImpl::Create( const FilePath& filename, const std::string& mime_type, gfx::PluginWindowHandle containing_view) { @@ -112,9 +113,8 @@ void WebPluginDelegateImpl::PluginDestroyed() { } bool WebPluginDelegateImpl::Initialize(const GURL& url, - char** argn, - char** argv, - int argc, + const std::vector<std::string>& arg_names, + const std::vector<std::string>& arg_values, WebPlugin* plugin, bool load_manually) { plugin_ = plugin; @@ -123,8 +123,21 @@ bool WebPluginDelegateImpl::Initialize(const GURL& url, NPAPI::PluginInstance* old_instance = NPAPI::PluginInstance::SetInitializingInstance(instance_); + int argc = 0; + scoped_array<char*> argn(new char*[arg_names.size()]); + scoped_array<char*> argv(new char*[arg_names.size()]); + for (size_t i = 0; i < arg_names.size(); ++i) { + if (quirks_ & PLUGIN_QUIRK_NO_WINDOWLESS && + LowerCaseEqualsASCII(arg_names[i], "windowlessvideo")) { + continue; + } + argn[argc] = const_cast<char*>(arg_names[i].c_str()); + argv[argc] = const_cast<char*>(arg_values[i].c_str()); + argc++; + } - bool start_result = instance_->Start(url, argn, argv, argc, load_manually); + bool start_result = instance_->Start( + url, argn.get(), argv.get(), argc, load_manually); NPAPI::PluginInstance::SetInitializingInstance(old_instance); diff --git a/webkit/glue/plugins/webplugin_delegate_impl_win.cc b/webkit/glue/plugins/webplugin_delegate_impl_win.cc index a36d5fc..a1e1b18 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl_win.cc +++ b/webkit/glue/plugins/webplugin_delegate_impl_win.cc @@ -203,6 +203,9 @@ WebPluginDelegateImpl::WebPluginDelegateImpl( std::wstring::npos) { // Windows Media Player needs two NPP_SetWindow calls. quirks_ |= PLUGIN_QUIRK_SETWINDOW_TWICE; + + // Windowless mode doesn't work in the WMP NPAPI plugin. + quirks_ |= PLUGIN_QUIRK_NO_WINDOWLESS; } else if (instance_->mime_type() == "audio/x-pn-realaudio-plugin" || filename == "nppl3260.dll") { quirks_ |= PLUGIN_QUIRK_DONT_CALL_WND_PROC_RECURSIVELY; diff --git a/webkit/glue/webplugin_delegate.h b/webkit/glue/webplugin_delegate.h index de83954..e56157b 100644 --- a/webkit/glue/webplugin_delegate.h +++ b/webkit/glue/webplugin_delegate.h @@ -32,25 +32,8 @@ class WebPluginResourceClient; // This is the interface that a plugin implementation needs to provide. class WebPluginDelegate { public: - enum PluginQuirks { - PLUGIN_QUIRK_SETWINDOW_TWICE = 1, // Win32 - PLUGIN_QUIRK_THROTTLE_WM_USER_PLUS_ONE = 2, // Win32 - PLUGIN_QUIRK_DONT_CALL_WND_PROC_RECURSIVELY = 4, // Win32 - PLUGIN_QUIRK_DONT_SET_NULL_WINDOW_HANDLE_ON_DESTROY = 8, // Win32 - PLUGIN_QUIRK_DONT_ALLOW_MULTIPLE_INSTANCES = 16, // Win32 - PLUGIN_QUIRK_DIE_AFTER_UNLOAD = 32, // Win32 - PLUGIN_QUIRK_PATCH_SETCURSOR = 64, // Win32 - PLUGIN_QUIRK_BLOCK_NONSTANDARD_GETURL_REQUESTS = 128, // Win32 - PLUGIN_QUIRK_WINDOWLESS_OFFSET_WINDOW_TO_DRAW = 256, // Linux - PLUGIN_QUIRK_WINDOWLESS_INVALIDATE_AFTER_SET_WINDOW = 512, // Linux - }; - virtual ~WebPluginDelegate() {} - static WebPluginDelegate* Create(const FilePath& filename, - const std::string& mime_type, - gfx::PluginWindowHandle containing_view); - // Initializes the plugin implementation with the given (UTF8) arguments. // Note that the lifetime of WebPlugin must be longer than this delegate. // If this function returns false the plugin isn't started and shouldn't be @@ -60,8 +43,11 @@ class WebPluginDelegate { // be passed from webkit. if false indicates that the plugin should download // the data. This also controls whether the plugin is instantiated as a full // page plugin (NP_FULL) or embedded (NP_EMBED). - virtual bool Initialize(const GURL& url, char** argn, char** argv, int argc, - WebPlugin* plugin, bool load_manually) = 0; + virtual bool Initialize(const GURL& url, + const std::vector<std::string>& arg_names, + const std::vector<std::string>& arg_values, + WebPlugin* plugin, + bool load_manually) = 0; // Called when the WebPlugin is being destroyed. This is a signal to the // delegate that it should tear-down the plugin implementation and not call @@ -126,9 +112,6 @@ class WebPluginDelegate { // Indicates a failure in data receipt. virtual void DidManualLoadFail() = 0; - // Only available after Initialize is called. - virtual FilePath GetPluginPath() = 0; - // Only supported when the plugin is the default plugin. virtual void InstallMissingPlugin() = 0; @@ -138,15 +121,6 @@ class WebPluginDelegate { bool notify_needed, intptr_t notify_data, intptr_t stream) = 0; - - virtual bool IsWindowless() const = 0; - - virtual gfx::Rect GetRect() const = 0; - - virtual gfx::Rect GetClipRect() const = 0; - - // Returns a combination of PluginQuirks. - virtual int GetQuirks() const = 0; }; } // namespace webkit_glue diff --git a/webkit/glue/webplugin_impl.cc b/webkit/glue/webplugin_impl.cc index 54576a6..fec69bd 100644 --- a/webkit/glue/webplugin_impl.cc +++ b/webkit/glue/webplugin_impl.cc @@ -197,30 +197,6 @@ void GetResponseInfo(const WebURLResponse& response, } } -// 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 @@ bool WebPluginImpl::initialize(WebPluginContainer* container) { #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 @@ bool WebPluginImpl::initialize(WebPluginContainer* container) { 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 @@ WebPluginImpl::WebPluginImpl( 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 @@ bool WebPluginImpl::ReinitializePluginForResponse( 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; diff --git a/webkit/glue/webplugin_impl.h b/webkit/glue/webplugin_impl.h index 07e043c..44133b2 100644 --- a/webkit/glue/webplugin_impl.h +++ b/webkit/glue/webplugin_impl.h @@ -268,9 +268,8 @@ class WebPluginImpl : public WebPlugin, // Holds the list of argument names and values passed to the plugin. We keep // these so that we can re-initialize the plugin if we need to. - char** arg_names_; - char** arg_values_; - size_t arg_count_; + std::vector<std::string> arg_names_; + std::vector<std::string> arg_values_; ScopedRunnableMethodFactory<WebPluginImpl> method_factory_; |