diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-07 02:48:34 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-07 02:48:34 +0000 |
commit | 325358b8f7e145d69300b1186985a57ab59a546c (patch) | |
tree | ed7d81acaf409dde9df4acb5f712b0089945d5e7 /webkit | |
parent | 421fb9a0f6c489c006031c1789848e0565ab485c (diff) | |
download | chromium_src-325358b8f7e145d69300b1186985a57ab59a546c.zip chromium_src-325358b8f7e145d69300b1186985a57ab59a546c.tar.gz chromium_src-325358b8f7e145d69300b1186985a57ab59a546c.tar.bz2 |
Revert 51681 - Move default_plugin out of webkit.
BUG=48419
Review URL: http://codereview.chromium.org/2803035
TBR=thakis@chromium.org
Review URL: http://codereview.chromium.org/2819043
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51684 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
26 files changed, 4036 insertions, 5 deletions
diff --git a/webkit/default_plugin/DEPS b/webkit/default_plugin/DEPS new file mode 100644 index 0000000..a24c01b --- /dev/null +++ b/webkit/default_plugin/DEPS @@ -0,0 +1,4 @@ +include_rules = [ + "+app", + "+third_party/libxml", +] diff --git a/webkit/default_plugin/default_plugin.gyp b/webkit/default_plugin/default_plugin.gyp new file mode 100644 index 0000000..5339a3d --- /dev/null +++ b/webkit/default_plugin/default_plugin.gyp @@ -0,0 +1,69 @@ +# Copyright (c) 2009 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. + +{ + 'variables': { + 'chromium_code': 1, + }, + 'targets': [ + { + 'target_name': 'default_plugin', + 'type': '<(library)', + 'dependencies': [ + '../../net/net.gyp:net_resources', + '../../third_party/icu/icu.gyp:icui18n', + '../../third_party/icu/icu.gyp:icuuc', + '../../third_party/libxml/libxml.gyp:libxml', + '../../third_party/npapi/npapi.gyp:npapi', + '../support/webkit_support.gyp:webkit_resources', + '../support/webkit_support.gyp:webkit_strings', + ], + 'include_dirs': [ + '../..', + '<(DEPTH)/third_party/wtl/include', + # TODO(bradnelson): this should fall out of the dependencies. + '<(SHARED_INTERMEDIATE_DIR)/webkit', + ], + 'sources': [ + 'default_plugin_shared.h', + 'plugin_impl_gtk.cc', + 'plugin_impl_gtk.h', + 'plugin_impl_mac.h', + 'plugin_impl_mac.mm', + 'plugin_impl_win.cc', + 'plugin_impl_win.h', + 'plugin_main.cc', + 'plugin_main.h', + ], + 'conditions': [ + ['OS=="win"', { + 'msvs_guid': '5916D37D-8C97-424F-A904-74E52594C2D6', + 'link_settings': { + 'libraries': ['-lurlmon.lib'], + }, + 'sources': [ + 'default_plugin_resources.h', + 'install_dialog.cc', + 'install_dialog.h', + 'plugin_database_handler.cc', + 'plugin_database_handler.h', + 'plugin_install_job_monitor.cc', + 'plugin_install_job_monitor.h', + ], + }], + ['OS=="linux"', { + 'dependencies': [ + '../../build/linux/system.gyp:gtk', + ], + }], + ], + }, + ], +} + +# Local Variables: +# tab-width:2 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=2 shiftwidth=2: diff --git a/webkit/default_plugin/default_plugin_resources.h b/webkit/default_plugin/default_plugin_resources.h new file mode 100644 index 0000000..6e6942c --- /dev/null +++ b/webkit/default_plugin/default_plugin_resources.h @@ -0,0 +1,13 @@ +// Copyright (c) 2006-2008 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. + +#define IDD_DEFAULT_PLUGIN_INSTALL_DIALOG 2208 +#define IDI_DEFAULT_PLUGIN_ICON 2209 +#define IDB_GET_THE_PLUGIN 2210 +#define IDC_PLUGIN_MAIN_LABEL 2211 +#define IDC_PLUGIN_INSTALL_LABEL 2212 +#define IDC_PLUGIN_URL_LABEL 2213 +#define IDC_PLUGIN_INSTALL_CONFIRMATION_LABEL 2214 +#define IDC_PLUGIN_NAME 2215 +#define IDC_PLUGIN_NAME_VALUE 2216 diff --git a/webkit/default_plugin/default_plugin_resources.rc b/webkit/default_plugin/default_plugin_resources.rc new file mode 100644 index 0000000..53460af --- /dev/null +++ b/webkit/default_plugin/default_plugin_resources.rc @@ -0,0 +1,31 @@ +// Resources used by webkit/default_plugin. +// +// Paths in this file are relative to SolutionDir. + +#ifdef APSTUDIO_INVOKED + #error // Don't open in the Visual Studio resource editor! +#endif //APSTUDIO_INVOKED + +#include <winuser.h> +#include "webkit\\default_plugin\\default_plugin_resources.h" + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog template for the plugin installation dialog. +// +IDD_DEFAULT_PLUGIN_INSTALL_DIALOG DIALOGEX 0, 0, 240, 130 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Plug-in Needed" +FONT 8, "MS Shell Dlg", 400, 0, 0x1 +BEGIN + DEFPUSHBUTTON "",IDB_GET_THE_PLUGIN,32,100,81,14 + PUSHBUTTON "",IDCANCEL,133,100,74,14 + LTEXT "",IDC_PLUGIN_INSTALL_CONFIRMATION_LABEL,17,50,204,27 +END + +///////////////////////////////////////////////////////////////////////////// +// +// Icon used by the default plugin window. +// +IDI_DEFAULT_PLUGIN_ICON ICON "webkit\\default_plugin\\default_plugin.ico" diff --git a/webkit/glue/plugins/default_plugin_shared.h b/webkit/default_plugin/default_plugin_shared.h index 99aac72..6bc56fb 100644 --- a/webkit/glue/plugins/default_plugin_shared.h +++ b/webkit/default_plugin/default_plugin_shared.h @@ -5,8 +5,8 @@ // Thes file contains stuff that should be shared among projects that do some // special handling with default plugin -#ifndef WEBKIT_GLUE_PLUGINS_DEFAULT_PLUGIN_SHARED_H -#define WEBKIT_GLUE_PLUGINS_DEFAULT_PLUGIN_SHARED_H +#ifndef WEBKIT_DEFAULT_PLUGIN_DEFAULT_PLUGIN_SHARED_H +#define WEBKIT_DEFAULT_PLUGIN_DEFAULT_PLUGIN_SHARED_H namespace default_plugin { @@ -23,4 +23,4 @@ enum MissingPluginStatus { } // namespace default_plugin -#endif // WEBKIT_GLUE_PLUGINS_DEFAULT_PLUGIN_SHARED_H +#endif // #ifndef WEBKIT_DEFAULT_PLUGIN_DEFAULT_PLUGIN_SHARED_H diff --git a/webkit/default_plugin/install_dialog.cc b/webkit/default_plugin/install_dialog.cc new file mode 100644 index 0000000..e56c7be --- /dev/null +++ b/webkit/default_plugin/install_dialog.cc @@ -0,0 +1,203 @@ +// Copyright (c) 2006-2008 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/default_plugin/install_dialog.h" + +#include "base/hash_tables.h" +#include "base/lazy_instance.h" +#include "base/logging.h" +#include "base/string_util.h" +#include "grit/webkit_strings.h" +#include "webkit/default_plugin/plugin_impl.h" +#include "webkit/glue/webkit_glue.h" + +typedef base::hash_map<const std::wstring, PluginInstallDialog*> DialogMap; +base::LazyInstance<DialogMap> s_dialogs(base::LINKER_INITIALIZED); + +PluginInstallDialog* PluginInstallDialog::AddInstaller( + PluginInstallerImpl* plugin_impl, const std::wstring& plugin_name) { + PluginInstallDialog* dialog; + if (s_dialogs.Get().count(plugin_name)) { + dialog = s_dialogs.Get()[plugin_name]; + } else { + dialog = new PluginInstallDialog(plugin_name); + } + + dialog->installers_.push_back(plugin_impl); + return dialog; +} + +PluginInstallDialog::PluginInstallDialog(const std::wstring& plugin_name) + : plugin_name_(plugin_name) { + s_dialogs.Get()[plugin_name] = this; +} + +PluginInstallDialog::~PluginInstallDialog() { + s_dialogs.Get().erase(plugin_name_); + if (IsWindow()) + DestroyWindow(); +} + +void PluginInstallDialog::RemoveInstaller(PluginInstallerImpl* installer) { + for (size_t i = 0; i < installers_.size(); ++i) { + if (installers_[i] == installer) { + installers_.erase(installers_.begin() + i); + if (installers_.empty()) + delete this; + return; + } + } + NOTREACHED(); +} + +void PluginInstallDialog::ShowInstallDialog(HWND parent) { + if (IsWindow()) + return; + + Create(parent, NULL); + ShowWindow(SW_SHOW); +} + +HWND PluginInstallDialog::Create(HWND parent_window, LPARAM init_param) { + // Most of the code here is based on CDialogImpl<T>::Create. + DCHECK(m_hWnd == NULL); + + // Allocate the thunk structure here, where we can fail + // gracefully. + BOOL thunk_inited = m_thunk.Init(NULL, NULL); + if (thunk_inited == FALSE) { + SetLastError(ERROR_OUTOFMEMORY); + return NULL; + } + + _AtlWinModule.AddCreateWndData(&m_thunk.cd, this); + +#ifdef _DEBUG + m_bModal = false; +#endif // _DEBUG + + HINSTANCE instance_handle = _AtlBaseModule.GetResourceInstance(); + + HRSRC dialog_resource = FindResource(instance_handle, + MAKEINTRESOURCE(IDD), RT_DIALOG); + if (!dialog_resource) { + NOTREACHED(); + return NULL; + } + + HGLOBAL dialog_template = LoadResource(instance_handle, + dialog_resource); + if (!dialog_template) { + NOTREACHED(); + return NULL; + } + + _DialogSplitHelper::DLGTEMPLATEEX* dialog_template_struct = + reinterpret_cast<_DialogSplitHelper::DLGTEMPLATEEX *>( + ::LockResource(dialog_template)); + DCHECK(dialog_template_struct != NULL); + + unsigned long dialog_template_size = + SizeofResource(instance_handle, dialog_resource); + + HGLOBAL rtl_layout_dialog_template = NULL; + + if (PluginInstallerImpl::IsRTLLayout()) { + rtl_layout_dialog_template = GlobalAlloc(GPTR, dialog_template_size); + DCHECK(rtl_layout_dialog_template != NULL); + + _DialogSplitHelper::DLGTEMPLATEEX* rtl_layout_dialog_template_struct = + reinterpret_cast<_DialogSplitHelper::DLGTEMPLATEEX*>( + ::GlobalLock(rtl_layout_dialog_template)); + DCHECK(rtl_layout_dialog_template_struct != NULL); + + memcpy(rtl_layout_dialog_template_struct, dialog_template_struct, + dialog_template_size); + + rtl_layout_dialog_template_struct->exStyle |= + (WS_EX_LAYOUTRTL | WS_EX_RTLREADING); + + dialog_template_struct = rtl_layout_dialog_template_struct; + } + + HWND dialog_window = + CreateDialogIndirectParam( + instance_handle, + reinterpret_cast<DLGTEMPLATE*>(dialog_template_struct), + parent_window, StartDialogProc, init_param); + + DCHECK(m_hWnd == dialog_window); + + if (rtl_layout_dialog_template) { + GlobalUnlock(rtl_layout_dialog_template); + GlobalFree(rtl_layout_dialog_template); + } + + return dialog_window; +} + + +LRESULT PluginInstallDialog::OnInitDialog(UINT message, WPARAM wparam, + LPARAM lparam, BOOL& handled) { + std::wstring dialog_title = + PluginInstallerImpl::ReplaceStringForPossibleEmptyReplacement( + IDS_DEFAULT_PLUGIN_CONFIRMATION_DIALOG_TITLE, + IDS_DEFAULT_PLUGIN_CONFIRMATION_DIALOG_TITLE_NO_PLUGIN_NAME, + plugin_name_); + AdjustTextDirectionality(&dialog_title); + SetWindowText(dialog_title.c_str()); + + std::wstring get_the_plugin_btn_msg = + webkit_glue::GetLocalizedString( + IDS_DEFAULT_PLUGIN_GET_THE_PLUGIN_BTN_MSG); + AdjustTextDirectionality(&get_the_plugin_btn_msg); + SetDlgItemText(IDB_GET_THE_PLUGIN, get_the_plugin_btn_msg.c_str()); + + std::wstring cancel_plugin_download_msg = + webkit_glue::GetLocalizedString( + IDS_DEFAULT_PLUGIN_CANCEL_PLUGIN_DOWNLOAD_MSG); + AdjustTextDirectionality(&cancel_plugin_download_msg); + SetDlgItemText(IDCANCEL, cancel_plugin_download_msg.c_str()); + + std::wstring plugin_user_action_msg = + PluginInstallerImpl::ReplaceStringForPossibleEmptyReplacement( + IDS_DEFAULT_PLUGIN_USER_OPTION_MSG, + IDS_DEFAULT_PLUGIN_USER_OPTION_MSG_NO_PLUGIN_NAME, + plugin_name_); + AdjustTextDirectionality(&plugin_user_action_msg); + SetDlgItemText(IDC_PLUGIN_INSTALL_CONFIRMATION_LABEL, + plugin_user_action_msg.c_str()); + return 0; +} + + +LRESULT PluginInstallDialog::OnGetPlugin(WORD notify_code, WORD id, + HWND wnd_ctl, BOOL &handled) { + DestroyWindow(); + if (!installers_.empty()) + installers_[0]->DownloadPlugin(); + + return 0; +} + +LRESULT PluginInstallDialog::OnCancel(WORD notify_code, WORD id, HWND wnd_ctl, + BOOL &handled) { + DestroyWindow(); + if (!installers_.empty()) + installers_[0]->DownloadCancelled(); + return 0; +} + +// TODO(idana) bug# 1246452: use the library l10n_util once it is moved from +// the Chrome module into the Base module. For now, we simply copy/paste the +// same code. +void PluginInstallDialog::AdjustTextDirectionality(std::wstring* text) const { + if (PluginInstallerImpl::IsRTLLayout()) { + // Inserting an RLE (Right-To-Left Embedding) mark as the first character. + text->insert(0, L"\x202B"); + + // Inserting a PDF (Pop Directional Formatting) mark as the last character. + text->append(L"\x202C"); + } +} diff --git a/webkit/default_plugin/install_dialog.h b/webkit/default_plugin/install_dialog.h new file mode 100644 index 0000000..e5e5543 --- /dev/null +++ b/webkit/default_plugin/install_dialog.h @@ -0,0 +1,60 @@ +// Copyright (c) 2006-2008 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. + +#ifndef WEBKIT_DEFAULT_PLUGIN_INSTALL_DIALOG_H__ +#define WEBKIT_DEFAULT_PLUGIN_INSTALL_DIALOG_H__ + +#include <atlbase.h> +#include <atlwin.h> +#include <string> +#include <vector> + +#include "webkit/default_plugin/default_plugin_resources.h" + +class PluginInstallerImpl; + +// Displays the plugin installation dialog containing information +// about the mime type of the plugin being downloaded, the URL +// where it would be downloaded from, etc. +class PluginInstallDialog : public CDialogImpl<PluginInstallDialog> { + public: + enum {IDD = IDD_DEFAULT_PLUGIN_INSTALL_DIALOG}; + + BEGIN_MSG_MAP(PluginInstallDialog) + MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog) + COMMAND_ID_HANDLER(IDB_GET_THE_PLUGIN, OnGetPlugin) + COMMAND_ID_HANDLER(IDCANCEL, OnCancel) + END_MSG_MAP() + + // Creates or returns the existing object for the given plugin name. + // Call RemoveInstaller when done. + static PluginInstallDialog* AddInstaller(PluginInstallerImpl* plugin_impl, + const std::wstring& plugin_name); + + // Lets this object know that the given installer object is going away. + void RemoveInstaller(PluginInstallerImpl* installer); + + void ShowInstallDialog(HWND parent); + + private: + PluginInstallDialog(const std::wstring& plugin_name); + ~PluginInstallDialog(); + + // Implemented to ensure that we handle RTL layouts correctly. + HWND Create(HWND parent_window, LPARAM init_param); + + LRESULT OnInitDialog(UINT message, WPARAM wparam, LPARAM lparam, + BOOL& handled); + LRESULT OnGetPlugin(WORD notify_code, WORD id, HWND wnd_ctl, BOOL &handled); + LRESULT OnCancel(WORD notify_code, WORD id, HWND wnd_ctl, BOOL &handled); + + // Wraps the string with Unicode directionality characters in order to make + // sure BiDi text is rendered correctly when the UI layout is right-to-left. + void AdjustTextDirectionality(std::wstring* text) const; + + std::vector<PluginInstallerImpl*> installers_; + std::wstring plugin_name_; +}; + +#endif // WEBKIT_DEFAULT_PLUGIN_INSTALL_DIALOG_H__ diff --git a/webkit/default_plugin/plugin_database_handler.cc b/webkit/default_plugin/plugin_database_handler.cc new file mode 100644 index 0000000..3aeff63 --- /dev/null +++ b/webkit/default_plugin/plugin_database_handler.cc @@ -0,0 +1,358 @@ +// Copyright (c) 2006-2008 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/default_plugin/plugin_database_handler.h" + +#if defined(USE_SYSTEM_LIBXML) +#include <parser.h> +#include <xpath.h> +#else +#include "third_party/libxml/include/libxml/parser.h" +#include "third_party/libxml/include/libxml/xpath.h" +#endif + +#include "base/file_util.h" +#include "base/path_service.h" +#include "base/string_util.h" +#include "base/time.h" +#include "base/utf_string_conversions.h" +#include "webkit/default_plugin/plugin_impl.h" +#include "webkit/default_plugin/plugin_main.h" + +using base::Time; +using base::TimeDelta; + +PluginDatabaseHandler::PluginDatabaseHandler( + PluginInstallerImpl& plugin_installer_instance) + : plugin_downloads_file_(INVALID_HANDLE_VALUE), + plugin_installer_instance_(plugin_installer_instance), + ignore_plugin_db_data_(false) { +} + +PluginDatabaseHandler::~PluginDatabaseHandler() { + if (plugin_downloads_file_ != INVALID_HANDLE_VALUE) { + ::CloseHandle(plugin_downloads_file_); + plugin_downloads_file_ = INVALID_HANDLE_VALUE; + } +} + +bool PluginDatabaseHandler::DownloadPluginsFileIfNeeded( + const std::string& plugin_finder_url) { + DCHECK(!plugin_finder_url.empty()); + // The time in days for which the plugins list is cached. + // TODO(iyengar) Make this configurable. + const int kPluginsListCacheTimeInDays = 3; + + plugin_finder_url_ = plugin_finder_url; + + PathService::Get(base::DIR_MODULE, &plugins_file_); + plugins_file_ += L"\\chrome_plugins_file.xml"; + + bool initiate_download = false; + if (!file_util::PathExists(FilePath::FromWStringHack(plugins_file_))) { + initiate_download = true; + } else { + SYSTEMTIME creation_system_time = {0}; + if (!file_util::GetFileCreationLocalTime(plugins_file_, + &creation_system_time)) { + NOTREACHED(); + return false; + } + + FILETIME creation_file_time = {0}; + ::SystemTimeToFileTime(&creation_system_time, &creation_file_time); + + FILETIME current_time = {0}; + ::GetSystemTimeAsFileTime(¤t_time); + + Time file_time = Time::FromFileTime(creation_file_time); + Time current_system_time = Time::FromFileTime(current_time); + + TimeDelta time_diff = file_time - current_system_time; + if (time_diff.InDays() > kPluginsListCacheTimeInDays) { + initiate_download = true; + } + } + + if (initiate_download) { + DLOG(INFO) << "Initiating GetURLNotify on the plugin finder URL " + << plugin_finder_url.c_str(); + + plugin_installer_instance_.set_plugin_installer_state( + PluginListDownloadInitiated); + + DCHECK(default_plugin::g_browser->geturlnotify); + default_plugin::g_browser->geturlnotify( + plugin_installer_instance_.instance(), plugin_finder_url.c_str(), + NULL, NULL); + } else { + DLOG(INFO) << "Plugins file " << plugins_file_.c_str() + << " already exists"; + plugin_downloads_file_ = ::CreateFile(plugins_file_.c_str(), GENERIC_READ, + FILE_SHARE_READ, NULL, OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, NULL); + if (plugin_downloads_file_ == INVALID_HANDLE_VALUE) { + DLOG(INFO) << "Failed to open plugins file " + << plugins_file_.c_str() << " Error " + << ::GetLastError(); + NOTREACHED(); + return false; + } + // The URLNotify function contains all handling needed to parse the plugins + // file and display the UI accordingly. + plugin_installer_instance_.set_plugin_installer_state( + PluginListDownloadInitiated); + plugin_installer_instance_.URLNotify(plugin_finder_url.c_str(), + NPRES_DONE); + } + return true; +} + +int32 PluginDatabaseHandler::Write(NPStream* stream, int32 offset, + int32 buffer_length, void* buffer) { + if (ignore_plugin_db_data_) { + return buffer_length; + } + + if (plugin_downloads_file_ == INVALID_HANDLE_VALUE) { + DLOG(INFO) << "About to create plugins file " << plugins_file_.c_str(); + plugin_downloads_file_ = CreateFile(plugins_file_.c_str(), + GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ, NULL, CREATE_ALWAYS, + FILE_ATTRIBUTE_NORMAL, NULL); + if (plugin_downloads_file_ == INVALID_HANDLE_VALUE) { + unsigned long error = ::GetLastError(); + if (error == ERROR_SHARING_VIOLATION) { + // File may have been downloaded by another plugin instance on this + // page. + plugin_downloads_file_ = ::CreateFile( + plugins_file_.c_str(), GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, NULL); + if (plugin_downloads_file_ != INVALID_HANDLE_VALUE) { + ignore_plugin_db_data_ = true; + return buffer_length; + } + } + + DLOG(INFO) << "Failed to create plugins file " + << plugins_file_.c_str() << " Error " + << ::GetLastError(); + NOTREACHED(); + return 0; + } + } + + DWORD bytes_written = 0; + if (0 == lstrcmpiA(stream->url, plugin_finder_url_.c_str())) { + DCHECK(plugin_downloads_file_ != INVALID_HANDLE_VALUE); + + WriteFile(plugin_downloads_file_, buffer, buffer_length, &bytes_written, + NULL); + DCHECK_EQ(buffer_length, static_cast<int32>(bytes_written)); + } + return bytes_written; +} + + +bool PluginDatabaseHandler::ParsePluginList() { + if (plugin_downloads_file_ == INVALID_HANDLE_VALUE) { + DLOG(WARNING) << "Invalid plugins file"; + NOTREACHED(); + return false; + } + + bool parse_result = false; + + std::string plugins_file = WideToUTF8(plugins_file_.c_str()); + xmlDocPtr plugin_downloads_doc = xmlParseFile(plugins_file.c_str()); + if (plugin_downloads_doc == NULL) { + DLOG(WARNING) << "Failed to parse plugins file " << plugins_file.c_str(); + return parse_result; + } + + xmlXPathContextPtr context = NULL; + xmlXPathObjectPtr plugins_result = NULL; + + do { + context = xmlXPathNewContext(plugin_downloads_doc); + if (context == NULL) { + DLOG(WARNING) << "Failed to retrieve XPath context"; + NOTREACHED(); + parse_result = false; + break; + } + + plugins_result = + xmlXPathEvalExpression(reinterpret_cast<const xmlChar*>("//plugin"), + context); + if ((plugins_result == NULL) || + xmlXPathNodeSetIsEmpty(plugins_result->nodesetval)) { + DLOG(WARNING) << "Failed to find XPath //plugin"; + NOTREACHED(); + parse_result = false; + break; + } + + xmlNodeSetPtr plugin_list = plugins_result->nodesetval; + for (int plugin_index = 0; plugin_index < plugin_list->nodeNr; + ++plugin_index) { + PluginDetail plugin_detail; + if (!ReadPluginInfo(plugin_list->nodeTab[plugin_index]->children, + &plugin_detail)) { + DLOG(ERROR) << "Failed to read plugin details at index " + << plugin_index; + break; + } + downloaded_plugins_list_.push_back(plugin_detail); + } + if (downloaded_plugins_list_.size()) + parse_result = true; + } while (0); + + xmlXPathFreeContext(context); + xmlXPathFreeObject(plugins_result); + xmlFreeDoc(plugin_downloads_doc); + xmlCleanupParser(); + DLOG(INFO) << "Parse plugins file result " << parse_result; + return parse_result; +} + +bool PluginDatabaseHandler::GetPluginDetailsForMimeType( + const char* mime_type, const char* language, + std::string* download_url, std::wstring* plugin_name, + bool* download_url_for_display) { + if (!mime_type || !language || !download_url || !plugin_name || + !download_url_for_display) { + NOTREACHED(); + return false; + } + + PluginList::iterator plugin_index; + for (plugin_index = downloaded_plugins_list_.begin(); + plugin_index != downloaded_plugins_list_.end(); + ++plugin_index) { + PluginDetail& current_plugin = *plugin_index; + + std::vector<std::string>::iterator mime_type_index; + for (mime_type_index = current_plugin.mime_types.begin(); + mime_type_index != current_plugin.mime_types.end(); + ++mime_type_index) { + if ((0 == lstrcmpiA(mime_type, (*mime_type_index).c_str())) && + (0 == lstrcmpiA(language, current_plugin.language.c_str()))) { + *download_url = current_plugin.download_url; + *plugin_name = current_plugin.display_name; + *download_url_for_display = current_plugin.download_url_for_display; + return true; + } + } + } + return false; +} + +void PluginDatabaseHandler::Close(bool delete_file) { + if (plugin_downloads_file_ != INVALID_HANDLE_VALUE) { + ::CloseHandle(plugin_downloads_file_); + plugin_downloads_file_ = INVALID_HANDLE_VALUE; + if (delete_file) { + ::DeleteFile(plugins_file_.c_str()); + plugins_file_.clear(); + } + } +} + +bool PluginDatabaseHandler::ReadPluginInfo(_xmlNode* plugin_node, + PluginDetail* plugin_detail) { + static const char kMimeTypeSeparator = ';'; + + if (!plugin_node) { + NOTREACHED(); + return false; + } + + _xmlNode* plugin_mime_type = plugin_node->next; + if ((plugin_mime_type == NULL) || + (plugin_mime_type->next == NULL)) { + DLOG(WARNING) << "Failed to find mime type node in file"; + NOTREACHED(); + return false; + } + _xmlNode* plugin_mime_type_vals = plugin_mime_type->children; + if (plugin_mime_type_vals == NULL) { + DLOG(WARNING) << "Invalid mime type"; + NOTREACHED(); + return false; + } + // Skip the first child of each node as it is the text element + // for that node. + _xmlNode* plugin_lang_node = plugin_mime_type->next->next; + if ((plugin_lang_node == NULL) || + (plugin_lang_node->next == NULL)) { + DLOG(WARNING) << "Failed to find plugin language node"; + NOTREACHED(); + return false; + } + _xmlNode* plugin_lang_val = plugin_lang_node->children; + if (plugin_lang_val == NULL) { + DLOG(WARNING) << "Invalid plugin language"; + NOTREACHED(); + return false; + } + _xmlNode* plugin_name_node = plugin_lang_node->next->next; + if ((plugin_name_node == NULL) || + (plugin_name_node->next == NULL)) { + DLOG(WARNING) << "Failed to find plugin name node"; + NOTREACHED(); + return false; + } + _xmlNode* plugin_name_val = plugin_name_node->children; + if (plugin_name_val == NULL) { + DLOG(WARNING) << "Invalid plugin name"; + NOTREACHED(); + return false; + } + _xmlNode* plugin_download_url_node = plugin_name_node->next->next; + if (plugin_download_url_node == NULL) { + DLOG(WARNING) << "Failed to find plugin URL node"; + NOTREACHED(); + return false; + } + _xmlNode* plugin_download_url_val = plugin_download_url_node->children; + if (plugin_download_url_val == NULL) { + DLOG(WARNING) << "Invalid plugin URL"; + NOTREACHED(); + return false; + } + + // Look for the DisplayUrl node. By default every URL is treated as an + // executable URL. + plugin_detail->download_url_for_display = false; + + _xmlNode* plugin_download_url_for_display_node = + plugin_download_url_node->next->next; + if (plugin_download_url_for_display_node) { + _xmlNode* url_for_display_val = + plugin_download_url_for_display_node->children; + if (url_for_display_val) { + int url_for_display = 0; + StringToInt(reinterpret_cast<const char*>(url_for_display_val->content), + &url_for_display); + if (url_for_display != 0) + plugin_detail->download_url_for_display = true; + } + } + + plugin_detail->display_name = + UTF8ToWide(reinterpret_cast<const char*>(plugin_name_val->content)); + plugin_detail->download_url = + reinterpret_cast<const char*>(plugin_download_url_val->content); + + SplitString(reinterpret_cast<const char*>(plugin_mime_type_vals->content), + kMimeTypeSeparator, &plugin_detail->mime_types); + + plugin_detail->language = + reinterpret_cast<const char*>(plugin_lang_val->content); + + return true; +} diff --git a/webkit/default_plugin/plugin_database_handler.h b/webkit/default_plugin/plugin_database_handler.h new file mode 100644 index 0000000..ae83a28 --- /dev/null +++ b/webkit/default_plugin/plugin_database_handler.h @@ -0,0 +1,156 @@ +// Copyright (c) 2006-2008 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. + +#ifndef WEBKIT_DEFAULT_PLUGIN_PLUGIN_DATABASE_HANDLER_H +#define WEBKIT_DEFAULT_PLUGIN_PLUGIN_DATABASE_HANDLER_H + +#include <windows.h> +#include <string> +#include <vector> + +#include "base/basictypes.h" +#include "third_party/npapi/bindings/npapi.h" + +// Individual plugin details +struct PluginDetail { + // List of mime types supported by the plugin. + std::vector<std::string> mime_types; + // The URL where the plugin can be downloaded from. + std::string download_url; + // The display name for the plugin. + std::wstring display_name; + // Language of the plugin installer. (en-us, etc). + std::string language; + // Indicates if the download URL points to an exe or to a URL which + // needs to be displayed in a tab. + bool download_url_for_display; +}; + +typedef std::vector<PluginDetail> PluginList; + +class PluginInstallerImpl; +struct _xmlNode; + +// This class handles download of the plugins database file from the plugin +// finder URL passed in. It also provides functionality to parse the plugins +// file and to locate the desired plugin mime type in the parsed plugin list. +// The format of the plugins databse file is as below:- +// <plugins> +// <plugin> +// <mime_types> </mime_types> (semicolon separated list of mime types +// supported by the plugin) +// <lang> </lang> (Supported language) +// <url> </url> (Link to the plugin installer) +// <displayurl> 0 </displayurl> (Indicates if the URL is a display URL. +// defaults to 0. +// </plugin> +// <plugin> +// </plugins> +class PluginDatabaseHandler { + public: + // plugin_installer_instance is a reference maintained to the current + // PluginInstallerImpl instance. + explicit PluginDatabaseHandler( + PluginInstallerImpl& plugin_installer_instance); + + virtual ~PluginDatabaseHandler(); + + // Downloads the plugins database file if needed. + // + // Parameters: + // plugin_finder_url + // Specifies the http/https location of the chrome plugin finder. + // Returns true on success. + bool DownloadPluginsFileIfNeeded(const std::string& plugin_finder_url); + + // Writes data to the plugins database file. + // + // Parameters: + // stream + // Pointer to the current stream. + // offset + // Indicates the data offset. + // buffer_length + // Specifies the length of the data buffer. + // buffer + // Pointer to the actual buffer. + // Returns the number of bytes actually written, 0 on error. + int32 Write(NPStream* stream, int32 offset, int32 buffer_length, + void* buffer); + + const std::wstring& plugins_file() const { + return plugins_file_; + } + + // Parses the XML file containing the list of available third-party + // plugins and adds them to a list. + // Returns true on success + bool ParsePluginList(); + + // Returns the plugin details for the third party plugin mime type passed in. + // + // Parameters: + // mime_type + // Specifies the mime type of the desired third party plugin. + // language + // Specifies the desired plugin language. + // download_url + // Output parameter which contans the plugin download URL on success. + // display_name + // Output parameter which contains the display name of the plugin on + // success. + // download_url_for_display + // Output parameter which indicates if the plugin URL points to an exe + // or not. + // Returns true if the plugin details were found. + bool GetPluginDetailsForMimeType(const char* mime_type, + const char* language, + std::string* download_url, + std::wstring* display_name, + bool* download_url_for_display); + + // Closes the handle to the plugin database file. + // + // Parameters: + // delete_file + // Indicates if the plugin database file should be deleted. + void Close(bool delete_file); + + protected: + // Reads plugin information off an individual XML node. + // + // Parameters: + // plugin_node + // Pointer to the plugin XML node. + // plugin_detail + // Output parameter which contains the details of the plugin on success. + // Returns true on success. + bool ReadPluginInfo(_xmlNode* plugin_node, PluginDetail* plugin_detail); + + private: + // Contains the full path of the downloaded plugins file containing + // information about available third party plugin downloads. + std::wstring plugins_file_; + // Handle to the downloaded plugins file. + HANDLE plugin_downloads_file_; + // List of downloaded plugins. This is generated the first time the + // plugins file is downloaded and parsed. Each item in the list is + // of the type PluginDetail, and contains information about the third + // party plugin like it's mime type, download link, etc. + PluginList downloaded_plugins_list_; + // We maintain a reference to the PluginInstallerImpl instance to be able + // to achieve plugin installer state changes and to notify the instance + // about download completions. + PluginInstallerImpl& plugin_installer_instance_; + // The plugin finder url + std::string plugin_finder_url_; + // Set if the current instance should ignore plugin data. This is required + // if multiple null plugin instances attempt to download the plugin + // database. In this case the first instance to create the plugins database + // file locally writes to the file. The remaining instances ignore the + // downloaded data. + bool ignore_plugin_db_data_; +}; + +#endif // WEBKIT_DEFAULT_PLUGIN_PLUGIN_DATABASE_DOWNLOAD_HANDLER_H diff --git a/webkit/default_plugin/plugin_impl.h b/webkit/default_plugin/plugin_impl.h new file mode 100644 index 0000000..723cb05 --- /dev/null +++ b/webkit/default_plugin/plugin_impl.h @@ -0,0 +1,11 @@ +// Copyright (c) 2009 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. + +#if defined(OS_WIN) +#include "webkit/default_plugin/plugin_impl_win.h" +#elif defined(OS_MACOSX) +#include "webkit/default_plugin/plugin_impl_mac.h" +#elif defined(TOOLKIT_USES_GTK) +#include "webkit/default_plugin/plugin_impl_gtk.h" +#endif diff --git a/webkit/default_plugin/plugin_impl_gtk.cc b/webkit/default_plugin/plugin_impl_gtk.cc new file mode 100644 index 0000000..cfc599a --- /dev/null +++ b/webkit/default_plugin/plugin_impl_gtk.cc @@ -0,0 +1,139 @@ +// Copyright (c) 2010 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/default_plugin/plugin_impl_gtk.h" + +#include <gdk/gdkx.h> + +#include "base/file_util.h" +#include "base/path_service.h" +#include "base/string_util.h" +#include "googleurl/src/gurl.h" +#include "grit/webkit_strings.h" +#include "unicode/locid.h" +#include "webkit/default_plugin/default_plugin_shared.h" +#include "webkit/default_plugin/plugin_main.h" +#include "webkit/glue/webkit_glue.h" + +// TODO(thakis): Most methods in this class are stubbed out an need to be +// implemented. + +PluginInstallerImpl::PluginInstallerImpl(int16 mode) + : container_(NULL) { +} + +PluginInstallerImpl::~PluginInstallerImpl() { + if (container_) + gtk_widget_destroy(container_); +} + +bool PluginInstallerImpl::Initialize(void* module_handle, NPP instance, + NPMIMEType mime_type, int16 argc, + char* argn[], char* argv[]) { + DLOG(INFO) << __FUNCTION__ << " MIME Type : " << mime_type; + DCHECK(instance != NULL); + + if (mime_type == NULL || strlen(mime_type) == 0) { + DLOG(WARNING) << __FUNCTION__ << " Invalid parameters passed in"; + NOTREACHED(); + return false; + } + + instance_ = instance; + mime_type_ = mime_type; + + return true; +} + +bool PluginInstallerImpl::NPP_SetWindow(NPWindow* window_info) { + if (container_) + gtk_widget_destroy(container_); + container_ = gtk_plug_new(reinterpret_cast<XID>(window_info->window)); + + // Add label. + GtkWidget* box = gtk_vbox_new(FALSE, 0); + GtkWidget* label = gtk_label_new("Missing Plug-in"); + gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 0); + gtk_container_add(GTK_CONTAINER(container_), box); + + gtk_widget_show_all(container_); + + return true; +} + +void PluginInstallerImpl::Shutdown() { +} + +void PluginInstallerImpl::NewStream(NPStream* stream) { + plugin_install_stream_ = stream; +} + +void PluginInstallerImpl::DestroyStream(NPStream* stream, NPError reason) { + if (stream == plugin_install_stream_) + plugin_install_stream_ = NULL; +} + +bool PluginInstallerImpl::WriteReady(NPStream* stream) { + bool ready_to_accept_data = false; + return ready_to_accept_data; +} + +int32 PluginInstallerImpl::Write(NPStream* stream, int32 offset, + int32 buffer_length, void* buffer) { + return true; +} + +void PluginInstallerImpl::ClearDisplay() { +} + +void PluginInstallerImpl::RefreshDisplay() { +} + +bool PluginInstallerImpl::CreateToolTip() { + return true; +} + +void PluginInstallerImpl::UpdateToolTip() { +} + +void PluginInstallerImpl::DisplayAvailablePluginStatus() { +} + +void PluginInstallerImpl::DisplayStatus(int message_resource_id) { +} + +void PluginInstallerImpl::DisplayPluginDownloadFailedStatus() { +} + +void PluginInstallerImpl::URLNotify(const char* url, NPReason reason) { +} + +int16 PluginInstallerImpl::NPP_HandleEvent(void* event) { + return 0; +} + +std::wstring PluginInstallerImpl::ReplaceStringForPossibleEmptyReplacement( + int message_id_with_placeholders, + int messsage_id_without_placeholders, + const std::wstring& replacement_string) { + return L""; +} + +void PluginInstallerImpl::DownloadPlugin() { +} + +void PluginInstallerImpl::DownloadCancelled() { + DisplayAvailablePluginStatus(); +} + +void PluginInstallerImpl::ShowInstallDialog() { +} + +void PluginInstallerImpl::NotifyPluginStatus(int status) { + default_plugin::g_browser->getvalue( + instance_, + static_cast<NPNVariable>( + default_plugin::kMissingPluginStatusStart + status), + NULL); +} diff --git a/webkit/default_plugin/plugin_impl_gtk.h b/webkit/default_plugin/plugin_impl_gtk.h new file mode 100644 index 0000000..7e2113be --- /dev/null +++ b/webkit/default_plugin/plugin_impl_gtk.h @@ -0,0 +1,283 @@ +// Copyright (c) 2010 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. + +#ifndef WEBKIT_DEFAULT_PLUGIN_PLUGIN_IMPL_GTK_H_ +#define WEBKIT_DEFAULT_PLUGIN_PLUGIN_IMPL_GTK_H_ + +#include <string> +#include <vector> + +#include <gtk/gtk.h> + +#include "gfx/native_widget_types.h" +#include "third_party/npapi/bindings/npapi.h" + +// Possible plugin installer states. +enum PluginInstallerState { + PluginInstallerStateUndefined, + PluginListDownloadInitiated, + PluginListDownloaded, + PluginListDownloadedPluginNotFound, + PluginListDownloadFailed, + PluginDownloadInitiated, + PluginDownloadCompleted, + PluginDownloadFailed, + PluginInstallerLaunchSuccess, + PluginInstallerLaunchFailure +}; + +class PluginInstallDialog; +class PluginDatabaseHandler; + +// Provides the plugin installation functionality. This class is +// instantiated with the information like the mime type of the +// target plugin, the display mode, etc. +class PluginInstallerImpl { + public: + // mode is the plugin instantiation mode, i.e. whether it is a full + // page plugin (NP_FULL) or an embedded plugin (NP_EMBED) + explicit PluginInstallerImpl(int16 mode); + virtual ~PluginInstallerImpl(); + + // Initializes the plugin with the instance information, mime type + // and the list of parameters passed down to the plugin from the webpage. + // + // Parameters: + // module_handle + // The handle to the dll in which this object is instantiated. + // instance + // The plugins opaque instance handle. + // mime_type + // Identifies the third party plugin which would be eventually installed. + // argc + // Indicates the count of arguments passed in from the webpage. + // argv + // Pointer to the arguments. + // Returns true on success. + bool Initialize(void* module_handle, NPP instance, NPMIMEType mime_type, + int16 argc, char* argn[], char* argv[]); + + // Informs the plugin of its window information. + // + // Parameters: + // window_info + // The window info passed to npapi. + bool NPP_SetWindow(NPWindow* window_info); + + // Destroys the install dialog. + void Shutdown(); + + // Starts plugin download. Spawns the plugin installer after it is + // downloaded. + void DownloadPlugin(); + + // Indicates that the plugin download was cancelled. + void DownloadCancelled(); + + // Initializes the plugin download stream. + // + // Parameters: + // stream + // Pointer to the new stream being created. + void NewStream(NPStream* stream); + + // Uninitializes the plugin download stream. + // + // Parameters: + // stream + // Pointer to the stream being destroyed. + // reason + // Indicates why the stream is being destroyed. + // + void DestroyStream(NPStream* stream, NPError reason); + + // Determines whether the plugin is ready to accept data. + // We only accept data when we have initiated a download for the plugin + // database. + // + // Parameters: + // stream + // Pointer to the stream being destroyed. + // Returns true if the plugin is ready to accept data. + bool WriteReady(NPStream* stream); + + // Delivers data to the plugin instance. + // + // Parameters: + // stream + // Pointer to the stream being destroyed. + // offset + // Indicates the data offset. + // buffer_length + // Indicates the length of the data buffer. + // buffer + // Pointer to the actual buffer. + // Returns the number of bytes actually written, 0 on error. + int32 Write(NPStream* stream, int32 offset, int32 buffer_length, + void* buffer); + + // Handles notifications received in response to GetURLNotify calls issued + // by the plugin. + // + // Parameters: + // url + // Pointer to the URL. + // reason + // Describes why the notification was sent. + void URLNotify(const char* url, NPReason reason); + + // Used by the renderer to indicate plugin install through the infobar. + int16 NPP_HandleEvent(void* event); + + const std::string& mime_type() const { return mime_type_; } + + // Replaces a resource string with the placeholder passed in as an argument + // + // Parameters: + // message_id_with_placeholders + // The resource id of the string with placeholders. This is only used if + // the placeholder string (the replacement_string) parameter is valid. + // message_id_without_placeholders + // The resource id of the string to be returned if the placeholder is + // empty. + // replacement_string + // The placeholder which replaces tokens in the string identified by + // resource id message_id_with_placeholders. + // Returns a string which has the placeholders replaced, or the string + // without placeholders. + static std::wstring ReplaceStringForPossibleEmptyReplacement( + int message_id_with_placeholders, int message_id_without_placeholders, + const std::wstring& replacement_string); + + // Setter/getter combination to set and retreieve the current + // state of the plugin installer. + void set_plugin_installer_state(PluginInstallerState new_state) { + plugin_installer_state_ = new_state; + } + + PluginInstallerState plugin_installer_state() const { + return plugin_installer_state_; + } + + // Getter for the NPP instance member. + const NPP instance() const { + return instance_; + } + + // Returns whether or not the UI layout is right-to-left (such as Hebrew or + // Arabic). + bool IsRTLLayout() const; + + protected: + // Displays the plugin install confirmation dialog. + void ShowInstallDialog(); + + // Clears the current display state. + void ClearDisplay(); + + // Displays the status message identified by the message resource id + // passed in. + // + // Parameters: + // message_resource_id parameter + // The resource id of the message to be displayed. + void DisplayStatus(int message_resource_id); + + // Displays status information for the third party plugin which is needed + // by the page. + void DisplayAvailablePluginStatus(); + + // Displays information related to third party plugin download failure. + void DisplayPluginDownloadFailedStatus(); + + // Enables the plugin window if required and initiates an update of the + // the plugin window. + void RefreshDisplay(); + + // Create tooltip window. + bool CreateToolTip(); + + // Update ToolTip text with the message shown inside the default plugin. + void UpdateToolTip(); + + // Resolves the relative URL (could be already an absolute URL too) to return + // full URL based on current document's URL and base. + // + // Parameters: + // instance + // The plugins opaque instance handle. + // relative_url + // The URL to be resolved. + // Returns the resolved URL. + std::string ResolveURL(NPP instance, const std::string& relative_url); + + // Initializes resources like the icon, fonts, etc needed by the plugin + // installer + // + // Parameters: + // module_handle + // Handle to the dll in which this object is instantiated. + // Returns true on success. + bool InitializeResources(void *module_handle); + + // Parses the plugin instantiation arguments. This includes checking for + // whether this is an activex install and reading the appropriate + // arguments like codebase, etc. For plugin installs we download the + // plugin finder URL and initalize the mime type and the plugin instance + // info. + // + // Parameters: + // module_handle + // The handle to the dll in which this object is instantiated. + // instance + // The plugins opaque instance handle. + // mime_type + // Identifies the third party plugin which would be eventually installed. + // argc + // Indicates the count of arguments passed in from the webpage. + // argv + // Pointer to the arguments. + // raw_activex_clsid + // Output parameter which contains the CLSID of the Activex plugin needed. + // This is only applicable if the webpage specifically requests an ActiveX + // control. + // Returns true on success. + bool ParseInstantiationArguments(NPMIMEType mime_type, NPP instance, + int16 argc, char* argn[], char* argv[], + std::string* raw_activex_clsid); + + // Paints user action messages to the plugin window. These include messages + // like whether the user should click on the plugin window to download the + // plugin, etc. + // + // Parameters: + // paint_dc + // The device context returned in BeginPaint. + // x_origin + // Horizontal reference point indicating where the text is to be displayed. + // y_origin + // Vertical reference point indicating where the text is to be displayed. + // + void PaintUserActionInformation(gfx::NativeDrawingContext paint_dc, + int x_origin, int y_origin); + + private: + // Notify the renderer that plugin is available to download. + void NotifyPluginStatus(int status); + + // The plugins opaque instance handle + NPP instance_; + // The current stream. + NPStream* plugin_install_stream_; + // The desired mime type. + std::string mime_type_; + // The current state of the plugin installer. + PluginInstallerState plugin_installer_state_; + // GtkPlug containing everything in the plugin. + GtkWidget* container_; + + DISALLOW_COPY_AND_ASSIGN(PluginInstallerImpl); +}; + +#endif // WEBKIT_DEFAULT_PLUGIN_PLUGIN_IMPL_GTK_H_ diff --git a/webkit/default_plugin/plugin_impl_mac.h b/webkit/default_plugin/plugin_impl_mac.h new file mode 100644 index 0000000..dad298e --- /dev/null +++ b/webkit/default_plugin/plugin_impl_mac.h @@ -0,0 +1,285 @@ +// Copyright (c) 2010 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. + +#ifndef WEBKIT_DEFAULT_PLUGIN_PLUGIN_IMPL_MAC_H_ +#define WEBKIT_DEFAULT_PLUGIN_PLUGIN_IMPL_MAC_H_ + +#include <string> +#include <vector> + +#include "gfx/native_widget_types.h" +#include "third_party/npapi/bindings/npapi.h" + +// Possible plugin installer states. +enum PluginInstallerState { + PluginInstallerStateUndefined, + PluginListDownloadInitiated, + PluginListDownloaded, + PluginListDownloadedPluginNotFound, + PluginListDownloadFailed, + PluginDownloadInitiated, + PluginDownloadCompleted, + PluginDownloadFailed, + PluginInstallerLaunchSuccess, + PluginInstallerLaunchFailure +}; + +class PluginInstallDialog; +class PluginDatabaseHandler; + +// Provides the plugin installation functionality. This class is +// instantiated with the information like the mime type of the +// target plugin, the display mode, etc. +class PluginInstallerImpl { + public: + // mode is the plugin instantiation mode, i.e. whether it is a full + // page plugin (NP_FULL) or an embedded plugin (NP_EMBED) + explicit PluginInstallerImpl(int16 mode); + virtual ~PluginInstallerImpl(); + + // Initializes the plugin with the instance information, mime type + // and the list of parameters passed down to the plugin from the webpage. + // + // Parameters: + // module_handle + // The handle to the dll in which this object is instantiated. + // instance + // The plugins opaque instance handle. + // mime_type + // Identifies the third party plugin which would be eventually installed. + // argc + // Indicates the count of arguments passed in from the webpage. + // argv + // Pointer to the arguments. + // Returns true on success. + bool Initialize(void* module_handle, NPP instance, NPMIMEType mime_type, + int16 argc, char* argn[], char* argv[]); + + // Informs the plugin of its window information. + // + // Parameters: + // window_info + // The window info passed to npapi. + bool NPP_SetWindow(NPWindow* window_info); + + // Destroys the install dialog. + void Shutdown(); + + // Starts plugin download. Spawns the plugin installer after it is + // downloaded. + void DownloadPlugin(); + + // Indicates that the plugin download was cancelled. + void DownloadCancelled(); + + // Initializes the plugin download stream. + // + // Parameters: + // stream + // Pointer to the new stream being created. + void NewStream(NPStream* stream); + + // Uninitializes the plugin download stream. + // + // Parameters: + // stream + // Pointer to the stream being destroyed. + // reason + // Indicates why the stream is being destroyed. + // + void DestroyStream(NPStream* stream, NPError reason); + + // Determines whether the plugin is ready to accept data. + // We only accept data when we have initiated a download for the plugin + // database. + // + // Parameters: + // stream + // Pointer to the stream being destroyed. + // Returns true if the plugin is ready to accept data. + bool WriteReady(NPStream* stream); + + // Delivers data to the plugin instance. + // + // Parameters: + // stream + // Pointer to the stream being destroyed. + // offset + // Indicates the data offset. + // buffer_length + // Indicates the length of the data buffer. + // buffer + // Pointer to the actual buffer. + // Returns the number of bytes actually written, 0 on error. + int32 Write(NPStream* stream, int32 offset, int32 buffer_length, + void* buffer); + + // Handles notifications received in response to GetURLNotify calls issued + // by the plugin. + // + // Parameters: + // url + // Pointer to the URL. + // reason + // Describes why the notification was sent. + void URLNotify(const char* url, NPReason reason); + + // Used by the renderer to indicate plugin install through the infobar. + int16 NPP_HandleEvent(void* event); + + const std::string& mime_type() const { return mime_type_; } + + // Replaces a resource string with the placeholder passed in as an argument + // + // Parameters: + // message_id_with_placeholders + // The resource id of the string with placeholders. This is only used if + // the placeholder string (the replacement_string) parameter is valid. + // message_id_without_placeholders + // The resource id of the string to be returned if the placeholder is + // empty. + // replacement_string + // The placeholder which replaces tokens in the string identified by + // resource id message_id_with_placeholders. + // Returns a string which has the placeholders replaced, or the string + // without placeholders. + static std::wstring ReplaceStringForPossibleEmptyReplacement( + int message_id_with_placeholders, int message_id_without_placeholders, + const std::wstring& replacement_string); + + // Setter/getter combination to set and retreieve the current + // state of the plugin installer. + void set_plugin_installer_state(PluginInstallerState new_state) { + plugin_installer_state_ = new_state; + } + + PluginInstallerState plugin_installer_state() const { + return plugin_installer_state_; + } + + // Getter for the NPP instance member. + const NPP instance() const { + return instance_; + } + + // Returns whether or not the UI layout is right-to-left (such as Hebrew or + // Arabic). + bool IsRTLLayout() const; + + protected: + int16 OnDrawRect(CGContextRef context, CGRect dirty_rect); + + // Displays the plugin install confirmation dialog. + void ShowInstallDialog(); + + // Clears the current display state. + void ClearDisplay(); + + // Displays the status message identified by the message resource id + // passed in. + // + // Parameters: + // message_resource_id parameter + // The resource id of the message to be displayed. + void DisplayStatus(int message_resource_id); + + // Displays status information for the third party plugin which is needed + // by the page. + void DisplayAvailablePluginStatus(); + + // Displays information related to third party plugin download failure. + void DisplayPluginDownloadFailedStatus(); + + // Enables the plugin window if required and initiates an update of the + // the plugin window. + void RefreshDisplay(); + + // Create tooltip window. + bool CreateToolTip(); + + // Update ToolTip text with the message shown inside the default plugin. + void UpdateToolTip(); + + // Resolves the relative URL (could be already an absolute URL too) to return + // full URL based on current document's URL and base. + // + // Parameters: + // instance + // The plugins opaque instance handle. + // relative_url + // The URL to be resolved. + // Returns the resolved URL. + std::string ResolveURL(NPP instance, const std::string& relative_url); + + // Initializes resources like the icon, fonts, etc needed by the plugin + // installer + // + // Parameters: + // module_handle + // Handle to the dll in which this object is instantiated. + // Returns true on success. + bool InitializeResources(void *module_handle); + + // Parses the plugin instantiation arguments. This includes checking for + // whether this is an activex install and reading the appropriate + // arguments like codebase, etc. For plugin installs we download the + // plugin finder URL and initalize the mime type and the plugin instance + // info. + // + // Parameters: + // module_handle + // The handle to the dll in which this object is instantiated. + // instance + // The plugins opaque instance handle. + // mime_type + // Identifies the third party plugin which would be eventually installed. + // argc + // Indicates the count of arguments passed in from the webpage. + // argv + // Pointer to the arguments. + // raw_activex_clsid + // Output parameter which contains the CLSID of the Activex plugin needed. + // This is only applicable if the webpage specifically requests an ActiveX + // control. + // Returns true on success. + bool ParseInstantiationArguments(NPMIMEType mime_type, NPP instance, + int16 argc, char* argn[], char* argv[], + std::string* raw_activex_clsid); + + // Paints user action messages to the plugin window. These include messages + // like whether the user should click on the plugin window to download the + // plugin, etc. + // + // Parameters: + // paint_dc + // The device context returned in BeginPaint. + // x_origin + // Horizontal reference point indicating where the text is to be displayed. + // y_origin + // Vertical reference point indicating where the text is to be displayed. + // + void PaintUserActionInformation(gfx::NativeDrawingContext paint_dc, + int x_origin, int y_origin); + + private: + // Notify the renderer that plugin is available to download. + void NotifyPluginStatus(int status); + + // The plugins opaque instance handle + NPP instance_; + // The current stream. + NPStream* plugin_install_stream_; + // The desired mime type. + std::string mime_type_; + // The current state of the plugin installer. + PluginInstallerState plugin_installer_state_; + // Dimensions of the plugin + uint32_t width_; + uint32_t height_; + + DISALLOW_COPY_AND_ASSIGN(PluginInstallerImpl); +}; + + +#endif // WEBKIT_DEFAULT_PLUGIN_PLUGIN_IMPL_MAC_H_ diff --git a/webkit/default_plugin/plugin_impl_mac.mm b/webkit/default_plugin/plugin_impl_mac.mm new file mode 100644 index 0000000..dd3cac8 --- /dev/null +++ b/webkit/default_plugin/plugin_impl_mac.mm @@ -0,0 +1,179 @@ +// Copyright (c) 2006-2009 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/default_plugin/plugin_impl_mac.h" + +#import <Cocoa/Cocoa.h> + +#include "base/file_util.h" +#include "base/path_service.h" +#include "base/string_util.h" +#include "googleurl/src/gurl.h" +#include "grit/webkit_strings.h" +#include "unicode/locid.h" +#include "webkit/default_plugin/default_plugin_shared.h" +#include "webkit/default_plugin/plugin_main.h" +#include "webkit/glue/webkit_glue.h" + +// TODO(thakis): Most methods in this class are stubbed out and need to be +// implemented. + +PluginInstallerImpl::PluginInstallerImpl(int16 mode) { +} + +PluginInstallerImpl::~PluginInstallerImpl() { +} + +bool PluginInstallerImpl::Initialize(void* module_handle, NPP instance, + NPMIMEType mime_type, int16 argc, + char* argn[], char* argv[]) { + DLOG(INFO) << __FUNCTION__ << " MIME Type : " << mime_type; + DCHECK(instance != NULL); + + if (mime_type == NULL || strlen(mime_type) == 0) { + DLOG(WARNING) << __FUNCTION__ << " Invalid parameters passed in"; + NOTREACHED(); + return false; + } + + instance_ = instance; + mime_type_ = mime_type; + + return true; +} + +bool PluginInstallerImpl::NPP_SetWindow(NPWindow* window_info) { + width_ = window_info->width; + height_ = window_info->height; + return true; +} + +void PluginInstallerImpl::Shutdown() { +} + +void PluginInstallerImpl::NewStream(NPStream* stream) { + plugin_install_stream_ = stream; +} + +void PluginInstallerImpl::DestroyStream(NPStream* stream, NPError reason) { + if (stream == plugin_install_stream_) + plugin_install_stream_ = NULL; +} + +bool PluginInstallerImpl::WriteReady(NPStream* stream) { + bool ready_to_accept_data = false; + return ready_to_accept_data; +} + +int32 PluginInstallerImpl::Write(NPStream* stream, int32 offset, + int32 buffer_length, void* buffer) { + return true; +} + +void PluginInstallerImpl::ClearDisplay() { +} + +void PluginInstallerImpl::RefreshDisplay() { +} + +bool PluginInstallerImpl::CreateToolTip() { + return true; +} + +void PluginInstallerImpl::UpdateToolTip() { +} + +void PluginInstallerImpl::DisplayAvailablePluginStatus() { +} + +void PluginInstallerImpl::DisplayStatus(int message_resource_id) { +} + +void PluginInstallerImpl::DisplayPluginDownloadFailedStatus() { +} + +void PluginInstallerImpl::URLNotify(const char* url, NPReason reason) { +} + +int16 PluginInstallerImpl::NPP_HandleEvent(void* event) { + NPCocoaEvent* npp_event = static_cast<NPCocoaEvent*>(event); + + if (npp_event->type == NPCocoaEventDrawRect) { + CGContextRef context = npp_event->data.draw.context; + CGRect rect = CGRectMake(npp_event->data.draw.x, + npp_event->data.draw.y, + npp_event->data.draw.width, + npp_event->data.draw.height); + return OnDrawRect(context, rect); + } + return 0; +} + +std::wstring PluginInstallerImpl::ReplaceStringForPossibleEmptyReplacement( + int message_id_with_placeholders, + int messsage_id_without_placeholders, + const std::wstring& replacement_string) { + return L""; +} + +void PluginInstallerImpl::DownloadPlugin() { +} + +void PluginInstallerImpl::DownloadCancelled() { + DisplayAvailablePluginStatus(); +} + +int16 PluginInstallerImpl::OnDrawRect(CGContextRef context, CGRect dirty_rect) { + const NSString* text = @"Missing Plug-in"; + const float kTextMarginX = 6; + const float kTextMarginY = 1; + NSSize bounds = NSMakeSize(width_, height_); + + [NSGraphicsContext saveGraphicsState]; + NSGraphicsContext* ns_context = [NSGraphicsContext + graphicsContextWithGraphicsPort:context flipped:YES]; + [NSGraphicsContext setCurrentContext:ns_context]; + + NSShadow* shadow = [[[NSShadow alloc] init] autorelease]; + [shadow setShadowColor:[NSColor colorWithDeviceWhite:0.0 alpha:0.5]]; + [shadow setShadowOffset:NSMakeSize(0, -1)]; + NSFont* font = [NSFont boldSystemFontOfSize:[NSFont smallSystemFontSize]]; + NSDictionary* attributes = [NSDictionary dictionaryWithObjectsAndKeys: + font, NSFontAttributeName, + [NSColor whiteColor], NSForegroundColorAttributeName, + shadow, NSShadowAttributeName, + nil]; + + NSSize text_size = [text sizeWithAttributes:attributes]; + NSRect text_rect; + text_rect.size.width = text_size.width + 2*kTextMarginX; + text_rect.size.height = text_size.height + 2*kTextMarginY; + text_rect.origin.x = (bounds.width - NSWidth(text_rect))/2; + text_rect.origin.y = (bounds.height - NSHeight(text_rect))/2; + + [[NSColor colorWithCalibratedWhite:0.52 alpha:1.0] setFill]; + [[NSBezierPath bezierPathWithRoundedRect:text_rect + xRadius:NSHeight(text_rect)/2 + yRadius:NSHeight(text_rect)/2] fill]; + + NSPoint label_point = NSMakePoint( + roundf(text_rect.origin.x + (text_rect.size.width - text_size.width)/2), + roundf(text_rect.origin.y + (text_rect.size.height - text_size.height)/2)); + [text drawAtPoint:label_point withAttributes:attributes]; + + [NSGraphicsContext restoreGraphicsState]; + return 1; +} + + +void PluginInstallerImpl::ShowInstallDialog() { +} + +void PluginInstallerImpl::NotifyPluginStatus(int status) { + default_plugin::g_browser->getvalue( + instance_, + static_cast<NPNVariable>( + default_plugin::kMissingPluginStatusStart + status), + NULL); +} diff --git a/webkit/default_plugin/plugin_impl_win.cc b/webkit/default_plugin/plugin_impl_win.cc new file mode 100644 index 0000000..55b9164 --- /dev/null +++ b/webkit/default_plugin/plugin_impl_win.cc @@ -0,0 +1,646 @@ +// Copyright (c) 2010 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/default_plugin/plugin_impl_win.h" + +#include <shellapi.h> + +#include "base/file_util.h" +#include "base/path_service.h" +#include "base/string_util.h" +#include "googleurl/src/gurl.h" +#include "grit/webkit_strings.h" +#include "unicode/locid.h" +#include "webkit/default_plugin/default_plugin_shared.h" +#include "webkit/default_plugin/plugin_main.h" +#include "webkit/glue/webkit_glue.h" + +static const int TOOLTIP_MAX_WIDTH = 500; + +PluginInstallerImpl::PluginInstallerImpl(int16 mode) + : instance_(NULL), + mode_(mode), + plugin_install_stream_(NULL), + plugin_installer_state_(PluginInstallerStateUndefined), + install_dialog_(NULL), + enable_click_(false), + icon_(NULL), + bold_font_(NULL), + regular_font_(NULL), + underline_font_(NULL), + tooltip_(NULL), + installation_job_monitor_thread_( + new PluginInstallationJobMonitorThread()), + plugin_database_handler_(*this), + plugin_download_url_for_display_(false) { +} + +PluginInstallerImpl::~PluginInstallerImpl() { + installation_job_monitor_thread_->Stop(); + + if (bold_font_) + DeleteObject(bold_font_); + + if (underline_font_) + DeleteObject(underline_font_); + + if (tooltip_) + DestroyWindow(tooltip_); +} + +bool PluginInstallerImpl::Initialize(HINSTANCE module_handle, NPP instance, + NPMIMEType mime_type, int16 argc, + char* argn[], char* argv[]) { + DLOG(INFO) << __FUNCTION__ << " MIME Type : " << mime_type; + DCHECK(instance != NULL); + DCHECK(module_handle != NULL); + + if (mime_type == NULL || strlen(mime_type) == 0) { + DLOG(WARNING) << __FUNCTION__ << " Invalid parameters passed in"; + NOTREACHED(); + return false; + } + + instance_ = instance; + mime_type_ = mime_type; + + if (!webkit_glue::GetPluginFinderURL(&plugin_finder_url_)) { + NOTREACHED(); + DLOG(WARNING) << __FUNCTION__ << " Failed to get the plugin finder URL"; + return false; + } + + if (!installation_job_monitor_thread_->Initialize()) { + DLOG(ERROR) << "Failed to initialize plugin install job"; + NOTREACHED(); + return false; + } + + InitializeResources(module_handle); + + DisplayStatus(IDS_DEFAULT_PLUGIN_GET_PLUGIN_MSG_NO_PLUGIN_NAME); + plugin_database_handler_.DownloadPluginsFileIfNeeded(plugin_finder_url_); + + return true; +} + +void PluginInstallerImpl::Shutdown() { + if (install_dialog_) { + install_dialog_->RemoveInstaller(this); + install_dialog_ = NULL; + } + + if (IsWindow(hwnd())) { + DestroyWindow(hwnd()); + } +} + +void PluginInstallerImpl::NewStream(NPStream* stream) { + plugin_install_stream_ = stream; +} + +void PluginInstallerImpl::DestroyStream(NPStream* stream, NPError reason) { + if (stream == plugin_install_stream_) + plugin_install_stream_ = NULL; +} + +bool PluginInstallerImpl::WriteReady(NPStream* stream) { + bool ready_to_accept_data = false; + + if (plugin_installer_state() != PluginListDownloadInitiated) { + DCHECK(default_plugin::g_browser); + DCHECK(default_plugin::g_browser->destroystream); + // We don't want any data, kill the stream. + default_plugin::g_browser->destroystream(instance_, stream, NPRES_DONE); + } + if (0 == lstrcmpiA(stream->url, plugin_finder_url_.c_str())) { + ready_to_accept_data = true; + } + return ready_to_accept_data; +} + +int32 PluginInstallerImpl::Write(NPStream* stream, int32 offset, + int32 buffer_length, void* buffer) { + if (plugin_installer_state() != PluginListDownloadInitiated) { + DCHECK(default_plugin::g_browser); + DCHECK(default_plugin::g_browser->destroystream); + // We don't want any data, kill the stream. + default_plugin::g_browser->destroystream(instance_, stream, NPRES_DONE); + return 0; + } + + return plugin_database_handler_.Write(stream, offset, buffer_length, buffer); +} + +void PluginInstallerImpl::ClearDisplay() { + enable_click_ = false; + command_.clear(); + optional_additional_message_.clear(); + get_plugin_link_message_.clear(); +} + +void PluginInstallerImpl::RefreshDisplay() { + if (!IsWindow(hwnd())) + return; + UpdateToolTip(); + + InvalidateRect(hwnd(), NULL, TRUE); + UpdateWindow(hwnd()); +} + +bool PluginInstallerImpl::CreateToolTip() { + DWORD ex_styles = IsRTLLayout() ? WS_EX_LAYOUTRTL : 0; + tooltip_ = CreateWindowEx(ex_styles, TOOLTIPS_CLASS, NULL, + WS_POPUP | TTS_ALWAYSTIP, + CW_USEDEFAULT, CW_USEDEFAULT, + CW_USEDEFAULT, CW_USEDEFAULT, + hwnd(), NULL, NULL, NULL); + if (!tooltip_) + return false; + + // Associate the ToolTip with the tool. + TOOLINFO tool_info = {0}; + tool_info.cbSize = sizeof(tool_info); + tool_info.hwnd = hwnd(); + tool_info.uFlags = TTF_IDISHWND | TTF_SUBCLASS; + tool_info.uId = reinterpret_cast<UINT_PTR>(hwnd()); + tool_info.lpszText = NULL; + SendMessage(tooltip_, TTM_ADDTOOL, 0, reinterpret_cast<LPARAM>(&tool_info)); + SendMessage(tooltip_, TTM_SETMAXTIPWIDTH, 0, TOOLTIP_MAX_WIDTH); + return true; +} + +void PluginInstallerImpl::UpdateToolTip() { + if (tooltip_ == NULL) + return; + std::wstring tip = command_; + if (!optional_additional_message_.empty()) + tip += std::wstring(L"\n\r") + optional_additional_message_; + + TOOLINFO tool_info = {0}; + tool_info.cbSize = sizeof(tool_info); + tool_info.hwnd = hwnd(); + tool_info.uFlags = TTF_IDISHWND; + tool_info.uId = reinterpret_cast<UINT_PTR>(hwnd()); + tool_info.lpszText = const_cast<LPWSTR>(tip.c_str()); + SendMessage(tooltip_, TTM_UPDATETIPTEXT, 0, (LPARAM)&tool_info); +} + +void PluginInstallerImpl::DisplayAvailablePluginStatus() { + ClearDisplay(); + enable_click_ = true; + command_ = ReplaceStringForPossibleEmptyReplacement( + IDS_DEFAULT_PLUGIN_GET_PLUGIN_MSG, + IDS_DEFAULT_PLUGIN_GET_PLUGIN_MSG_NO_PLUGIN_NAME, + plugin_name_); + optional_additional_message_ = + webkit_glue::GetLocalizedString(IDS_DEFAULT_PLUGIN_GET_PLUGIN_MSG_2); + get_plugin_link_message_ = webkit_glue::GetLocalizedString( + IDS_DEFAULT_PLUGIN_GET_THE_PLUGIN_BTN_MSG); + RefreshDisplay(); +} + +void PluginInstallerImpl::DisplayStatus(int message_resource_id) { + ClearDisplay(); + command_ = + webkit_glue::GetLocalizedString(message_resource_id); + RefreshDisplay(); +} + +void PluginInstallerImpl::DisplayPluginDownloadFailedStatus() { + ClearDisplay(); + command_ = webkit_glue::GetLocalizedString( + IDS_DEFAULT_PLUGIN_DOWNLOAD_FAILED_MSG); + command_ = ReplaceStringPlaceholders( + command_, + ASCIIToWide(plugin_download_url_), + NULL); + RefreshDisplay(); +} + +void PluginInstallerImpl::URLNotify(const char* url, NPReason reason) { + DCHECK(plugin_installer_state_ == PluginListDownloadInitiated); + + if (plugin_installer_state_ == PluginListDownloadInitiated) { + bool plugin_available = false; + if (reason == NPRES_DONE) { + DLOG(INFO) << "Received Done notification for plugin list download"; + plugin_database_handler_.ParsePluginList(); + if (plugin_database_handler_.GetPluginDetailsForMimeType( + mime_type_.c_str(), desired_language_.c_str(), + &plugin_download_url_, &plugin_name_, + &plugin_download_url_for_display_)) { + plugin_available = true; + install_dialog_ = PluginInstallDialog::AddInstaller(this, plugin_name_); + set_plugin_installer_state(PluginListDownloaded); + } else { + set_plugin_installer_state(PluginListDownloadedPluginNotFound); + } + + plugin_database_handler_.Close(false); + } else { + DLOG(WARNING) << "Failed to download plugin list"; + set_plugin_installer_state(PluginListDownloadFailed); + + plugin_database_handler_.Close(true); + } + + if (plugin_available) { + DLOG(INFO) << "Plugin available for mime type " << mime_type_; + DisplayAvailablePluginStatus(); + NotifyPluginStatus(default_plugin::MISSING_PLUGIN_AVAILABLE); + } else { + DLOG(WARNING) << "No plugin available for mime type " << mime_type_; + DisplayStatus(IDS_DEFAULT_PLUGIN_NO_PLUGIN_AVAILABLE_MSG); + } + } +} + +int16 PluginInstallerImpl::NPP_HandleEvent(void* event) { + NPEvent* npp_event = static_cast<NPEvent*>(event); + if (npp_event->event == kInstallMissingPluginMessage) { + // We could get this message because InfoBar may not be in sync with our + // internal processing. So we need to check the status. + if (plugin_installer_state() == PluginListDownloaded) { + ShowInstallDialog(); + } + } + return 0; +} + +std::wstring PluginInstallerImpl::ReplaceStringForPossibleEmptyReplacement( + int message_id_with_placeholders, + int messsage_id_without_placeholders, + const std::wstring& replacement_string) { + // If the replacement_string is not empty, load the string identified by + // the resource id message_id_with_placeholders, and replace the + // placeholder with the replacement_string. Otherwise return the string + // identified by resource id messsage_id_without_placeholders. + if (replacement_string.empty()) { + return webkit_glue::GetLocalizedString(messsage_id_without_placeholders); + } else { + std::wstring string_with_placeholders = + webkit_glue::GetLocalizedString(message_id_with_placeholders); + return ReplaceStringPlaceholders(string_with_placeholders, + replacement_string, NULL); + } +} + +bool PluginInstallerImpl::NPP_SetWindow(NPWindow* window_info) { + HWND parent_window = reinterpret_cast<HWND>(window_info->window); + if (!IsWindow(parent_window)) { + // No window created yet. Ignore this call. + if (!IsWindow(hwnd())) + return true; + // Parent window has been destroyed. + Shutdown(); + return true; + } + + RECT parent_rect = {0}; + + if (IsWindow(hwnd())) { + GetClientRect(parent_window, &parent_rect); + SetWindowPos(hwnd(), NULL, parent_rect.left, parent_rect.top, + parent_rect.right - parent_rect.left, + parent_rect.bottom - parent_rect.top, SWP_SHOWWINDOW); + return true; + } + // First time in -- no window created by plugin yet. + GetClientRect(parent_window, &parent_rect); + set_window_style(WS_CHILD | WS_BORDER); + Init(parent_window, gfx::Rect(parent_rect)); + DCHECK(IsWindow(hwnd())); + installation_job_monitor_thread_->set_plugin_window(hwnd()); + + CreateToolTip(); + UpdateToolTip(); + + UpdateWindow(hwnd()); + ShowWindow(hwnd(), SW_SHOW); + + return true; +} + +void PluginInstallerImpl::DownloadPlugin() { + set_plugin_installer_state(PluginDownloadInitiated); + + DLOG(INFO) << "Initiating download for plugin URL " + << plugin_download_url_.c_str(); + + DisplayStatus(IDS_DEFAULT_PLUGIN_DOWNLOADING_PLUGIN_MSG); + + if (!plugin_download_url_for_display_) { + webkit_glue::DownloadUrl(plugin_download_url_, hwnd()); + } else { + default_plugin::g_browser->geturl(instance(), + plugin_download_url_.c_str(), + "_blank"); + set_plugin_installer_state(PluginInstallerLaunchSuccess); + DisplayStatus(IDS_DEFAULT_PLUGIN_REFRESH_PLUGIN_MSG); + enable_click_ = true; + RefreshDisplay(); + } +} + +void PluginInstallerImpl::DownloadCancelled() { + DisplayAvailablePluginStatus(); +} + +LRESULT PluginInstallerImpl::OnEraseBackGround(UINT message, WPARAM wparam, + LPARAM lparam, BOOL& handled) { + HDC paint_device_context = reinterpret_cast<HDC>(wparam); + RECT erase_rect = {0}; + GetClipBox(paint_device_context, &erase_rect); + HBRUSH brush = ::CreateSolidBrush(RGB(252, 235, 162)); + DCHECK(brush); + FillRect(paint_device_context, &erase_rect, brush); + DeleteObject(brush); + return 1; +} + +// Use ICU in order to determine whether the locale is right-to-left. +// +// TODO(idana) bug# 1246452: there is already code in +// app/l10n_util.h/cc that uses ICU to determine the locale direction. We don't +// currently use this code since code in WebKit should not depend on code in +// Chrome. We can fix this by pulling (at least part of) the l10n_util +// functionality up into the Base module. +bool PluginInstallerImpl::IsRTLLayout() { + const icu::Locale& locale = icu::Locale::getDefault(); + const char* lang = locale.getLanguage(); + + // Check only for Arabic and Hebrew languages for now. + if (strcmp(lang, "ar") == 0 || strcmp(lang, "he") == 0) { + return true; + } + return false; +} + +LRESULT PluginInstallerImpl::OnPaint(UINT message, WPARAM wparam, LPARAM lparam, + BOOL& handled) { + PAINTSTRUCT paint_struct = {0}; + BeginPaint(hwnd(), &paint_struct); + + int save_dc_context = SaveDC(paint_struct.hdc); + // The drawing order is as below:- + // 1. The Get plugin link at the top left corner. + // 2. The plugin icon. + // 3. The text describing user actions to the right of the icon. + SIZE get_plugin_link_extents = {0}; + HFONT old_font = + reinterpret_cast<HFONT>(SelectObject(paint_struct.hdc, regular_font_)); + + GetTextExtentPoint32(paint_struct.hdc, get_plugin_link_message_.c_str(), + static_cast<int>(get_plugin_link_message_.length()), + &get_plugin_link_extents); + + POINT device_point = {0}; + device_point.x = get_plugin_link_extents.cx; + device_point.y = get_plugin_link_extents.cy; + LPtoDP(paint_struct.hdc, &device_point, 1); + + RECT text_rect = {0}; + text_rect.left = 5; + text_rect.right = text_rect.left + device_point.x; + text_rect.top = 5; + text_rect.bottom = text_rect.top + device_point.y; + + RECT client_rect = {0}; + GetClientRect(hwnd(), &client_rect); + + int icon_width = GetSystemMetrics(SM_CXICON); + int icon_height = GetSystemMetrics(SM_CYICON); + + int x = (client_rect.right / 2) - icon_width / 2; + int y = (client_rect.bottom / 2) - icon_height / 2; + + DCHECK(icon_); + DrawIcon(paint_struct.hdc, x, y, icon_); + + int old_mode = SetBkMode(paint_struct.hdc, TRANSPARENT); + COLORREF old_color = SetTextColor(paint_struct.hdc, RGB(0, 0, 255)); + + // If the UI layout is right-to-left, we need to mirror the position of the + // link text and also make sure that the text is aligned to the right. + DWORD draw_text_flags = DT_VCENTER; + if (IsRTLLayout()) { + draw_text_flags |= DT_RTLREADING | DT_RIGHT; + int text_width = text_rect.right - text_rect.left; + int client_width = client_rect.right - client_rect.left; + text_rect.left = client_width - text_rect.left - text_width; + text_rect.right = text_rect.left + text_width; + } else { + draw_text_flags |= DT_LEFT; + } + + DrawText(paint_struct.hdc, get_plugin_link_message_.c_str(), + static_cast<int>(get_plugin_link_message_.length()), + &text_rect, draw_text_flags); + + SIZE command_extents = {0}; + GetTextExtentPoint32(paint_struct.hdc, command_.c_str(), + static_cast<int>(command_.length()), &command_extents); + + int y_origin = y + (icon_height) + 10; + int x_origin = x - command_extents.cx / 2 + icon_width / 2; + + // If the window is too small then no point in attempting to display plugin + // information. In any case this info is displayed when the user hovers + // over the plugin window. + int window_width = client_rect.right - client_rect.left; + int window_height = client_rect.bottom - client_rect.top; + + if ((x_origin + command_extents.cx <= window_width) && + (y_origin + command_extents.cy <= window_height)) { + PaintUserActionInformation(paint_struct.hdc, x_origin, y_origin); + } + + RestoreDC(paint_struct.hdc, save_dc_context); + EndPaint(hwnd(), &paint_struct); + return 0; +} + +void PluginInstallerImpl::PaintUserActionInformation(HDC paint_dc, + int x_origin, + int y_origin) { + SelectObject(paint_dc, regular_font_); + + SIZE command_extents = {0}; + GetTextExtentPoint32(paint_dc, command_.c_str(), + static_cast<int>(command_.length()), &command_extents); + POINT device_point = {0}; + device_point.x = command_extents.cx; + device_point.y = command_extents.cy; + LPtoDP(paint_dc, &device_point, 1); + + RECT text_rect = {0}; + text_rect.left = x_origin; + text_rect.right = text_rect.left + device_point.x; + text_rect.top = y_origin; + text_rect.bottom = text_rect.top + device_point.y; + + SetTextColor(paint_dc, RGB(0, 0, 0)); + + // Make sure we pass the right BiDi flags to DrawText if the UI layout is + // right-to-left. + UINT additional_dt_flags = IsRTLLayout() ? DT_RTLREADING : 0; + DrawText(paint_dc, command_.c_str(), + static_cast<int>(command_.length()), &text_rect, + DT_CENTER | DT_VCENTER | additional_dt_flags); + + if (!optional_additional_message_.empty()) { + SelectObject(paint_dc, regular_font_); + + SIZE optional_text_extents = {0}; + int optional_message_length = + static_cast<int>(optional_additional_message_.length()); + GetTextExtentPoint32(paint_dc, + optional_additional_message_.c_str(), + optional_message_length, + &optional_text_extents); + POINT device_point = {0}; + device_point.x = optional_text_extents.cx; + device_point.y = optional_text_extents.cy; + LPtoDP(paint_dc, &device_point, 1); + + text_rect.right = text_rect.left + device_point.x; + text_rect.top = y_origin + command_extents.cy + 2; + text_rect.bottom = text_rect.top + device_point.y; + + DrawText(paint_dc, optional_additional_message_.c_str(), + static_cast<int>(optional_additional_message_.length()), + &text_rect, DT_CENTER | DT_VCENTER | additional_dt_flags); + } +} + +void PluginInstallerImpl::ShowInstallDialog() { + enable_click_ = false; + install_dialog_->ShowInstallDialog(hwnd()); +} + +LRESULT PluginInstallerImpl::OnLButtonDown(UINT message, WPARAM wparam, + LPARAM lparam, BOOL& handled) { + if (!enable_click_) + return 0; + if (plugin_installer_state() == PluginListDownloaded) { + ShowInstallDialog(); + NotifyPluginStatus(default_plugin::MISSING_PLUGIN_USER_STARTED_DOWNLOAD); + } else if (plugin_installer_state_ == PluginInstallerLaunchSuccess) { + DCHECK(default_plugin::g_browser); + DCHECK(default_plugin::g_browser->geturl); + default_plugin::g_browser->geturl( + instance_, + "javascript:navigator.plugins.refresh(true)", + "_self"); + default_plugin::g_browser->geturl( + instance_, + "javascript:window.location.reload(true)", + "_self"); + } + + return 0; +} + +LRESULT PluginInstallerImpl::OnSetCursor(UINT message, WPARAM wparam, + LPARAM lparam, BOOL& handled) { + if (enable_click_) { + SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_HAND))); + return 1; + } + handled = FALSE; + return 0; +} + +LRESULT PluginInstallerImpl::OnRefreshPlugins(UINT message, WPARAM wparam, + LPARAM lparam, BOOL& handled) { + DCHECK(default_plugin::g_browser); + DCHECK(default_plugin::g_browser->geturl); + default_plugin::g_browser->geturl( + instance_, + "javascript:navigator.plugins.refresh(true)", + "_self"); + default_plugin::g_browser->geturl( + instance_, + "javascript:window.location.reload(true)", + "_self"); + return 0; +} + +LRESULT PluginInstallerImpl::OnCopyData(UINT message, WPARAM wparam, + LPARAM lparam, BOOL& handled) { + COPYDATASTRUCT* download_file_info = + reinterpret_cast<COPYDATASTRUCT*>(lparam); + if (!download_file_info || !download_file_info->dwData) { + DLOG(WARNING) << "Failed to download plugin"; + set_plugin_installer_state(PluginDownloadFailed); + DisplayPluginDownloadFailedStatus(); + } else { + DLOG(INFO) << "Successfully downloaded plugin installer"; + set_plugin_installer_state(PluginDownloadCompleted); + + std::wstring file_path = + reinterpret_cast<const wchar_t*>(download_file_info->lpData); + + FilePath current_directory = FilePath(file_path).DirName(); + + SHELLEXECUTEINFO shell_execute_info = {0}; + shell_execute_info.cbSize = sizeof(shell_execute_info); + shell_execute_info.fMask = SEE_MASK_NOCLOSEPROCESS; + shell_execute_info.lpFile = file_path.c_str(); + shell_execute_info.lpDirectory = current_directory.value().c_str(); + shell_execute_info.nShow = SW_SHOW; + + if (!ShellExecuteEx(&shell_execute_info)) { + DLOG(WARNING) << "Failed to launch plugin installer " + << file_path.c_str() << " Error " + << ::GetLastError(); + set_plugin_installer_state(PluginInstallerLaunchFailure); + DisplayStatus(IDS_DEFAULT_PLUGIN_INSTALLATION_FAILED_MSG); + NOTREACHED(); + } else { + DLOG(INFO) << "Successfully launched plugin installer"; + set_plugin_installer_state(PluginInstallerLaunchSuccess); + installation_job_monitor_thread_->AssignProcessToJob( + shell_execute_info.hProcess); + DisplayStatus(IDS_DEFAULT_PLUGIN_REFRESH_PLUGIN_MSG); + enable_click_ = true; + RefreshDisplay(); + } + } + return 0; +} + +bool PluginInstallerImpl::InitializeResources(HINSTANCE module_handle) { + DCHECK(icon_ == NULL); + DCHECK(regular_font_ == NULL); + DCHECK(bold_font_ == NULL); + DCHECK(underline_font_ == NULL); + + icon_ = LoadIcon(module_handle, MAKEINTRESOURCE(IDI_DEFAULT_PLUGIN_ICON)); + DCHECK(icon_ != NULL); + + desired_language_ = "en-us"; + regular_font_ = reinterpret_cast<HFONT>(GetStockObject(DEFAULT_GUI_FONT)); + DCHECK(regular_font_ != NULL); + + LOGFONT font_info = {0}; + GetObject(regular_font_, sizeof(LOGFONT), &font_info); + font_info.lfWeight |= FW_BOLD; + bold_font_ = CreateFontIndirect(&font_info); + DCHECK(bold_font_ != NULL); + + font_info.lfUnderline = TRUE; + underline_font_ = CreateFontIndirect(&font_info); + DCHECK(underline_font_ != NULL); + return true; +} + +void PluginInstallerImpl::NotifyPluginStatus(int status) { + default_plugin::g_browser->getvalue( + instance_, + static_cast<NPNVariable>( + default_plugin::kMissingPluginStatusStart + status), + NULL); +} diff --git a/webkit/default_plugin/plugin_impl_win.h b/webkit/default_plugin/plugin_impl_win.h new file mode 100644 index 0000000..f2e9ba8 --- /dev/null +++ b/webkit/default_plugin/plugin_impl_win.h @@ -0,0 +1,317 @@ +// Copyright (c) 2009 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. + +#ifndef WEBKIT_DEFAULT_PLUGIN_PLUGIN_IMPL_WIN_H_ +#define WEBKIT_DEFAULT_PLUGIN_PLUGIN_IMPL_WIN_H_ + +#include <string> +#include <vector> + +#include "gfx/window_impl.h" +#include "third_party/npapi/bindings/npapi.h" +#include "webkit/default_plugin/install_dialog.h" +#include "webkit/default_plugin/plugin_database_handler.h" +#include "webkit/default_plugin/plugin_install_job_monitor.h" + +// Possible plugin installer states. +enum PluginInstallerState { + PluginInstallerStateUndefined, + PluginListDownloadInitiated, + PluginListDownloaded, + PluginListDownloadedPluginNotFound, + PluginListDownloadFailed, + PluginDownloadInitiated, + PluginDownloadCompleted, + PluginDownloadFailed, + PluginInstallerLaunchSuccess, + PluginInstallerLaunchFailure +}; + +class PluginInstallDialog; +class PluginDatabaseHandler; + +// Provides the plugin installation functionality. This class is +// instantiated with the information like the mime type of the +// target plugin, the display mode, etc. +class PluginInstallerImpl : public gfx::WindowImpl { + public: + static const int kRefreshPluginsMessage = WM_APP + 1; + static const int kInstallMissingPluginMessage = WM_APP + 2; + + // mode is the plugin instantiation mode, i.e. whether it is a full + // page plugin (NP_FULL) or an embedded plugin (NP_EMBED) + explicit PluginInstallerImpl(int16 mode); + virtual ~PluginInstallerImpl(); + + BEGIN_MSG_MAP_EX(PluginInstallerImpl) + MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBackGround) + MESSAGE_HANDLER(WM_PAINT, OnPaint) + MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown) + MESSAGE_HANDLER(kRefreshPluginsMessage, OnRefreshPlugins) + MESSAGE_HANDLER(WM_COPYDATA, OnCopyData) + MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor) + END_MSG_MAP() + + // Initializes the plugin with the instance information, mime type + // and the list of parameters passed down to the plugin from the webpage. + // + // Parameters: + // module_handle + // The handle to the dll in which this object is instantiated. + // instance + // The plugins opaque instance handle. + // mime_type + // Identifies the third party plugin which would be eventually installed. + // argc + // Indicates the count of arguments passed in from the webpage. + // argv + // Pointer to the arguments. + // Returns true on success. + bool Initialize(HINSTANCE module_handle, NPP instance, NPMIMEType mime_type, + int16 argc, char* argn[], char* argv[]); + + // Displays the default plugin UI. + // + // Parameters: + // window_info + // The window info passed to npapi. + bool NPP_SetWindow(NPWindow* window_info); + + // Destroys the install dialog and the plugin window. + void Shutdown(); + + // Starts plugin download. Spawns the plugin installer after it is + // downloaded. + void DownloadPlugin(); + + // Indicates that the plugin download was cancelled. + void DownloadCancelled(); + + // Initializes the plugin download stream. + // + // Parameters: + // stream + // Pointer to the new stream being created. + void NewStream(NPStream* stream); + + // Uninitializes the plugin download stream. + // + // Parameters: + // stream + // Pointer to the stream being destroyed. + // reason + // Indicates why the stream is being destroyed. + // + void DestroyStream(NPStream* stream, NPError reason); + + // Determines whether the plugin is ready to accept data. + // We only accept data when we have initiated a download for the plugin + // database. + // + // Parameters: + // stream + // Pointer to the stream being destroyed. + // Returns true if the plugin is ready to accept data. + bool WriteReady(NPStream* stream); + + // Delivers data to the plugin instance. + // + // Parameters: + // stream + // Pointer to the stream being destroyed. + // offset + // Indicates the data offset. + // buffer_length + // Indicates the length of the data buffer. + // buffer + // Pointer to the actual buffer. + // Returns the number of bytes actually written, 0 on error. + int32 Write(NPStream* stream, int32 offset, int32 buffer_length, + void* buffer); + + // Handles notifications received in response to GetURLNotify calls issued + // by the plugin. + // + // Parameters: + // url + // Pointer to the URL. + // reason + // Describes why the notification was sent. + void URLNotify(const char* url, NPReason reason); + + // Used by the renderer to indicate plugin install through the infobar. + int16 NPP_HandleEvent(void* event); + + const std::string& mime_type() const { return mime_type_; } + + // Replaces a resource string with the placeholder passed in as an argument + // + // Parameters: + // message_id_with_placeholders + // The resource id of the string with placeholders. This is only used if + // the placeholder string (the replacement_string) parameter is valid. + // message_id_without_placeholders + // The resource id of the string to be returned if the placeholder is + // empty. + // replacement_string + // The placeholder which replaces tokens in the string identified by + // resource id message_id_with_placeholders. + // Returns a string which has the placeholders replaced, or the string + // without placeholders. + static std::wstring ReplaceStringForPossibleEmptyReplacement( + int message_id_with_placeholders, int message_id_without_placeholders, + const std::wstring& replacement_string); + + // Setter/getter combination to set and retreieve the current + // state of the plugin installer. + void set_plugin_installer_state(PluginInstallerState new_state) { + plugin_installer_state_ = new_state; + } + + PluginInstallerState plugin_installer_state() const { + return plugin_installer_state_; + } + + // Getter for the NPP instance member. + const NPP instance() const { + return instance_; + } + + // Returns whether or not the UI layout is right-to-left (such as Hebrew or + // Arabic). + static bool IsRTLLayout(); + + protected: + // Window message handlers. + LRESULT OnPaint(UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled); + LRESULT OnEraseBackGround(UINT message, WPARAM wparam, LPARAM lparam, + BOOL& handled); + LRESULT OnLButtonDown(UINT message, WPARAM wparam, LPARAM lparam, + BOOL& handled); + LRESULT OnSetCursor(UINT message, WPARAM wparam, LPARAM lparam, + BOOL& handled); + + // Refreshes the loaded plugin list and reloads the current page. + LRESULT OnRefreshPlugins(UINT message, WPARAM wparam, LPARAM lparam, + BOOL& handled); + + // Launches the third party plugin installer. This message is + // received when the request to download the installer, initiated by + // plugin completes. + LRESULT OnCopyData(UINT message, WPARAM wparam, LPARAM lparam, BOOL& handled); + + // Displays the plugin install confirmation dialog. + void ShowInstallDialog(); + + // Clears the current display state. + void ClearDisplay(); + + // Displays the status message identified by the message resource id + // passed in. + // + // Parameters: + // message_resource_id parameter + // The resource id of the message to be displayed. + void DisplayStatus(int message_resource_id); + + // Displays status information for the third party plugin which is needed + // by the page. + void DisplayAvailablePluginStatus(); + + // Displays information related to third party plugin download failure. + void DisplayPluginDownloadFailedStatus(); + + // Enables the plugin window if required and initiates an update of the + // the plugin window. + void RefreshDisplay(); + + // Create tooltip window. + bool CreateToolTip(); + + // Update ToolTip text with the message shown inside the default plugin. + void UpdateToolTip(); + + // Initializes resources like the icon, fonts, etc needed by the plugin + // installer + // + // Parameters: + // module_handle + // Handle to the dll in which this object is instantiated. + // Returns true on success. + bool InitializeResources(HINSTANCE module_handle); + + // Paints user action messages to the plugin window. These include messages + // like whether the user should click on the plugin window to download the + // plugin, etc. + // + // Parameters: + // paint_dc + // The device context returned in BeginPaint. + // x_origin + // Horizontal reference point indicating where the text is to be displayed. + // y_origin + // Vertical reference point indicating where the text is to be displayed. + // + void PaintUserActionInformation(HDC paint_dc, int x_origin, int y_origin); + + private: + // Notify the renderer that plugin is available to download. + void NotifyPluginStatus(int status); + + // The plugins opaque instance handle + NPP instance_; + // The plugin instantiation mode (NP_FULL or NP_EMBED) + int16 mode_; + // The handle to the icon displayed in the plugin installation window. + HICON icon_; + // The Get plugin link message string displayed at the top left corner of + // the plugin window. + std::wstring get_plugin_link_message_; + // The command string displayed in the plugin installation window. + std::wstring command_; + // An additional message displayed at times by the plugin. + std::wstring optional_additional_message_; + // The current stream. + NPStream* plugin_install_stream_; + // The plugin finder URL. + std::string plugin_finder_url_; + // The desired mime type. + std::string mime_type_; + // The desired language. + std::string desired_language_; + // The plugin name. + std::wstring plugin_name_; + // The actual download URL. + std::string plugin_download_url_; + // Indicates if the plugin download URL points to an exe. + bool plugin_download_url_for_display_; + // The current state of the plugin installer. + PluginInstallerState plugin_installer_state_; + // Used to display the UI for plugin installation. + PluginInstallDialog* install_dialog_; + // To enable auto refresh of the plugin window once the installation + // is complete, we spawn the installation process in a job, and monitor + // IO completion events on the job. When the active process count of the + // job falls to zero, we initiate an auto refresh of the plugin list + // which enables the downloaded plugin to be instantiated. + // The completion events from the job are monitored in an independent + // thread. + scoped_refptr<PluginInstallationJobMonitorThread> + installation_job_monitor_thread_; + // This object handles download and parsing of the plugins database. + PluginDatabaseHandler plugin_database_handler_; + // Indicates if the left click to download/refresh should be enabled or not. + bool enable_click_; + // Handles to the fonts used to display text in the plugin window. + HFONT bold_font_; + HFONT regular_font_; + HFONT underline_font_; + // Tooltip Window. + HWND tooltip_; + + DISALLOW_COPY_AND_ASSIGN(PluginInstallerImpl); +}; + + +#endif // WEBKIT_DEFAULT_PLUGIN_PLUGIN_IMPL_WIN_H_ diff --git a/webkit/default_plugin/plugin_install_job_monitor.cc b/webkit/default_plugin/plugin_install_job_monitor.cc new file mode 100644 index 0000000..61eba92 --- /dev/null +++ b/webkit/default_plugin/plugin_install_job_monitor.cc @@ -0,0 +1,106 @@ +// Copyright (c) 2010 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/default_plugin/plugin_install_job_monitor.h" + +#include "base/message_loop.h" +#include "webkit/default_plugin/plugin_impl.h" + +PluginInstallationJobMonitorThread::PluginInstallationJobMonitorThread() + : Thread("Chrome plugin install thread"), + install_job_completion_port_(NULL), + stop_job_monitoring_(false), + plugin_window_(NULL), + install_job_(NULL) { +} + +PluginInstallationJobMonitorThread::~PluginInstallationJobMonitorThread() { + if (install_job_) { + ::CloseHandle(install_job_); + install_job_ = NULL; + } +} + +bool PluginInstallationJobMonitorThread::Initialize() { + DCHECK(install_job_ == NULL); + + install_job_ = ::CreateJobObject(NULL, NULL); + if (install_job_ == NULL) { + DLOG(ERROR) << "Failed to create plugin install job. Error = " + << ::GetLastError(); + NOTREACHED(); + return false; + } + + return Start(); +} + +void PluginInstallationJobMonitorThread::Init() { + this->message_loop()->PostTask(FROM_HERE, + NewRunnableMethod(this, + &PluginInstallationJobMonitorThread::WaitForJobThread)); +} + +void PluginInstallationJobMonitorThread::WaitForJobThread() { + if (!install_job_) { + DLOG(WARNING) << "Invalid job information"; + NOTREACHED(); + return; + } + + DCHECK(install_job_completion_port_ == NULL); + + install_job_completion_port_ = + ::CreateIoCompletionPort(INVALID_HANDLE_VALUE, NULL, + reinterpret_cast<ULONG_PTR>(install_job_), 0); + DCHECK(install_job_completion_port_ != NULL); + + JOBOBJECT_ASSOCIATE_COMPLETION_PORT job_completion_port = {0}; + job_completion_port.CompletionKey = install_job_; + job_completion_port.CompletionPort = install_job_completion_port_; + + if (!SetInformationJobObject(install_job_, + JobObjectAssociateCompletionPortInformation, + &job_completion_port, + sizeof(job_completion_port))) { + DLOG(WARNING) << "Failed to associate completion port with job object.Err " + << ::GetLastError(); + NOTREACHED(); + return; + } + + while (!stop_job_monitoring_) { + unsigned long job_event = 0; + unsigned long completion_key = 0; + LPOVERLAPPED overlapped = NULL; + + if (::GetQueuedCompletionStatus( + install_job_completion_port_, &job_event, + &completion_key, &overlapped, INFINITE)) { + if (job_event == JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO) { + DLOG(INFO) << "All processes in the installer job have exited."; + DLOG(INFO) << "Initiating refresh on the plugins list"; + DCHECK(::IsWindow(plugin_window_)); + PostMessageW(plugin_window_, + PluginInstallerImpl::kRefreshPluginsMessage, 0, 0); + } + } + } +} + +void PluginInstallationJobMonitorThread::Stop() { + stop_job_monitoring_ = true; + ::PostQueuedCompletionStatus( + install_job_completion_port_, JOB_OBJECT_MSG_END_OF_JOB_TIME, + reinterpret_cast<ULONG_PTR>(install_job_), NULL); + Thread::Stop(); + ::CloseHandle(install_job_completion_port_); + install_job_completion_port_ = NULL; +} + +bool PluginInstallationJobMonitorThread::AssignProcessToJob( + HANDLE process_handle) { + BOOL result = AssignProcessToJobObject(install_job_, process_handle); + return result ? true : false; +} diff --git a/webkit/default_plugin/plugin_install_job_monitor.h b/webkit/default_plugin/plugin_install_job_monitor.h new file mode 100644 index 0000000..477df48 --- /dev/null +++ b/webkit/default_plugin/plugin_install_job_monitor.h @@ -0,0 +1,81 @@ +// Copyright (c) 2010 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. + +#ifndef WEBKIT_DEFAULT_PLUGIN_PLUGIN_INSTALL_JOB_MONITOR_H__ +#define WEBKIT_DEFAULT_PLUGIN_PLUGIN_INSTALL_JOB_MONITOR_H__ + +#include <windows.h> + +#include "base/logging.h" +#include "base/thread.h" +#include "base/ref_counted.h" + +// Provides the plugin installation job monitoring functionality. +// The PluginInstallationJobMonitorThread class represents a background +// thread which monitors the install job completion port which is associated +// with the job when an instance of this class is initialized. +class PluginInstallationJobMonitorThread : + public base::Thread, + public base::RefCountedThreadSafe<PluginInstallationJobMonitorThread> { + + public: + PluginInstallationJobMonitorThread(); + + // Initializes the plugin install job. This involves creating the job object + // and starting the thread which monitors the job completion port. + // Returns true on success. + bool Initialize(); + + // Stops job monitoring and invokes the base Stop function. + void Stop(); + + // Simple setter/getters for the plugin window handle. + void set_plugin_window(HWND plugin_window) { + DCHECK(::IsWindow(plugin_window)); + plugin_window_ = plugin_window; + } + + HWND plugin_window() const { + return plugin_window_; + } + + // Adds a process to the job object. + // + // Parameters: + // process_handle + // Handle to the process which is to be added to the plugin install job. + // Returns true on success. + bool AssignProcessToJob(HANDLE process_handle); + + protected: + // Installs a task on our thread to call WaitForJobThread(). We + // can't call it directly since we would deadlock (thread which + // creates me blocks until Start() returns, and Start() doesn't + // return until Init() does). + virtual void Init(); + + // Blocks on the plugin installation job completion port by invoking the + // GetQueuedCompletionStatus API. + // We return from this function when the job monitoring thread is stopped. + virtual void WaitForJobThread(); + + private: + friend class base::RefCountedThreadSafe<PluginInstallationJobMonitorThread>; + + virtual ~PluginInstallationJobMonitorThread(); + + // The install job completion port. Created in Init. + HANDLE install_job_completion_port_; + // Indicates that job monitoring is to be stopped + bool stop_job_monitoring_; + // The install job. Should be created before the job monitor thread + // is started. + HANDLE install_job_; + // The plugin window handle. + HWND plugin_window_; + + DISALLOW_COPY_AND_ASSIGN(PluginInstallationJobMonitorThread); +}; + +#endif // WEBKIT_DEFAULT_PLUGIN_PLUGIN_INSTALL_JOB_MONITOR_H__ diff --git a/webkit/default_plugin/plugin_main.cc b/webkit/default_plugin/plugin_main.cc new file mode 100644 index 0000000..16f0f6b --- /dev/null +++ b/webkit/default_plugin/plugin_main.cc @@ -0,0 +1,336 @@ +// Copyright (c) 2006-2008 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/default_plugin/plugin_main.h" + +#include "base/logging.h" +#include "base/string_util.h" +#include "webkit/default_plugin/plugin_impl.h" +#include "webkit/glue/webkit_glue.h" + +namespace default_plugin { + +#if defined(OS_WIN) +// +// Forward declare the linker-provided pseudo variable for the +// current module handle. +// +extern "C" IMAGE_DOS_HEADER __ImageBase; + +// get the handle to the currently executing module +inline HMODULE GetCurrentModuleHandle() { + return reinterpret_cast<HINSTANCE>(&__ImageBase); +} +#endif + +// Initialized in NP_Initialize. +NPNetscapeFuncs* g_browser = NULL; + +NPError API_CALL NP_GetEntryPoints(NPPluginFuncs* funcs) { + // Be explicit about the namespace, because all internal plugins have + // functions with these names and some might accidentally put them into the + // global namespace. In that case, the linker might prefer the global one. + funcs->version = 11; + funcs->size = sizeof(*funcs); + funcs->newp = default_plugin::NPP_New; + funcs->destroy = default_plugin::NPP_Destroy; + funcs->setwindow = default_plugin::NPP_SetWindow; + funcs->newstream = default_plugin::NPP_NewStream; + funcs->destroystream = default_plugin::NPP_DestroyStream; + funcs->writeready = default_plugin::NPP_WriteReady; + funcs->write = default_plugin::NPP_Write; + funcs->asfile = NULL; + funcs->print = NULL; + funcs->event = default_plugin::NPP_HandleEvent; + funcs->urlnotify = default_plugin::NPP_URLNotify; +#if defined(OS_POSIX) && !defined(OS_MACOSX) + funcs->getvalue = default_plugin::NPP_GetValue; +#else + funcs->getvalue = NULL; +#endif + funcs->setvalue = NULL; + return NPERR_NO_ERROR; +} + +NPError API_CALL NP_Initialize(NPNetscapeFuncs* funcs) { + g_browser = funcs; + return 0; +} + +#if defined(OS_POSIX) && !defined(OS_MACOSX) +NPError API_CALL NP_Initialize(NPNetscapeFuncs* funcs, NPPluginFuncs* p_funcs) { + NPError err = NP_Initialize(funcs); + if (err != NPERR_NO_ERROR) + return err; + return NP_GetEntryPoints(p_funcs); +} +#endif + +NPError API_CALL NP_Shutdown(void) { + g_browser = NULL; + return NPERR_NO_ERROR; +} + +namespace { +// This function is only invoked when the default plugin is invoked +// with a special mime type application/chromium-test-default-plugin +void SignalTestResult(NPP instance) { + NPObject *window_obj = NULL; + g_browser->getvalue(instance, NPNVWindowNPObject, &window_obj); + if (!window_obj) { + NOTREACHED(); + return; + } + + std::string script = "javascript:onSuccess()"; + NPString script_string; + script_string.UTF8Characters = script.c_str(); + script_string.UTF8Length = + static_cast<unsigned int>(script.length()); + + NPVariant result_var; + g_browser->evaluate(instance, window_obj, + &script_string, &result_var); + g_browser->releaseobject(window_obj); +} + +} // namespace CHROMIUM_DefaultPluginTest + +bool NegotiateModels(NPP instance) { +#if defined(OS_MACOSX) + NPError err; + // Set drawing model to core graphics + NPBool supportsCoreGraphics = false; + err = g_browser->getvalue(instance, + NPNVsupportsCoreGraphicsBool, + &supportsCoreGraphics); + if (err != NPERR_NO_ERROR || !supportsCoreGraphics) { + NOTREACHED(); + return false; + } + err = g_browser->setvalue(instance, + NPPVpluginDrawingModel, + (void*)NPDrawingModelCoreGraphics); + if (err != NPERR_NO_ERROR) { + NOTREACHED(); + return false; + } + + // Set event model to cocoa + NPBool supportsCocoaEvents = false; + err = g_browser->getvalue(instance, + NPNVsupportsCocoaBool, + &supportsCocoaEvents); + if (err != NPERR_NO_ERROR || !supportsCocoaEvents) { + NOTREACHED(); + return false; + } + err = g_browser->setvalue(instance, + NPPVpluginEventModel, + (void*)NPEventModelCocoa); + if (err != NPERR_NO_ERROR) { + NOTREACHED(); + return false; + } +#elif defined(OS_POSIX) + NPError err; + // Check that chrome still supports xembed. + NPBool supportsXEmbed = false; + err = g_browser->getvalue(instance, + NPNVSupportsXEmbedBool, + &supportsXEmbed); + if (err != NPERR_NO_ERROR || !supportsXEmbed) { + NOTREACHED(); + return false; + } + + // Check that the toolkit is still gtk2. + NPNToolkitType toolkit; + err = g_browser->getvalue(instance, + NPNVToolkit, + &toolkit); + if (err != NPERR_NO_ERROR || toolkit != NPNVGtk2) { + NOTREACHED(); + return false; + } +#endif + return true; +} + +NPError NPP_New(NPMIMEType plugin_type, NPP instance, uint16_t mode, int16_t argc, + char* argn[], char* argv[], NPSavedData* saved) { + if (instance == NULL) + return NPERR_INVALID_INSTANCE_ERROR; + + // We don't want the null plugin to work in the following cases:- + // 1. Test-shell + // 2. The plugin is running in the renderer process. + if (webkit_glue::IsPluginRunningInRendererProcess()) { + return NPERR_GENERIC_ERROR; + } + + if (!NegotiateModels(instance)) + return NPERR_INCOMPATIBLE_VERSION_ERROR; + + PluginInstallerImpl* plugin_impl = new PluginInstallerImpl(mode); + plugin_impl->Initialize( +#if defined(OS_WIN) + GetCurrentModuleHandle(), +#else + NULL, +#endif + instance, plugin_type, argc, + argn, argv); + + instance->pdata = reinterpret_cast<void*>(plugin_impl); + + if (!base::strcasecmp(plugin_type, + "application/chromium-test-default-plugin")) { + SignalTestResult(instance); + } + + return NPERR_NO_ERROR; +} + +NPError NPP_Destroy(NPP instance, NPSavedData** save) { + PluginInstallerImpl* plugin_impl = + reinterpret_cast<PluginInstallerImpl*>(instance->pdata); + + if (plugin_impl) { + plugin_impl->Shutdown(); + delete plugin_impl; + } + + return NPERR_NO_ERROR; +} + +NPError NPP_SetWindow(NPP instance, NPWindow* window_info) { + if (instance == NULL) + return NPERR_INVALID_INSTANCE_ERROR; + + if (window_info == NULL) { + NOTREACHED(); + return NPERR_GENERIC_ERROR; + } + + PluginInstallerImpl* plugin_impl = + reinterpret_cast<PluginInstallerImpl*>(instance->pdata); + + if (plugin_impl == NULL) { + NOTREACHED(); + return NPERR_GENERIC_ERROR; + } + + if (!plugin_impl->NPP_SetWindow(window_info)) { + delete plugin_impl; + return NPERR_GENERIC_ERROR; + } + + return NPERR_NO_ERROR; +} + +NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, + NPBool seekable, uint16_t* stype) { + if (instance == NULL) + return NPERR_INVALID_INSTANCE_ERROR; + + PluginInstallerImpl* plugin_impl = + reinterpret_cast<PluginInstallerImpl*>(instance->pdata); + + if (!plugin_impl) { + NOTREACHED(); + return NPERR_INVALID_INSTANCE_ERROR; + } + + plugin_impl->NewStream(stream); + return NPERR_NO_ERROR; +} + +NPError NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason) { + if (instance == NULL) + return NPERR_INVALID_INSTANCE_ERROR; + + PluginInstallerImpl* plugin_impl = + reinterpret_cast<PluginInstallerImpl*>(instance->pdata); + + if (!plugin_impl) { + NOTREACHED(); + return NPERR_INVALID_INSTANCE_ERROR; + } + + plugin_impl->DestroyStream(stream, reason); + return NPERR_NO_ERROR; +} + +int32_t NPP_WriteReady(NPP instance, NPStream* stream) { + if (instance == NULL) + return 0; + + PluginInstallerImpl* plugin_impl = + reinterpret_cast<PluginInstallerImpl*>(instance->pdata); + + if (!plugin_impl) { + NOTREACHED(); + return 0; + } + + if (plugin_impl->WriteReady(stream)) + return 0x7FFFFFFF; + return 0; +} + +int32_t NPP_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len, + void* buffer) { + if (instance == NULL) + return 0; + + PluginInstallerImpl* plugin_impl = + reinterpret_cast<PluginInstallerImpl*>(instance->pdata); + + if (!plugin_impl) { + NOTREACHED(); + return 0; + } + + return plugin_impl->Write(stream, offset, len, buffer); +} + +void NPP_URLNotify(NPP instance, const char* url, NPReason reason, + void* notifyData) { + if (instance != NULL) { + PluginInstallerImpl* plugin_impl = + reinterpret_cast<PluginInstallerImpl*>(instance->pdata); + + if (!plugin_impl) { + NOTREACHED(); + return; + } + + plugin_impl->URLNotify(url, reason); + } +} + +#if defined(OS_POSIX) && !defined(OS_MACOSX) +NPError NPP_GetValue(NPP instance, NPPVariable variable, void* value) { + switch (variable) { + case NPPVpluginNeedsXEmbed: + *static_cast<NPBool*>(value) = true; + return NPERR_NO_ERROR; + default: + return NPERR_INVALID_PARAM; + } +} +#endif + +int16_t NPP_HandleEvent(NPP instance, void* event) { + if (instance == NULL) + return 0; + + PluginInstallerImpl* plugin_impl = + reinterpret_cast<PluginInstallerImpl*>(instance->pdata); + + return plugin_impl->NPP_HandleEvent(event); +} + +} // default_plugin diff --git a/webkit/default_plugin/plugin_main.h b/webkit/default_plugin/plugin_main.h new file mode 100644 index 0000000..50f3009 --- /dev/null +++ b/webkit/default_plugin/plugin_main.h @@ -0,0 +1,41 @@ +// Copyright (c) 2010 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 <algorithm> +#include <string> + +#include "third_party/npapi/bindings/npapi.h" +#include "third_party/npapi/bindings/nphostapi.h" + +namespace default_plugin { + +extern NPNetscapeFuncs* g_browser; + +// Standard NPAPI functions. +NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, + char* argn[], char* argv[], NPSavedData* saved); +NPError NPP_Destroy(NPP instance, NPSavedData** save); +NPError NPP_SetWindow(NPP instance, NPWindow* window); +NPError NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, + NPBool seekable, uint16_t* stype); +NPError NPP_DestroyStream(NPP instance, NPStream* stream, NPReason reason); +int32_t NPP_WriteReady(NPP instance, NPStream* stream); +int32_t NPP_Write(NPP instance, NPStream* stream, int32_t offset, int32_t len, + void* buffer); +#if defined(OS_POSIX) && !defined(OS_MACOSX) +NPError NPP_GetValue(NPP instance, NPPVariable variable, void* value); +#endif +void NPP_URLNotify(NPP instance, const char* url, NPReason reason, + void* notifyData); +int16_t NPP_HandleEvent(NPP instance, void* event); + +#if defined(OS_POSIX) && !defined(OS_MACOSX) +NPError API_CALL NP_Initialize(NPNetscapeFuncs* funcs, NPPluginFuncs* p_funcs); +#else +NPError API_CALL NP_GetEntryPoints(NPPluginFuncs* funcs); +NPError API_CALL NP_Initialize(NPNetscapeFuncs* funcs); +#endif +NPError API_CALL NP_Shutdown(void); + +} // default_plugin diff --git a/webkit/default_plugin/plugins.xml b/webkit/default_plugin/plugins.xml new file mode 100644 index 0000000..8799ca9 --- /dev/null +++ b/webkit/default_plugin/plugins.xml @@ -0,0 +1,653 @@ +<plugins> + <plugin> + <mime>application/x-java-applet</mime> + <lang>en-us</lang> + <name>Java(TM) Platform SE6 U10 (Beta)</name> + <url>http://javadl.sun.com/webapps/download/GetFile/1.6.0_10-b33/windows-i586/jre-6u10-windows-i586-p-iftw.exe</url> + </plugin> + + <plugin> + <mime>application/x-java-bean</mime> + <lang>en-us</lang> + <name>Java(TM) Platform SE6 U10 (Beta)</name> + <url>http://javadl.sun.com/webapps/download/GetFile/1.6.0_10-b33/windows-i586/jre-6u10-windows-i586-p-iftw.exe</url> + </plugin> + + <plugin> + <mime>application/x-java-vm</mime> + <lang>en-us</lang> + <name>Java(TM) Platform SE6 U10 (Beta)</name> + <url>http://javadl.sun.com/webapps/download/GetFile/1.6.0_10-b33/windows-i586/jre-6u10-windows-i586-p-iftw.exe</url> + </plugin> + + <plugin> + <mime>application/x-java-applet,version=1.1.1</mime> + <lang>en-us</lang> + <name>Java(TM) Platform SE6 U10 (Beta)</name> + <url>http://javadl.sun.com/webapps/download/GetFile/1.6.0_10-b33/windows-i586/jre-6u10-windows-i586-p-iftw.exe</url> + </plugin> + + <plugin> + <mime>application/x-java-bean,version=1.1.1</mime> + <lang>en-us</lang> + <name>Java(TM) Platform SE6 U10 (Beta)</name> + <url>http://javadl.sun.com/webapps/download/GetFile/1.6.0_10-b33/windows-i586/jre-6u10-windows-i586-p-iftw.exe</url> + </plugin> + + <plugin> + <mime>application/x-java-applet,version=1.1</mime> + <lang>en-us</lang> + <name>Java(TM) Platform SE6 U10 (Beta)</name> + <url>http://javadl.sun.com/webapps/download/GetFile/1.6.0_10-b33/windows-i586/jre-6u10-windows-i586-p-iftw.exe</url> + </plugin> + + <plugin> + <mime>application/x-java-bean,version=1.1</mime> + <lang>en-us</lang> + <name>Java(TM) Platform SE6 U10 (Beta)</name> + <url>http://javadl.sun.com/webapps/download/GetFile/1.6.0_10-b33/windows-i586/jre-6u10-windows-i586-p-iftw.exe</url> + </plugin> + + <plugin> + <mime>application/x-java-applet,version=1.2</mime> + <lang>en-us</lang> + <name>Java(TM) Platform SE6 U10 (Beta)</name> + <url>http://javadl.sun.com/webapps/download/GetFile/1.6.0_10-b33/windows-i586/jre-6u10-windows-i586-p-iftw.exe</url> + </plugin> + + <plugin> + <mime>application/x-java-bean,version=1.2</mime> + <lang>en-us</lang> + <name>Java(TM) Platform SE6 U10 (Beta)</name> + <url>http://javadl.sun.com/webapps/download/GetFile/1.6.0_10-b33/windows-i586/jre-6u10-windows-i586-p-iftw.exe</url> + </plugin> + + <plugin> + <mime>application/x-java-applet,version=1.1.3</mime> + <lang>en-us</lang> + <name>Java(TM) Platform SE6 U10 (Beta)</name> + <url>http://javadl.sun.com/webapps/download/GetFile/1.6.0_10-b33/windows-i586/jre-6u10-windows-i586-p-iftw.exe</url> + </plugin> + + <plugin> + <mime>application/x-java-bean,version=1.1.3</mime> + <lang>en-us</lang> + <name>Java(TM) Platform SE6 U10 (Beta)</name> + <url>http://javadl.sun.com/webapps/download/GetFile/1.6.0_10-b33/windows-i586/jre-6u10-windows-i586-p-iftw.exe</url> + </plugin> + + <plugin> + <mime>application/x-java-applet,version=1.1.2</mime> + <lang>en-us</lang> + <name>Java(TM) Platform SE6 U10 (Beta)</name> + <url>http://javadl.sun.com/webapps/download/GetFile/1.6.0_10-b33/windows-i586/jre-6u10-windows-i586-p-iftw.exe</url> + </plugin> + + <plugin> + <mime>application/x-java-bean,version=1.1.2</mime> + <lang>en-us</lang> + <name>Java(TM) Platform SE6 U10 (Beta)</name> + <url>http://javadl.sun.com/webapps/download/GetFile/1.6.0_10-b33/windows-i586/jre-6u10-windows-i586-p-iftw.exe</url> + </plugin> + + <plugin> + <mime>application/x-java-applet,version=1.3</mime> + <lang>en-us</lang> + <name>Java(TM) Platform SE6 U10 (Beta)</name> + <url>http://javadl.sun.com/webapps/download/GetFile/1.6.0_10-b33/windows-i586/jre-6u10-windows-i586-p-iftw.exe</url> + </plugin> + + <plugin> + <mime>application/x-java-bean,version=1.3</mime> + <lang>en-us</lang> + <name>Java(TM) Platform SE6 U10 (Beta)</name> + <url>http://javadl.sun.com/webapps/download/GetFile/1.6.0_10-b33/windows-i586/jre-6u10-windows-i586-p-iftw.exe</url> + </plugin> + + <plugin> + <mime>application/x-java-applet,version=1.2.2</mime> + <lang>en-us</lang> + <name>Java(TM) Platform SE6 U10 (Beta)</name> + <url>http://javadl.sun.com/webapps/download/GetFile/1.6.0_10-b33/windows-i586/jre-6u10-windows-i586-p-iftw.exe</url> + </plugin> + + <plugin> + <mime>application/x-java-bean,version=1.2.2</mime> + <lang>en-us</lang> + <name>Java(TM) Platform SE6 U10 (Beta)</name> + <url>http://javadl.sun.com/webapps/download/GetFile/1.6.0_10-b33/windows-i586/jre-6u10-windows-i586-p-iftw.exe</url> + </plugin> + + <plugin> + <mime>application/x-java-applet,version=1.2.1</mime> + <lang>en-us</lang> + <name>Java(TM) Platform SE6 U10 (Beta)</name> + <url>http://javadl.sun.com/webapps/download/GetFile/1.6.0_10-b33/windows-i586/jre-6u10-windows-i586-p-iftw.exe</url> + </plugin> + + <plugin> + <mime>application/x-java-bean,version=1.2.1</mime> + <lang>en-us</lang> + <name>Java(TM) Platform SE6 U10 (Beta)</name> + <url>http://javadl.sun.com/webapps/download/GetFile/1.6.0_10-b33/windows-i586/jre-6u10-windows-i586-p-iftw.exe</url> + </plugin> + + <plugin> + <mime>application/x-java-applet,version=1.3.1</mime> + <lang>en-us</lang> + <name>Java(TM) Platform SE6 U10 (Beta)</name> + <url>http://javadl.sun.com/webapps/download/GetFile/1.6.0_10-b33/windows-i586/jre-6u10-windows-i586-p-iftw.exe</url> + </plugin> + + <plugin> + <mime>application/x-java-bean,version=1.3.1</mime> + <lang>en-us</lang> + <name>Java(TM) Platform SE6 U10 (Beta)</name> + <url>http://javadl.sun.com/webapps/download/GetFile/1.6.0_10-b33/windows-i586/jre-6u10-windows-i586-p-iftw.exe</url> + </plugin> + + <plugin> + <mime>application/x-java-applet,version=1.4</mime> + <lang>en-us</lang> + <name>Java(TM) Platform SE6 U10 (Beta)</name> + <url>http://javadl.sun.com/webapps/download/GetFile/1.6.0_10-b33/windows-i586/jre-6u10-windows-i586-p-iftw.exe</url> + </plugin> + + <plugin> + <mime>application/x-java-bean,version=1.4</mime> + <lang>en-us</lang> + <name>Java(TM) Platform SE6 U10 (Beta)</name> + <url>http://javadl.sun.com/webapps/download/GetFile/1.6.0_10-b33/windows-i586/jre-6u10-windows-i586-p-iftw.exe</url> + </plugin> + + <plugin> + <mime>application/x-java-applet,version=1.4.1</mime> + <lang>en-us</lang> + <name>Java(TM) Platform SE6 U10 (Beta)</name> + <url>http://javadl.sun.com/webapps/download/GetFile/1.6.0_10-b33/windows-i586/jre-6u10-windows-i586-p-iftw.exe</url> + </plugin> + + <plugin> + <mime>application/x-java-bean,version=1.4.1</mime> + <lang>en-us</lang> + <name>Java(TM) Platform SE6 U10 (Beta)</name> + <url>http://javadl.sun.com/webapps/download/GetFile/1.6.0_10-b33/windows-i586/jre-6u10-windows-i586-p-iftw.exe</url> + </plugin> + + <plugin> + <mime>application/x-java-applet,version=1.4.2</mime> + <lang>en-us</lang> + <name>Java(TM) Platform SE6 U10 (Beta)</name> + <url>http://javadl.sun.com/webapps/download/GetFile/1.6.0_10-b33/windows-i586/jre-6u10-windows-i586-p-iftw.exe</url> + </plugin> + + <plugin> + <mime>application/x-java-bean,version=1.4.2</mime> + <lang>en-us</lang> + <name>Java(TM) Platform SE6 U10 (Beta)</name> + <url>http://javadl.sun.com/webapps/download/GetFile/1.6.0_10-b33/windows-i586/jre-6u10-windows-i586-p-iftw.exe</url> + </plugin> + + <plugin> + <mime>application/x-java-applet,version=1.5</mime> + <lang>en-us</lang> + <name>Java(TM) Platform SE6 U10 (Beta)</name> + <url>http://javadl.sun.com/webapps/download/GetFile/1.6.0_10-b33/windows-i586/jre-6u10-windows-i586-p-iftw.exe</url> + </plugin> + + <plugin> + <mime>application/x-java-bean,version=1.5</mime> + <lang>en-us</lang> + <name>Java(TM) Platform SE6 U10 (Beta)</name> + <url>http://javadl.sun.com/webapps/download/GetFile/1.6.0_10-b33/windows-i586/jre-6u10-windows-i586-p-iftw.exe</url> + </plugin> + + <plugin> + <mime>application/x-java-applet,version=1.6</mime> + <lang>en-us</lang> + <name>Java(TM) Platform SE6 U10 (Beta)</name> + <url>http://javadl.sun.com/webapps/download/GetFile/1.6.0_10-b33/windows-i586/jre-6u10-windows-i586-p-iftw.exe</url> + </plugin> + + <plugin> + <mime>application/x-java-bean,version=1.6</mime> + <lang>en-us</lang> + <name>Java(TM) Platform SE6 U10 (Beta)</name> + <url>http://javadl.sun.com/webapps/download/GetFile/1.6.0_10-b33/windows-i586/jre-6u10-windows-i586-p-iftw.exe</url> + </plugin> + + <plugin> + <mime>audio/x-pn-realaudio-plugin</mime> + <lang>en-us</lang> + <name>Real player</name> + <url>http://software-dl.real.com/free/windows/installer/R41R02F/RealPlayer11GOLD.exe</url> + </plugin> + + <plugin> + <mime>audio/x-pn-realaudio</mime> + <lang>en-us</lang> + <name>Real player</name> + <url>http://software-dl.real.com/free/windows/installer/R41R02F/RealPlayer11GOLD.exe</url> + </plugin> + + <plugin> + <mime>audio/vnd.rn-realaudio</mime> + <lang>en-us</lang> + <name>Real player</name> + <url>http://software-dl.real.com/free/windows/installer/R41R02F/RealPlayer11GOLD.exe</url> + </plugin> + + <plugin> + <mime>video/vnd.rn-realvideo</mime> + <lang>en-us</lang> + <name>Real player</name> + <url>http://software-dl.real.com/free/windows/installer/R41R02F/RealPlayer11GOLD.exe</url> + </plugin> + + <plugin> + <mime>application/x-shockwave-flash</mime> + <lang>en-us</lang> + <name>Adobe Flash Movie</name> + <url>http://fpdownload.macromedia.com/get/flashplayer/current/install_flash_player.exe</url> + </plugin> + + <plugin> + <mime>application/futuresplash</mime> + <lang>en-us</lang> + <name>Adobe FutureSpash Movie</name> + <url>http://fpdownload.macromedia.com/get/flashplayer/current/install_flash_player.exe</url> + </plugin> + + <plugin> + <mime>application/x-director</mime> + <lang>en-us</lang> + <name>Adobe Shockwave Movie</name> + <url>http://fpdownload.macromedia.com/get/shockwave/default/english/win95nt/10.2.0.023/Shockwave_Installer_Slim.exe</url> + </plugin> + + <plugin> + <mime>application/pdf</mime> + <lang>en-us</lang> + <name>Adobe Acrobat</name> + <url>http://ardownload.adobe.com/pub/adobe/reader/win/8.x/8.1.2/enu/AdbeRdr812_en_US.exe</url> + </plugin> + + <plugin> + <mime>application/vnd.adobe.x-mars</mime> + <lang>en-us</lang> + <name>Adobe Acrobat</name> + <url>http://ardownload.adobe.com/pub/adobe/reader/win/8.x/8.1.2/enu/AdbeRdr812_en_US.exe</url> + </plugin> + + <plugin> + <mime>application/vnd.fdf</mime> + <lang>en-us</lang> + <name>Adobe Acrobat</name> + <url>http://ardownload.adobe.com/pub/adobe/reader/win/8.x/8.1.2/enu/AdbeRdr812_en_US.exe</url> + </plugin> + + <plugin> + <mime>application/vnd.adobe.xfdf</mime> + <lang>en-us</lang> + <name>Adobe Acrobat</name> + <url>http://ardownload.adobe.com/pub/adobe/reader/win/8.x/8.1.2/enu/AdbeRdr812_en_US.exe</url> + </plugin> + + <plugin> + <mime>application/vnd.adobe.xdp+xml</mime> + <lang>en-us</lang> + <name>Adobe Acrobat</name> + <url>http://ardownload.adobe.com/pub/adobe/reader/win/8.x/8.1.2/enu/AdbeRdr812_en_US.exe</url> + </plugin> + + <plugin> + <mime>application/vnd.adobe.xfd+xml</mime> + <lang>en-us</lang> + <name>Adobe Acrobat</name> + <url>http://ardownload.adobe.com/pub/adobe/reader/win/8.x/8.1.2/enu/AdbeRdr812_en_US.exe</url> + </plugin> + + <plugin> + <mime>video/quicktime</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>application/sdp</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>application/x-sdp</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>application/x-rtsp</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>video/flc</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>audio/x-wav</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>audio/wav</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>audio/aiff</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>audio/x-aiff</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>audio/basic</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>audio/mid</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>audio/x-midi</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>audio/midi</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>audio/vnd.qcelp</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>audio/x-gsm</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>audio/amr</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>audio/aac</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>audio/x-aac</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>audio/x-caf</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>audio/ac3</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>audio/x-ac3</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>video/x-mpeg</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>video/mpeg</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>audio/mpeg</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>audio/x-mpeg</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>video/3ggp</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>audio/3ggp</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>video/3ggp2</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>audio/3ggp2</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>video/sd-video</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>application/x-mpeg</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>video/mp4</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>audio/mp4</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>audio/x-m4a</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>audio/x-m4p</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>audio/x-m4b</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>video/x-m4v</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>image/x-macpaint</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>image/pict</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>image/x-pict</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>image/png</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>image/x-png</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>image/x-quicktime</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>image/x-sgi</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>image/x-targa</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>image/jp2</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>image/jpeg2000</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>image/jpeg2000-image</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + + <plugin> + <mime>image/x-jpeg2000-image</mime> + <lang>en-us</lang> + <name>Quicktime player</name> + <url>http://wsidecar.apple.com/cgi-bin/nph-reg3rdpty2.pl/product=19502&cat=59&platform=osx&method=sa/QuickTimeInstaller.exe</url> + </plugin> + +</plugins>
\ No newline at end of file diff --git a/webkit/default_plugin/plugins2.xml b/webkit/default_plugin/plugins2.xml new file mode 100644 index 0000000..3cddca3 --- /dev/null +++ b/webkit/default_plugin/plugins2.xml @@ -0,0 +1,59 @@ +<plugins> + <plugin> + <mime_types>application/x-java-applet;application/x-java-bean;application/x-java-vm;application/x-java-applet,version=1.1.1;application/x-java-bean,version=1.1.1;application/x-java-applet,version=1.1;application/x-java-bean,version=1.1;application/x-java-applet,version=1.2;application/x-java-bean,version=1.2;application/x-java-applet,version=1.1.3;application/x-java-bean,version=1.1.3;application/x-java-applet,version=1.1.2;application/x-java-bean,version=1.1.2;application/x-java-applet,version=1.3;application/x-java-bean,version=1.3;application/x-java-applet,version=1.2.2;application/x-java-bean,version=1.2.2;application/x-java-applet,version=1.2.1;application/x-java-bean,version=1.2.1;application/x-java-applet,version=1.3.1;application/x-java-bean,version=1.3.1;application/x-java-applet,version=1.4;application/x-java-bean,version=1.4;application/x-java-applet,version=1.4.1;application/x-java-bean,version=1.4.1;application/x-java-applet,version=1.4.2;application/x-java-bean,version=1.4.2;application/x-java-applet,version=1.5;application/x-java-bean,version=1.5;application/x-java-applet,version=1.6;application/x-java-bean,version=1.6;</mime_types> + <lang>en-us</lang> + <name>Java(TM)</name> + <url>http://java.com/en/download/</url> + <displayurl>1</displayurl> + </plugin> + + <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>RealPlayer</name> + <url>http://forms.real.com/real/realone/download.html?type=rpsp_us</url> + </plugin> + + <plugin> + <mime_types>application/x-shockwave-flash;application/futuresplash</mime_types> + <lang>en-us</lang> + <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 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 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> + <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> + + <plugin> + <mime_types>video/divx;video/x-matroska</mime_types> + <lang>en-us</lang> + <name>DivX Web Player</name> + <url>http://download.divx.com/player/divxdotcom/DivXWebPlayerInstaller.exe</url> + </plugin> + +</plugins>
\ No newline at end of file diff --git a/webkit/glue/plugins/plugin_host.cc b/webkit/glue/plugins/plugin_host.cc index fe1d7ef..f2e4840 100644 --- a/webkit/glue/plugins/plugin_host.cc +++ b/webkit/glue/plugins/plugin_host.cc @@ -15,8 +15,8 @@ #include "base/sys_string_conversions.h" #include "net/base/net_util.h" #include "third_party/WebKit/WebKit/chromium/public/WebBindings.h" +#include "webkit/default_plugin/default_plugin_shared.h" #include "webkit/glue/webkit_glue.h" -#include "webkit/glue/plugins/default_plugin_shared.h" #include "webkit/glue/plugins/npapi_extension_thunk.h" #include "webkit/glue/plugins/plugin_instance.h" #include "webkit/glue/plugins/plugin_lib.h" diff --git a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm index efa6bdd..3bcff4c 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm +++ b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm @@ -18,6 +18,7 @@ #include "base/stats_counters.h" #include "base/string_util.h" #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" +#include "webkit/default_plugin/plugin_impl.h" #include "webkit/glue/plugins/plugin_instance.h" #include "webkit/glue/plugins/plugin_lib.h" #include "webkit/glue/plugins/plugin_list.h" diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi index cf97f76..aaa1d3f 100644 --- a/webkit/glue/webkit_glue.gypi +++ b/webkit/glue/webkit_glue.gypi @@ -155,7 +155,6 @@ 'plugins/carbon_plugin_window_tracker_mac.h', 'plugins/carbon_plugin_window_tracker_mac.cc', 'plugins/coregraphics_private_symbols_mac.h', - 'plugins/default_plugin_shared.h', 'plugins/nphostapi.h', 'plugins/gtk_plugin_container.h', 'plugins/gtk_plugin_container.cc', diff --git a/webkit/tools/test_shell/test_shell.gypi b/webkit/tools/test_shell/test_shell.gypi index 95e3193..b620db8 100644 --- a/webkit/tools/test_shell/test_shell.gypi +++ b/webkit/tools/test_shell/test_shell.gypi @@ -159,6 +159,7 @@ ], 'dependencies': [ '<(DEPTH)/breakpad/breakpad.gyp:breakpad_handler', + '<(DEPTH)/webkit/default_plugin/default_plugin.gyp:default_plugin', ], # TODO(bradnelson): # This should really be done in the 'npapi_layout_test_plugin' |