summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-31 22:35:13 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-31 22:35:13 +0000
commit208d3b7d52b46f9a641d432433dc59894878880d (patch)
treedb72721b64e095787c06631ba468f71b158e1649
parent32d2669f5b705998451d1106f6072aaf7b38d30e (diff)
downloadchromium_src-208d3b7d52b46f9a641d432433dc59894878880d.zip
chromium_src-208d3b7d52b46f9a641d432433dc59894878880d.tar.gz
chromium_src-208d3b7d52b46f9a641d432433dc59894878880d.tar.bz2
Moved the following IPC messages used by the chrome NPAPI plugin installer out of content
into Chrome. 1. PluginProcessHostMsg_GetPluginFinderUrl 2. PluginProcessHostMsg_MissingPluginStatus 3. PluginProcessHostMsg_DownloadUrl These messages are prefixed with Chrome. Removed the InstallMissingPlugin and OnInstallMissingPlugin handlers from the NPAPI plugin sources and from our webkit plugin implementation. The plugin infobar no longer sends over an IPC message to initiate installation of the third party plugin. It sends over a windows message which is handled in the plugin installer for Windows. This functionality is not implemented for the mac and linux as before. To display the plugin installation infobar the PluginProcessHostMsg_MissingPluginStatus message sent by the plugin needs the routing id and the renderer process id. This information is now passed along with the plugin instantiation parameters in NPP_New. These parameters are only read by the default plugin. This is a continuation of the fixes to ensure that IPC's don't span across content and chrome. BUG=87335 Review URL: http://codereview.chromium.org/7812020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99062 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/chrome_plugin_message_filter.cc67
-rw-r--r--chrome/browser/chrome_plugin_message_filter.h12
-rw-r--r--chrome/browser/plugin_installer_infobar_delegate.cc15
-rw-r--r--chrome/browser/plugin_installer_infobar_delegate.h5
-rw-r--r--chrome/browser/plugin_observer.cc30
-rw-r--r--chrome/browser/plugin_observer.h4
-rw-r--r--chrome/chrome_common.gypi1
-rw-r--r--chrome/common/chrome_plugin_messages.h40
-rw-r--r--chrome/common/common_message_generator.h1
-rw-r--r--chrome/default_plugin/default_plugin.gyp2
-rw-r--r--chrome/default_plugin/plugin_impl_gtk.cc20
-rw-r--r--chrome/default_plugin/plugin_impl_gtk.h5
-rw-r--r--chrome/default_plugin/plugin_impl_mac.h5
-rw-r--r--chrome/default_plugin/plugin_impl_mac.mm16
-rw-r--r--chrome/default_plugin/plugin_impl_win.cc57
-rw-r--r--chrome/default_plugin/plugin_impl_win.h18
-rw-r--r--chrome/default_plugin/plugin_installer_base.cc34
-rw-r--r--chrome/default_plugin/plugin_installer_base.h33
-rw-r--r--content/common/content_constants.cc3
-rw-r--r--content/common/content_constants.h5
-rw-r--r--content/common/plugin_messages.h12
-rw-r--r--content/common/view_messages.h7
-rw-r--r--content/plugin/webplugin_delegate_stub.cc24
-rw-r--r--content/plugin/webplugin_delegate_stub.h1
-rw-r--r--content/plugin/webplugin_proxy.cc4
-rw-r--r--content/plugin/webplugin_proxy.h1
-rw-r--r--content/renderer/render_view.cc36
-rw-r--r--content/renderer/render_view.h10
-rw-r--r--content/renderer/webplugin_delegate_proxy.cc11
-rw-r--r--content/renderer/webplugin_delegate_proxy.h2
-rw-r--r--ipc/ipc_message_utils.h1
-rw-r--r--webkit/plugins/npapi/plugin_host.cc22
-rw-r--r--webkit/plugins/npapi/webplugin.h5
-rw-r--r--webkit/plugins/npapi/webplugin_delegate.h3
-rw-r--r--webkit/plugins/npapi/webplugin_delegate_impl.h1
-rw-r--r--webkit/plugins/npapi/webplugin_delegate_impl_gtk.cc4
-rw-r--r--webkit/plugins/npapi/webplugin_delegate_impl_mac.mm4
-rw-r--r--webkit/plugins/npapi/webplugin_delegate_impl_win.cc8
-rw-r--r--webkit/plugins/npapi/webplugin_impl.cc4
-rw-r--r--webkit/plugins/npapi/webplugin_impl.h2
40 files changed, 309 insertions, 226 deletions
diff --git a/chrome/browser/chrome_plugin_message_filter.cc b/chrome/browser/chrome_plugin_message_filter.cc
index a6485a9..733358c 100644
--- a/chrome/browser/chrome_plugin_message_filter.cc
+++ b/chrome/browser/chrome_plugin_message_filter.cc
@@ -5,12 +5,18 @@
#include "chrome/browser/chrome_plugin_message_filter.h"
#include "chrome/browser/browser_process.h"
-#include "content/browser/browser_thread.h"
#include "chrome/browser/plugin_download_helper.h"
+#include "chrome/browser/plugin_installer_infobar_delegate.h"
+#include "chrome/browser/plugin_observer.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
+#include "chrome/common/chrome_plugin_messages.h"
+#include "content/browser/browser_thread.h"
#include "content/browser/plugin_process_host.h"
-#include "content/common/plugin_messages.h"
+#include "content/browser/renderer_host/render_view_host.h"
+#include "content/browser/renderer_host/render_view_host_delegate.h"
#include "net/url_request/url_request_context_getter.h"
+#include "webkit/plugins/npapi/default_plugin_shared.h"
static const char kDefaultPluginFinderURL[] =
"https://dl-ssl.google.com/edgedl/chrome/plugins/plugins2.xml";
@@ -26,10 +32,12 @@ bool ChromePluginMessageFilter::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(ChromePluginMessageFilter, message)
#if defined(OS_WIN)
- IPC_MESSAGE_HANDLER(PluginProcessHostMsg_DownloadUrl, OnDownloadUrl)
+ IPC_MESSAGE_HANDLER(ChromePluginProcessHostMsg_DownloadUrl, OnDownloadUrl)
#endif
- IPC_MESSAGE_HANDLER(PluginProcessHostMsg_GetPluginFinderUrl,
+ IPC_MESSAGE_HANDLER(ChromePluginProcessHostMsg_GetPluginFinderUrl,
OnGetPluginFinderUrl)
+ IPC_MESSAGE_HANDLER(ChromePluginProcessHostMsg_MissingPluginStatus,
+ OnMissingPluginStatus)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
@@ -71,3 +79,54 @@ void ChromePluginMessageFilter::OnGetPluginFinderUrl(
plugin_finder_url->clear();
}
}
+
+void ChromePluginMessageFilter::OnMissingPluginStatus(
+ int status, int render_process_id, int render_view_id,
+ gfx::NativeWindow window) {
+ BrowserThread::PostTask(
+ BrowserThread::UI,
+ FROM_HERE,
+ NewRunnableFunction(
+ &ChromePluginMessageFilter::HandleMissingPluginStatus,
+ status, render_process_id, render_view_id, window));
+}
+
+// static
+void ChromePluginMessageFilter::HandleMissingPluginStatus(
+ int status, int render_process_id, int render_view_id,
+ gfx::NativeWindow window) {
+// TODO(PORT): pull in when plug-ins work
+#if defined(OS_WIN)
+ RenderViewHost* host = RenderViewHost::FromID(render_process_id,
+ render_view_id);
+ if (!host || !host->delegate() || !host->delegate()->GetAsTabContents())
+ return;
+
+ TabContentsWrapper* tcw = TabContentsWrapper::GetCurrentWrapperForContents(
+ host->delegate()->GetAsTabContents());
+ if (!tcw)
+ return;
+
+ if (status == webkit::npapi::default_plugin::MISSING_PLUGIN_AVAILABLE) {
+ tcw->AddInfoBar(
+ new PluginInstallerInfoBarDelegate(
+ host->delegate()->GetAsTabContents(), window));
+ return;
+ }
+
+ DCHECK_EQ(webkit::npapi::default_plugin::MISSING_PLUGIN_USER_STARTED_DOWNLOAD,
+ status);
+ for (size_t i = 0; i < tcw->infobar_count(); ++i) {
+ InfoBarDelegate* delegate = tcw->GetInfoBarDelegateAt(i);
+ if (delegate->AsPluginInstallerInfoBarDelegate() != NULL) {
+ tcw->RemoveInfoBar(delegate);
+ return;
+ }
+ }
+#else
+ // TODO(port): Implement the infobar that accompanies the default plugin.
+ // Linux: http://crbug.com/10952
+ // Mac: http://crbug.com/17392
+ NOTIMPLEMENTED();
+#endif // OS_WIN}
+}
diff --git a/chrome/browser/chrome_plugin_message_filter.h b/chrome/browser/chrome_plugin_message_filter.h
index 543f069..e1aac1a 100644
--- a/chrome/browser/chrome_plugin_message_filter.h
+++ b/chrome/browser/chrome_plugin_message_filter.h
@@ -16,7 +16,7 @@ class PluginProcessHost;
class ChromePluginMessageFilter : public IPC::ChannelProxy::MessageFilter,
public IPC::Message::Sender {
public:
- explicit ChromePluginMessageFilter(PluginProcessHost* process);
+ ChromePluginMessageFilter(PluginProcessHost* process);
// BrowserMessageFilter methods:
virtual bool OnMessageReceived(const IPC::Message& message);
@@ -35,6 +35,16 @@ class ChromePluginMessageFilter : public IPC::ChannelProxy::MessageFilter,
gfx::NativeWindow caller_window);
#endif
void OnGetPluginFinderUrl(std::string* plugin_finder_url);
+ void OnMissingPluginStatus(int status,
+ int render_process_id,
+ int render_view_id,
+ gfx::NativeWindow window);
+
+ // static
+ static void HandleMissingPluginStatus(int status,
+ int render_process_id,
+ int render_view_id,
+ gfx::NativeWindow window);
PluginProcessHost* process_;
diff --git a/chrome/browser/plugin_installer_infobar_delegate.cc b/chrome/browser/plugin_installer_infobar_delegate.cc
index dcdc4ae..f37cb9d 100644
--- a/chrome/browser/plugin_installer_infobar_delegate.cc
+++ b/chrome/browser/plugin_installer_infobar_delegate.cc
@@ -13,11 +13,13 @@
#include "grit/theme_resources_standard.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
+#include "webkit/plugins/npapi/default_plugin_shared.h"
PluginInstallerInfoBarDelegate::PluginInstallerInfoBarDelegate(
- TabContents* tab_contents)
+ TabContents* tab_contents, gfx::NativeWindow window)
: ConfirmInfoBarDelegate(tab_contents),
- tab_contents_(tab_contents) {
+ tab_contents_(tab_contents),
+ window_(window) {
}
PluginInstallerInfoBarDelegate::~PluginInstallerInfoBarDelegate() {
@@ -48,8 +50,13 @@ string16 PluginInstallerInfoBarDelegate::GetButtonLabel(
}
bool PluginInstallerInfoBarDelegate::Accept() {
- RenderViewHost* host = tab_contents_->render_view_host();
- host->Send(new ViewMsg_InstallMissingPlugin(host->routing_id()));
+ // TODO(PORT) for other platforms.
+#ifdef OS_WIN
+ ::PostMessage(window_,
+ webkit::npapi::default_plugin::kInstallMissingPluginMessage,
+ 0,
+ 0);
+#endif // OS_WIN
return true;
}
diff --git a/chrome/browser/plugin_installer_infobar_delegate.h b/chrome/browser/plugin_installer_infobar_delegate.h
index 6831a2f..f338258 100644
--- a/chrome/browser/plugin_installer_infobar_delegate.h
+++ b/chrome/browser/plugin_installer_infobar_delegate.h
@@ -7,6 +7,7 @@
#pragma once
#include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
+#include "ui/gfx/native_widget_types.h"
class TabContents;
@@ -14,7 +15,8 @@ class TabContents;
// a missing plugin.
class PluginInstallerInfoBarDelegate : public ConfirmInfoBarDelegate {
public:
- explicit PluginInstallerInfoBarDelegate(TabContents* tab_contents);
+ PluginInstallerInfoBarDelegate(TabContents* tab_contents,
+ gfx::NativeWindow window);
private:
virtual ~PluginInstallerInfoBarDelegate();
@@ -32,6 +34,7 @@ class PluginInstallerInfoBarDelegate : public ConfirmInfoBarDelegate {
// The containing TabContents
TabContents* tab_contents_;
+ gfx::NativeWindow window_;
DISALLOW_COPY_AND_ASSIGN(PluginInstallerInfoBarDelegate);
};
diff --git a/chrome/browser/plugin_observer.cc b/chrome/browser/plugin_observer.cc
index 4555ff8..c7a323d 100644
--- a/chrome/browser/plugin_observer.cc
+++ b/chrome/browser/plugin_observer.cc
@@ -7,7 +7,6 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/google/google_util.h"
-#include "chrome/browser/plugin_installer_infobar_delegate.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
#include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h"
@@ -21,7 +20,6 @@
#include "grit/theme_resources_standard.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
-#include "webkit/plugins/npapi/default_plugin_shared.h"
#include "webkit/plugins/npapi/plugin_group.h"
#include "webkit/plugins/npapi/plugin_list.h"
#include "webkit/plugins/webplugininfo.h"
@@ -294,7 +292,6 @@ PluginObserver::~PluginObserver() {
bool PluginObserver::OnMessageReceived(const IPC::Message& message) {
IPC_BEGIN_MESSAGE_MAP(PluginObserver, message)
- IPC_MESSAGE_HANDLER(ViewHostMsg_MissingPluginStatus, OnMissingPluginStatus)
IPC_MESSAGE_HANDLER(ViewHostMsg_CrashedPlugin, OnCrashedPlugin)
IPC_MESSAGE_HANDLER(ChromeViewHostMsg_BlockedOutdatedPlugin,
OnBlockedOutdatedPlugin)
@@ -304,33 +301,6 @@ bool PluginObserver::OnMessageReceived(const IPC::Message& message) {
return true;
}
-PluginInstallerInfoBarDelegate* PluginObserver::GetPluginInstaller() {
- if (plugin_installer_ == NULL)
- plugin_installer_.reset(new PluginInstallerInfoBarDelegate(tab_contents()));
- return plugin_installer_->AsPluginInstallerInfoBarDelegate();
-}
-
-void PluginObserver::OnMissingPluginStatus(int status) {
- // TODO(PORT): pull in when plug-ins work
-#if defined(OS_WIN)
- if (status == webkit::npapi::default_plugin::MISSING_PLUGIN_AVAILABLE) {
- tab_contents_->AddInfoBar(
- new PluginInstallerInfoBarDelegate(tab_contents()));
- return;
- }
-
- DCHECK_EQ(webkit::npapi::default_plugin::MISSING_PLUGIN_USER_STARTED_DOWNLOAD,
- status);
- for (size_t i = 0; i < tab_contents_->infobar_count(); ++i) {
- InfoBarDelegate* delegate = tab_contents_->GetInfoBarDelegateAt(i);
- if (delegate->AsPluginInstallerInfoBarDelegate() != NULL) {
- tab_contents_->RemoveInfoBar(delegate);
- return;
- }
- }
-#endif
-}
-
void PluginObserver::OnCrashedPlugin(const FilePath& plugin_path) {
DCHECK(!plugin_path.value().empty());
diff --git a/chrome/browser/plugin_observer.h b/chrome/browser/plugin_observer.h
index 518f341..c9fed00 100644
--- a/chrome/browser/plugin_observer.h
+++ b/chrome/browser/plugin_observer.h
@@ -23,10 +23,6 @@ class PluginObserver : public TabContentsObserver {
virtual bool OnMessageReceived(const IPC::Message& message);
private:
- // Returns the PluginInstallerInfoBarDelegate, creating it if necessary.
- PluginInstallerInfoBarDelegate* GetPluginInstaller();
-
- void OnMissingPluginStatus(int status);
void OnCrashedPlugin(const FilePath& plugin_path);
void OnBlockedOutdatedPlugin(const string16& name, const GURL& update_url);
diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi
index a5110d6..0b20e5e 100644
--- a/chrome/chrome_common.gypi
+++ b/chrome/chrome_common.gypi
@@ -137,6 +137,7 @@
'common/chrome_content_client.h',
'common/chrome_content_plugin_client.cc',
'common/chrome_content_plugin_client.h',
+ 'common/chrome_plugin_messages.h',
'common/cloud_print/cloud_print_proxy_info.cc',
'common/cloud_print/cloud_print_proxy_info.h',
'common/common_api.h',
diff --git a/chrome/common/chrome_plugin_messages.h b/chrome/common/chrome_plugin_messages.h
new file mode 100644
index 0000000..4335fdc
--- /dev/null
+++ b/chrome/common/chrome_plugin_messages.h
@@ -0,0 +1,40 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Multiply-included file, no traditional include guard.
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "build/build_config.h"
+
+#include "ipc/ipc_message_macros.h"
+#include "ui/gfx/native_widget_types.h"
+
+#define IPC_MESSAGE_START ChromePluginMsgStart
+
+//-----------------------------------------------------------------------------
+// ChromePluginHost messages
+// These are messages sent from the plugin process to the renderer process.
+
+// Used to retrieve the plugin finder URL.
+IPC_SYNC_MESSAGE_CONTROL0_1(ChromePluginProcessHostMsg_GetPluginFinderUrl,
+ std::string /* plugin finder URL */)
+
+// Used to display an infobar containing missing plugin information in the
+// chrome browser process.
+IPC_MESSAGE_CONTROL4(ChromePluginProcessHostMsg_MissingPluginStatus,
+ int /* status */,
+ int /* render_process_id */,
+ int /* render_view_id */,
+ gfx::NativeWindow /* The plugin window handle */)
+
+#if defined(OS_WIN)
+// Used to initiate a download on the plugin installer file from the URL
+// passed in.
+IPC_MESSAGE_CONTROL2(ChromePluginProcessHostMsg_DownloadUrl,
+ std::string /* URL */,
+ gfx::NativeWindow /* caller window */)
+
+#endif // OS_WIN
diff --git a/chrome/common/common_message_generator.h b/chrome/common/common_message_generator.h
index c51d99c..09dde68 100644
--- a/chrome/common/common_message_generator.h
+++ b/chrome/common/common_message_generator.h
@@ -5,6 +5,7 @@
// Multiply-included file, hence no include guard.
#include "chrome/common/autofill_messages.h"
+#include "chrome/common/chrome_plugin_messages.h"
#include "chrome/common/chrome_utility_messages.h"
#include "chrome/common/extensions/extension_messages.h"
#include "chrome/common/icon_messages.h"
diff --git a/chrome/default_plugin/default_plugin.gyp b/chrome/default_plugin/default_plugin.gyp
index 8ced102..1b89034 100644
--- a/chrome/default_plugin/default_plugin.gyp
+++ b/chrome/default_plugin/default_plugin.gyp
@@ -32,6 +32,8 @@
'plugin_impl_mac.mm',
'plugin_impl_win.cc',
'plugin_impl_win.h',
+ 'plugin_installer_base.cc',
+ 'plugin_installer_base.h',
'plugin_main.cc',
'plugin_main.h',
],
diff --git a/chrome/default_plugin/plugin_impl_gtk.cc b/chrome/default_plugin/plugin_impl_gtk.cc
index bca4b37..378e80d 100644
--- a/chrome/default_plugin/plugin_impl_gtk.cc
+++ b/chrome/default_plugin/plugin_impl_gtk.cc
@@ -4,12 +4,16 @@
#include "chrome/default_plugin/plugin_impl_gtk.h"
-#include <gdk/gdkx.h>
+#include <X11/Xdefs.h>
+#include <gtk/gtk.h>
#include "base/file_util.h"
#include "base/path_service.h"
#include "base/string_util.h"
+#include "chrome/common/chrome_plugin_messages.h"
#include "chrome/default_plugin/plugin_main.h"
+#include "content/common/child_thread.h"
+#include "content/common/content_constants.h"
#include "googleurl/src/gurl.h"
#include "grit/webkit_strings.h"
#include "unicode/locid.h"
@@ -45,7 +49,8 @@ bool PluginInstallerImpl::Initialize(void* module_handle, NPP instance,
instance_ = instance;
mime_type_ = mime_type;
- return true;
+ return PluginInstallerBase::Initialize(module_handle, instance, mime_type,
+ argc, argn, argv);
}
bool PluginInstallerImpl::NPP_SetWindow(NPWindow* window_info) {
@@ -133,9 +138,10 @@ void PluginInstallerImpl::ShowInstallDialog() {
}
void PluginInstallerImpl::NotifyPluginStatus(int status) {
- default_plugin::g_browser->getvalue(
- instance_,
- static_cast<NPNVariable>(
- webkit::npapi::default_plugin::kMissingPluginStatusStart + status),
- NULL);
+ ChildThread::current()->Send(
+ new ChromePluginProcessHostMsg_MissingPluginStatus(
+ status,
+ renderer_process_id(),
+ render_view_id(),
+ 0));
}
diff --git a/chrome/default_plugin/plugin_impl_gtk.h b/chrome/default_plugin/plugin_impl_gtk.h
index 995b708..33ac44a 100644
--- a/chrome/default_plugin/plugin_impl_gtk.h
+++ b/chrome/default_plugin/plugin_impl_gtk.h
@@ -10,6 +10,7 @@
#include <gtk/gtk.h>
+#include "chrome/default_plugin/plugin_installer_base.h"
#include "third_party/npapi/bindings/npapi.h"
#include "ui/gfx/native_widget_types.h"
@@ -33,7 +34,7 @@ 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 {
+class PluginInstallerImpl : public PluginInstallerBase {
public:
// mode is the plugin instantiation mode, i.e. whether it is a full
// page plugin (NP_FULL) or an embedded plugin (NP_EMBED)
@@ -127,7 +128,7 @@ class PluginInstallerImpl {
// Describes why the notification was sent.
void URLNotify(const char* url, NPReason reason);
- // Used by the renderer to indicate plugin install through the infobar.
+ // Used by the renderer to pass events (for e.g. input events) to the plugin.
int16 NPP_HandleEvent(void* event);
const std::string& mime_type() const { return mime_type_; }
diff --git a/chrome/default_plugin/plugin_impl_mac.h b/chrome/default_plugin/plugin_impl_mac.h
index fdd6fda..ebd9127 100644
--- a/chrome/default_plugin/plugin_impl_mac.h
+++ b/chrome/default_plugin/plugin_impl_mac.h
@@ -8,6 +8,7 @@
#include <string>
+#include "chrome/default_plugin/plugin_installer_base.h"
#include "third_party/npapi/bindings/npapi.h"
#include "ui/gfx/native_widget_types.h"
@@ -39,7 +40,7 @@ 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 {
+class PluginInstallerImpl : public PluginInstallerBase {
public:
// mode is the plugin instantiation mode, i.e. whether it is a full
// page plugin (NP_FULL) or an embedded plugin (NP_EMBED)
@@ -133,7 +134,7 @@ class PluginInstallerImpl {
// Describes why the notification was sent.
void URLNotify(const char* url, NPReason reason);
- // Used by the renderer to indicate plugin install through the infobar.
+ // Used by the renderer to pass events (for e.g. input events) to the plugin.
int16 NPP_HandleEvent(void* event);
const std::string& mime_type() const { return mime_type_; }
diff --git a/chrome/default_plugin/plugin_impl_mac.mm b/chrome/default_plugin/plugin_impl_mac.mm
index b6deb28..927c32f 100644
--- a/chrome/default_plugin/plugin_impl_mac.mm
+++ b/chrome/default_plugin/plugin_impl_mac.mm
@@ -9,7 +9,9 @@
#include "base/file_util.h"
#include "base/path_service.h"
#include "base/string_util.h"
+#include "chrome/common/chrome_plugin_messages.h"
#include "chrome/default_plugin/plugin_main.h"
+#include "content/common/child_thread.h"
#include "googleurl/src/gurl.h"
#include "grit/default_plugin_resources.h"
#include "grit/webkit_strings.h"
@@ -55,7 +57,8 @@ bool PluginInstallerImpl::Initialize(void* module_handle, NPP instance,
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
image_ = rb.GetNativeImageNamed(IDR_PLUGIN_ICON);
- return true;
+ return PluginInstallerBase::Initialize(module_handle, instance, mime_type,
+ argc, argn, argv);
}
bool PluginInstallerImpl::NPP_SetWindow(NPWindow* window_info) {
@@ -192,9 +195,10 @@ void PluginInstallerImpl::ShowInstallDialog() {
}
void PluginInstallerImpl::NotifyPluginStatus(int status) {
- default_plugin::g_browser->getvalue(
- instance_,
- static_cast<NPNVariable>(
- webkit::npapi::default_plugin::kMissingPluginStatusStart + status),
- NULL);
+ ChildThread::current()->Send(
+ new ChromePluginProcessHostMsg_MissingPluginStatus(
+ status,
+ renderer_process_id(),
+ render_view_id(),
+ 0));
}
diff --git a/chrome/default_plugin/plugin_impl_win.cc b/chrome/default_plugin/plugin_impl_win.cc
index 90c604f..94e0cae 100644
--- a/chrome/default_plugin/plugin_impl_win.cc
+++ b/chrome/default_plugin/plugin_impl_win.cc
@@ -10,6 +10,7 @@
#include "base/path_service.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
+#include "chrome/common/chrome_plugin_messages.h"
#include "chrome/default_plugin/plugin_main.h"
#include "content/common/child_thread.h"
#include "content/common/plugin_messages.h"
@@ -23,6 +24,9 @@
static const int TOOLTIP_MAX_WIDTH = 500;
+int PluginInstallerImpl::instance_count_ = 0;
+bool PluginInstallerImpl::show_install_infobar_ = true;
+
PluginInstallerImpl::PluginInstallerImpl(int16 mode)
: instance_(NULL),
mode_(mode),
@@ -40,9 +44,14 @@ PluginInstallerImpl::PluginInstallerImpl(int16 mode)
new PluginInstallationJobMonitorThread()),
plugin_database_handler_(*this),
plugin_download_url_for_display_(false) {
+ instance_count_++;
}
PluginInstallerImpl::~PluginInstallerImpl() {
+ instance_count_--;
+ if (instance_count_ == 0)
+ show_install_infobar_ = true;
+
if (!disable_plugin_finder_)
installation_job_monitor_thread_->Stop();
@@ -72,7 +81,7 @@ bool PluginInstallerImpl::Initialize(HINSTANCE module_handle, NPP instance,
mime_type_ = mime_type;
ChildThread::current()->Send(
- new PluginProcessHostMsg_GetPluginFinderUrl(&plugin_finder_url_));
+ new ChromePluginProcessHostMsg_GetPluginFinderUrl(&plugin_finder_url_));
if (plugin_finder_url_.empty())
disable_plugin_finder_ = true;
@@ -89,8 +98,8 @@ bool PluginInstallerImpl::Initialize(HINSTANCE module_handle, NPP instance,
} else {
DisplayStatus(IDS_DEFAULT_PLUGIN_GET_PLUGIN_MSG_PLUGIN_FINDER_DISABLED);
}
-
- return true;
+ return PluginInstallerBase::Initialize(module_handle, instance, mime_type,
+ argc, argn, argv);
}
void PluginInstallerImpl::Shutdown() {
@@ -257,8 +266,6 @@ void PluginInstallerImpl::URLNotify(const char* url, NPReason reason) {
if (plugin_available) {
DVLOG(1) << "Plugin available for mime type " << mime_type_;
DisplayAvailablePluginStatus();
- NotifyPluginStatus(
- webkit::npapi::default_plugin::MISSING_PLUGIN_AVAILABLE);
} else {
DLOG(WARNING) << "No plugin available for mime type " << mime_type_;
DisplayStatus(IDS_DEFAULT_PLUGIN_NO_PLUGIN_AVAILABLE_MSG);
@@ -267,15 +274,6 @@ void PluginInstallerImpl::URLNotify(const char* url, NPReason reason) {
}
int16 PluginInstallerImpl::NPP_HandleEvent(void* event) {
- NPEvent* npp_event = static_cast<NPEvent*>(event);
- if (npp_event->event ==
- webkit::npapi::default_plugin::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;
}
@@ -330,6 +328,12 @@ bool PluginInstallerImpl::NPP_SetWindow(NPWindow* window_info) {
UpdateWindow(hwnd());
ShowWindow(hwnd(), SW_SHOW);
+ // Show the infobar only once.
+ if (show_install_infobar_) {
+ show_install_infobar_ = false;
+ NotifyPluginStatus(
+ webkit::npapi::default_plugin::MISSING_PLUGIN_AVAILABLE);
+ }
return true;
}
@@ -342,7 +346,7 @@ void PluginInstallerImpl::DownloadPlugin() {
DisplayStatus(IDS_DEFAULT_PLUGIN_DOWNLOADING_PLUGIN_MSG);
if (!plugin_download_url_for_display_) {
- ChildThread::current()->Send(new PluginProcessHostMsg_DownloadUrl(
+ ChildThread::current()->Send(new ChromePluginProcessHostMsg_DownloadUrl(
plugin_download_url_, hwnd()));
} else {
default_plugin::g_browser->geturl(instance(),
@@ -624,6 +628,18 @@ LRESULT PluginInstallerImpl::OnCopyData(UINT message, WPARAM wparam,
return 0;
}
+LRESULT PluginInstallerImpl::OnInstallPluginMessage(UINT message,
+ WPARAM wparam,
+ LPARAM lparam,
+ BOOL& handled) {
+ // 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;
+}
+
bool PluginInstallerImpl::InitializeResources(HINSTANCE module_handle) {
DCHECK(icon_ == NULL);
DCHECK(regular_font_ == NULL);
@@ -650,9 +666,10 @@ bool PluginInstallerImpl::InitializeResources(HINSTANCE module_handle) {
}
void PluginInstallerImpl::NotifyPluginStatus(int status) {
- default_plugin::g_browser->getvalue(
- instance_,
- static_cast<NPNVariable>(
- webkit::npapi::default_plugin::kMissingPluginStatusStart + status),
- NULL);
+ ChildThread::current()->Send(
+ new ChromePluginProcessHostMsg_MissingPluginStatus(
+ status,
+ renderer_process_id(),
+ render_view_id(),
+ hwnd()));
}
diff --git a/chrome/default_plugin/plugin_impl_win.h b/chrome/default_plugin/plugin_impl_win.h
index 78bcbbf..dc51d12 100644
--- a/chrome/default_plugin/plugin_impl_win.h
+++ b/chrome/default_plugin/plugin_impl_win.h
@@ -10,9 +10,12 @@
#include "chrome/default_plugin/install_dialog.h"
#include "chrome/default_plugin/plugin_database_handler.h"
+#include "chrome/default_plugin/plugin_installer_base.h"
#include "chrome/default_plugin/plugin_install_job_monitor.h"
+#include "chrome/default_plugin/plugin_main.h"
#include "third_party/npapi/bindings/npapi.h"
#include "ui/base/win/window_impl.h"
+#include "webkit/plugins/npapi/default_plugin_shared.h"
// Possible plugin installer states.
enum PluginInstallerState {
@@ -34,7 +37,8 @@ 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 ui::WindowImpl {
+class PluginInstallerImpl : public PluginInstallerBase,
+ public ui::WindowImpl {
public:
static const int kRefreshPluginsMessage = WM_APP + 1;
@@ -50,6 +54,9 @@ class PluginInstallerImpl : public ui::WindowImpl {
MESSAGE_HANDLER(kRefreshPluginsMessage, OnRefreshPlugins)
MESSAGE_HANDLER(WM_COPYDATA, OnCopyData)
MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor)
+ MESSAGE_HANDLER(
+ webkit::npapi::default_plugin::kInstallMissingPluginMessage,
+ OnInstallPluginMessage)
END_MSG_MAP()
// Initializes the plugin with the instance information, mime type
@@ -190,6 +197,9 @@ class PluginInstallerImpl : public ui::WindowImpl {
BOOL& handled);
LRESULT OnSetCursor(UINT message, WPARAM wparam, LPARAM lparam,
BOOL& handled);
+ // Handles the install plugin message coming from the plugin infobar.
+ LRESULT OnInstallPluginMessage(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,
@@ -311,6 +321,12 @@ class PluginInstallerImpl : public ui::WindowImpl {
// Tooltip Window.
HWND tooltip_;
+ // Count of plugin instances.
+ static int instance_count_;
+
+ // Set to true if the plugin install infobar is to be shown.
+ static bool show_install_infobar_;
+
DISALLOW_COPY_AND_ASSIGN(PluginInstallerImpl);
};
diff --git a/chrome/default_plugin/plugin_installer_base.cc b/chrome/default_plugin/plugin_installer_base.cc
new file mode 100644
index 0000000..e863564
--- /dev/null
+++ b/chrome/default_plugin/plugin_installer_base.cc
@@ -0,0 +1,34 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/default_plugin/plugin_installer_base.h"
+
+#include "base/string_number_conversions.h"
+#include "base/string_util.h"
+#include "content/common/content_constants.h"
+
+PluginInstallerBase::PluginInstallerBase()
+ : renderer_process_id_(0),
+ render_view_id_(0) {
+}
+
+PluginInstallerBase::~PluginInstallerBase() {
+}
+
+bool PluginInstallerBase::Initialize(void* module_handle, NPP instance,
+ NPMIMEType mime_type, int16 argc,
+ char* argn[], char* argv[]) {
+ for (int16_t index = 0; index < argc; ++index) {
+ if (!base::strncasecmp(argn[index],
+ content::kDefaultPluginRenderProcessId,
+ strlen(argn[index]))) {
+ base::StringToInt(argv[index], &renderer_process_id_);
+ } else if (!base::strncasecmp(argn[index],
+ content::kDefaultPluginRenderViewId,
+ strlen(argn[index]))) {
+ base::StringToInt(argv[index], &render_view_id_);
+ }
+ }
+ return true;
+}
diff --git a/chrome/default_plugin/plugin_installer_base.h b/chrome/default_plugin/plugin_installer_base.h
new file mode 100644
index 0000000..928ad10
--- /dev/null
+++ b/chrome/default_plugin/plugin_installer_base.h
@@ -0,0 +1,33 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_DEFAULT_PLUGIN_PLUGIN_INSTALLER_BASE_H_
+#define CHROME_DEFAULT_PLUGIN_PLUGIN_INSTALLER_BASE_H_
+
+#include "base/basictypes.h"
+#include "third_party/npapi/bindings/npapi.h"
+
+// Base class for the plugin installer.
+class PluginInstallerBase {
+ public:
+ PluginInstallerBase();
+ virtual ~PluginInstallerBase();
+
+ bool Initialize(void* module_handle, NPP instance, NPMIMEType mime_type,
+ int16 argc, char* argn[], char* argv[]);
+
+ int renderer_process_id() const {
+ return renderer_process_id_;
+ }
+
+ int render_view_id() const {
+ return render_view_id_;
+ }
+
+ private:
+ int renderer_process_id_;
+ int render_view_id_;
+};
+
+#endif // CHROME_DEFAULT_PLUGIN_PLUGIN_INSTALLER_BASE_H_
diff --git a/content/common/content_constants.cc b/content/common/content_constants.cc
index 3118867..6835362 100644
--- a/content/common/content_constants.cc
+++ b/content/common/content_constants.cc
@@ -13,6 +13,9 @@ const size_t kMaxTitleChars = 4 * 1024;
const size_t kMaxURLChars = 2 * 1024 * 1024;
const size_t kMaxURLDisplayChars = 32 * 1024;
+const char kDefaultPluginRenderViewId[] = "PluginRenderViewId";
+const char kDefaultPluginRenderProcessId[] = "PluginRenderProcessId";
+
} // namespace content
#undef FPL
diff --git a/content/common/content_constants.h b/content/common/content_constants.h
index b34f4bf..1c8b680 100644
--- a/content/common/content_constants.h
+++ b/content/common/content_constants.h
@@ -30,6 +30,11 @@ extern const size_t kMaxTitleChars;
extern const size_t kMaxURLChars;
extern const size_t kMaxURLDisplayChars;
+// The render view and render process id associated with the default plugin
+// instance.
+extern const char kDefaultPluginRenderViewId[];
+extern const char kDefaultPluginRenderProcessId[];
+
} // namespace content
#endif // CONTENT_COMMON_CHROME_CONSTANTS_H_
diff --git a/content/common/plugin_messages.h b/content/common/plugin_messages.h
index dd65ce9..c3c7ed1 100644
--- a/content/common/plugin_messages.h
+++ b/content/common/plugin_messages.h
@@ -83,19 +83,12 @@ IPC_MESSAGE_CONTROL0(PluginProcessMsg_NotifyRenderersOfPendingShutdown)
IPC_MESSAGE_CONTROL1(PluginProcessHostMsg_ChannelCreated,
IPC::ChannelHandle /* channel_handle */)
-IPC_SYNC_MESSAGE_CONTROL0_1(PluginProcessHostMsg_GetPluginFinderUrl,
- std::string /* plugin finder URL */)
-
#if defined(OS_WIN)
// Destroys the given window's parent on the UI thread.
IPC_MESSAGE_CONTROL2(PluginProcessHostMsg_PluginWindowDestroyed,
HWND /* window */,
HWND /* parent */)
-IPC_MESSAGE_CONTROL2(PluginProcessHostMsg_DownloadUrl,
- std::string /* URL */,
- HWND /* caller window */)
-
IPC_MESSAGE_CONTROL2(PluginProcessHostMsg_ReparentPluginWindow,
HWND /* window */,
HWND /* parent */)
@@ -261,8 +254,6 @@ IPC_MESSAGE_ROUTED0(PluginMsg_DidFinishManualLoading)
IPC_MESSAGE_ROUTED0(PluginMsg_DidManualLoadFail)
-IPC_MESSAGE_ROUTED0(PluginMsg_InstallMissingPlugin)
-
IPC_MESSAGE_ROUTED3(PluginMsg_HandleURLRequestReply,
unsigned long /* resource_id */,
GURL /* url */,
@@ -344,9 +335,6 @@ IPC_SYNC_MESSAGE_ROUTED2_1(PluginHostMsg_GetCookies,
GURL /* first_party_for_cookies */,
std::string /* cookies */)
-IPC_MESSAGE_ROUTED1(PluginHostMsg_MissingPluginStatus,
- int /* status */)
-
IPC_MESSAGE_ROUTED0(PluginHostMsg_CancelDocumentLoad)
IPC_MESSAGE_ROUTED3(PluginHostMsg_InitiateHTTPRangeRequest,
diff --git a/content/common/view_messages.h b/content/common/view_messages.h
index a91a857..47ecf7d 100644
--- a/content/common/view_messages.h
+++ b/content/common/view_messages.h
@@ -1226,9 +1226,6 @@ IPC_MESSAGE_ROUTED3(ViewMsg_PpapiBrokerChannelCreated,
IPC_MESSAGE_CONTROL1(ViewMsg_PurgePluginListCache,
bool /* reload_pages */)
-// Install the first missing pluign.
-IPC_MESSAGE_ROUTED0(ViewMsg_InstallMissingPlugin)
-
// Sent to the renderer when a popup window should no longer count against
// the current popup count (either because it's not a popup or because it was
// a generated by a user action or because a constrained popup got turned
@@ -2032,10 +2029,6 @@ IPC_MESSAGE_ROUTED1(ViewHostMsg_UpdateContentRestrictions,
IPC_MESSAGE_ROUTED1(ViewHostMsg_SaveURLAs,
GURL /* url */)
-// Notifies when default plugin updates status of the missing plugin.
-IPC_MESSAGE_ROUTED1(ViewHostMsg_MissingPluginStatus,
- int /* status */)
-
// Displays a JavaScript out-of-memory message in the infobar.
IPC_MESSAGE_ROUTED0(ViewHostMsg_JSOutOfMemory)
diff --git a/content/plugin/webplugin_delegate_stub.cc b/content/plugin/webplugin_delegate_stub.cc
index 87e8fda..824cd47 100644
--- a/content/plugin/webplugin_delegate_stub.cc
+++ b/content/plugin/webplugin_delegate_stub.cc
@@ -7,7 +7,9 @@
#include "build/build_config.h"
#include "base/command_line.h"
+#include "base/string_number_conversions.h"
#include "content/common/content_client.h"
+#include "content/common/content_constants.h"
#include "content/common/content_switches.h"
#include "content/common/plugin_messages.h"
#include "content/plugin/npobject_stub.h"
@@ -122,7 +124,6 @@ bool WebPluginDelegateStub::OnMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER(PluginMsg_DidFinishManualLoading,
OnDidFinishManualLoading)
IPC_MESSAGE_HANDLER(PluginMsg_DidManualLoadFail, OnDidManualLoadFail)
- IPC_MESSAGE_HANDLER(PluginMsg_InstallMissingPlugin, OnInstallMissingPlugin)
IPC_MESSAGE_HANDLER(PluginMsg_HandleURLRequestReply,
OnHandleURLRequestReply)
IPC_MESSAGE_HANDLER(PluginMsg_HTTPRangeRequestReply,
@@ -179,9 +180,22 @@ void WebPluginDelegateStub::OnInit(const PluginMsg_Init_Params& params,
path, mime_type_, parent);
if (delegate_) {
webplugin_->set_delegate(delegate_);
+ std::vector<std::string> arg_names = params.arg_names;
+ std::vector<std::string> arg_values = params.arg_values;
+
+ if (path.value() == webkit::npapi::kDefaultPluginLibraryName) {
+ // Add the renderer process id and Render view routing id to the list of
+ // parameters passed to the plugin.
+ arg_names.push_back(content::kDefaultPluginRenderViewId);
+ arg_values.push_back(base::IntToString(
+ params.host_render_view_routing_id));
+
+ arg_names.push_back(content::kDefaultPluginRenderProcessId);
+ arg_values.push_back(base::IntToString(channel_->renderer_id()));
+ }
*result = delegate_->Initialize(params.url,
- params.arg_names,
- params.arg_values,
+ arg_names,
+ arg_values,
webplugin_,
params.load_manually);
}
@@ -363,10 +377,6 @@ void WebPluginDelegateStub::OnDidManualLoadFail() {
delegate_->DidManualLoadFail();
}
-void WebPluginDelegateStub::OnInstallMissingPlugin() {
- delegate_->InstallMissingPlugin();
-}
-
void WebPluginDelegateStub::OnHandleURLRequestReply(
unsigned long resource_id, const GURL& url, int notify_id) {
WebPluginResourceClient* resource_client =
diff --git a/content/plugin/webplugin_delegate_stub.h b/content/plugin/webplugin_delegate_stub.h
index 3c4610a..4a12b9a 100644
--- a/content/plugin/webplugin_delegate_stub.h
+++ b/content/plugin/webplugin_delegate_stub.h
@@ -97,7 +97,6 @@ class WebPluginDelegateStub : public IPC::Channel::Listener,
void OnDidReceiveManualData(const std::vector<char>& buffer);
void OnDidFinishManualLoading();
void OnDidManualLoadFail();
- void OnInstallMissingPlugin();
void OnHandleURLRequestReply(unsigned long resource_id,
const GURL& url,
int notify_id);
diff --git a/content/plugin/webplugin_proxy.cc b/content/plugin/webplugin_proxy.cc
index df76e8e..c01bc55 100644
--- a/content/plugin/webplugin_proxy.cc
+++ b/content/plugin/webplugin_proxy.cc
@@ -260,10 +260,6 @@ std::string WebPluginProxy::GetCookies(const GURL& url,
return cookies;
}
-void WebPluginProxy::OnMissingPluginStatus(int status) {
- Send(new PluginHostMsg_MissingPluginStatus(route_id_, status));
-}
-
WebPluginResourceClient* WebPluginProxy::GetResourceClient(int id) {
ResourceClientMap::iterator iterator = resource_clients_.find(id);
// The IPC messages which deal with streams are now asynchronous. It is
diff --git a/content/plugin/webplugin_proxy.h b/content/plugin/webplugin_proxy.h
index df1b880..b6e3175 100644
--- a/content/plugin/webplugin_proxy.h
+++ b/content/plugin/webplugin_proxy.h
@@ -80,7 +80,6 @@ class WebPluginProxy : public webkit::npapi::WebPlugin {
virtual std::string GetCookies(const GURL& url,
const GURL& first_party_for_cookies);
- virtual void OnMissingPluginStatus(int status);
// class-specific methods
// Returns a WebPluginResourceClient object given its id, or NULL if no
diff --git a/content/renderer/render_view.cc b/content/renderer/render_view.cc
index 1b63862..70d8b5f 100644
--- a/content/renderer/render_view.cc
+++ b/content/renderer/render_view.cc
@@ -651,7 +651,6 @@ bool RenderView::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ViewMsg_UpdateTargetURL_ACK, OnUpdateTargetURLAck)
IPC_MESSAGE_HANDLER(ViewMsg_UpdateWebPreferences, OnUpdateWebPreferences)
IPC_MESSAGE_HANDLER(ViewMsg_SetAltErrorPageURL, OnSetAltErrorPageURL)
- IPC_MESSAGE_HANDLER(ViewMsg_InstallMissingPlugin, OnInstallMissingPlugin)
IPC_MESSAGE_HANDLER(ViewMsg_EnumerateDirectoryResponse,
OnEnumerateDirectoryResponse)
IPC_MESSAGE_HANDLER(ViewMsg_RunFileChooserResponse, OnFileChooserResponse)
@@ -1326,32 +1325,6 @@ bool RenderView::SendAndRunNestedMessageLoop(IPC::SyncMessage* message) {
return Send(message);
}
-void RenderView::OnMissingPluginStatus(
- WebPluginDelegateProxy* delegate,
- int status) {
-#if defined(OS_WIN)
- if (!first_default_plugin_) {
- // Show the InfoBar for the first available plugin.
- if (status == webkit::npapi::default_plugin::MISSING_PLUGIN_AVAILABLE) {
- first_default_plugin_ = delegate->AsWeakPtr();
- Send(new ViewHostMsg_MissingPluginStatus(routing_id_, status));
- }
- } else {
- // Closes the InfoBar if user clicks on the plugin (instead of the InfoBar)
- // to start the download/install.
- if (status ==
- webkit::npapi::default_plugin::MISSING_PLUGIN_USER_STARTED_DOWNLOAD) {
- Send(new ViewHostMsg_MissingPluginStatus(routing_id_, status));
- }
- }
-#else
- // TODO(port): Implement the infobar that accompanies the default plugin.
- // Linux: http://crbug.com/10952
- // Mac: http://crbug.com/17392
- NOTIMPLEMENTED();
-#endif
-}
-
// WebKit::WebViewClient ------------------------------------------------------
WebView* RenderView::createView(
@@ -1511,9 +1484,6 @@ void RenderView::didStartLoading() {
}
is_loading_ = true;
- // Clear the pointer so that we can assign it only when there is an unknown
- // plugin on a page.
- first_default_plugin_.reset();
Send(new ViewHostMsg_DidStartLoading(routing_id_));
@@ -3627,12 +3597,6 @@ void RenderView::OnCustomContextMenuAction(
webview()->performCustomContextMenuAction(action);
}
-void RenderView::OnInstallMissingPlugin() {
- // This could happen when the first default plugin is deleted.
- if (first_default_plugin_)
- first_default_plugin_->InstallMissingPlugin();
-}
-
void RenderView::OnEnumerateDirectoryResponse(
int id,
const std::vector<FilePath>& paths) {
diff --git a/content/renderer/render_view.h b/content/renderer/render_view.h
index ac81413..352ed0b 100644
--- a/content/renderer/render_view.h
+++ b/content/renderer/render_view.h
@@ -285,11 +285,6 @@ class RenderView : public RenderWidget,
// Notification that the given plugin has crashed.
void PluginCrashed(const FilePath& plugin_path);
- // Notification that the default plugin has done something about a missing
- // plugin. See default_plugin_shared.h for possible values of |status|.
- void OnMissingPluginStatus(WebPluginDelegateProxy* delegate,
- int status);
-
// Create a new NPAPI plugin.
WebKit::WebPlugin* CreateNPAPIPlugin(WebKit::WebFrame* frame,
const WebKit::WebPluginParams& params,
@@ -815,7 +810,6 @@ class RenderView : public RenderWidget,
const std::vector<GURL>& links,
const std::vector<FilePath>& local_paths,
const FilePath& local_directory_name);
- void OnInstallMissingPlugin();
void OnMediaPlayerActionAt(const gfx::Point& location,
const WebKit::WebMediaPlayerAction& action);
void OnMoveOrResizeStarted();
@@ -1124,10 +1118,6 @@ class RenderView : public RenderWidget,
// Plugins -------------------------------------------------------------------
- // Remember the first uninstalled plugin, so that we can ask the plugin
- // to install itself when user clicks on the info bar.
- base::WeakPtr<webkit::npapi::WebPluginDelegate> first_default_plugin_;
-
PepperPluginDelegateImpl pepper_delegate_;
// All the currently active plugin delegates for this RenderView; kept so that
diff --git a/content/renderer/webplugin_delegate_proxy.cc b/content/renderer/webplugin_delegate_proxy.cc
index 9e49726..c9640b3 100644
--- a/content/renderer/webplugin_delegate_proxy.cc
+++ b/content/renderer/webplugin_delegate_proxy.cc
@@ -413,10 +413,6 @@ void WebPluginDelegateProxy::DidManualLoadFail() {
Send(new PluginMsg_DidManualLoadFail(instance_id_));
}
-void WebPluginDelegateProxy::InstallMissingPlugin() {
- Send(new PluginMsg_InstallMissingPlugin(instance_id_));
-}
-
bool WebPluginDelegateProxy::OnMessageReceived(const IPC::Message& msg) {
content::GetContentClient()->SetActiveURL(page_url_);
@@ -436,8 +432,6 @@ bool WebPluginDelegateProxy::OnMessageReceived(const IPC::Message& msg) {
IPC_MESSAGE_HANDLER(PluginHostMsg_ResolveProxy, OnResolveProxy)
IPC_MESSAGE_HANDLER(PluginHostMsg_SetCookie, OnSetCookie)
IPC_MESSAGE_HANDLER(PluginHostMsg_GetCookies, OnGetCookies)
- IPC_MESSAGE_HANDLER(PluginHostMsg_MissingPluginStatus,
- OnMissingPluginStatus)
IPC_MESSAGE_HANDLER(PluginHostMsg_URLRequest, OnHandleURLRequest)
IPC_MESSAGE_HANDLER(PluginHostMsg_CancelDocumentLoad, OnCancelDocumentLoad)
IPC_MESSAGE_HANDLER(PluginHostMsg_InitiateHTTPRangeRequest,
@@ -1138,11 +1132,6 @@ void WebPluginDelegateProxy::OnGetCookies(const GURL& url,
*cookies = plugin_->GetCookies(url, first_party_for_cookies);
}
-void WebPluginDelegateProxy::OnMissingPluginStatus(int status) {
- if (render_view_)
- render_view_->OnMissingPluginStatus(this, status);
-}
-
void WebPluginDelegateProxy::PaintSadPlugin(WebKit::WebCanvas* native_context,
const gfx::Rect& rect) {
// Lazily load the sad plugin image.
diff --git a/content/renderer/webplugin_delegate_proxy.h b/content/renderer/webplugin_delegate_proxy.h
index 5482335..5b66a3c 100644
--- a/content/renderer/webplugin_delegate_proxy.h
+++ b/content/renderer/webplugin_delegate_proxy.h
@@ -114,7 +114,6 @@ class WebPluginDelegateProxy
virtual void DidReceiveManualData(const char* buffer, int length);
virtual void DidFinishManualLoading();
virtual void DidManualLoadFail();
- virtual void InstallMissingPlugin();
virtual webkit::npapi::WebPluginResourceClient* CreateResourceClient(
unsigned long resource_id, const GURL& url, int notify_id);
virtual webkit::npapi::WebPluginResourceClient* CreateSeekableResourceClient(
@@ -154,7 +153,6 @@ class WebPluginDelegateProxy
const std::string& cookie);
void OnGetCookies(const GURL& url, const GURL& first_party_for_cookies,
std::string* cookies);
- void OnMissingPluginStatus(int status);
void OnCancelDocumentLoad();
void OnInitiateHTTPRangeRequest(const std::string& url,
const std::string& range_info,
diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h
index 9da9eba4..e7bbe34 100644
--- a/ipc/ipc_message_utils.h
+++ b/ipc/ipc_message_utils.h
@@ -93,6 +93,7 @@ enum IPCMessageStart {
TextInputClientMsgStart,
ChromeUtilityMsgStart,
MediaStreamMsgStart,
+ ChromePluginMsgStart,
LastIPCMsgStart // Must come last.
};
diff --git a/webkit/plugins/npapi/plugin_host.cc b/webkit/plugins/npapi/plugin_host.cc
index ec5b6c7..e1ffaeb 100644
--- a/webkit/plugins/npapi/plugin_host.cc
+++ b/webkit/plugins/npapi/plugin_host.cc
@@ -781,28 +781,6 @@ NPError NPN_GetValue(NPP id, NPNVariable variable, void* value) {
rv = NPERR_NO_ERROR;
break;
}
- case webkit::npapi::default_plugin::kMissingPluginStatusStart +
- webkit::npapi::default_plugin::MISSING_PLUGIN_AVAILABLE:
- // fall through
- case webkit::npapi::default_plugin::kMissingPluginStatusStart +
- webkit::npapi::default_plugin::MISSING_PLUGIN_USER_STARTED_DOWNLOAD: {
- // This is a hack for the default plugin to send notification to
- // renderer. Even though we check if the plugin is the default plugin,
- // we still need to worry about future standard change that may conflict
- // with the variable definition, in order to avoid duplicate case clauses
- // in this big switch statement.
- scoped_refptr<PluginInstance> plugin(FindInstance(id));
- if (!plugin.get()) {
- NOTREACHED();
- return NPERR_INVALID_INSTANCE_ERROR;
- }
- if (plugin->plugin_lib()->plugin_info().path.value() ==
- webkit::npapi::kDefaultPluginLibraryName) {
- plugin->webplugin()->OnMissingPluginStatus(variable -
- webkit::npapi::default_plugin::kMissingPluginStatusStart);
- }
- break;
- }
#if defined(OS_MACOSX)
case NPNVpluginDrawingModel: {
// return the drawing model that was negotiated when we initialized.
diff --git a/webkit/plugins/npapi/webplugin.h b/webkit/plugins/npapi/webplugin.h
index 10229b9..f9bbd14 100644
--- a/webkit/plugins/npapi/webplugin.h
+++ b/webkit/plugins/npapi/webplugin.h
@@ -111,11 +111,6 @@ class WebPlugin {
virtual std::string GetCookies(const GURL& url,
const GURL& first_party_for_cookies) = 0;
- // When a default plugin has downloaded the plugin list and finds it is
- // available, it calls this method to notify the renderer. Also it will update
- // the status when user clicks on the plugin to install.
- virtual void OnMissingPluginStatus(int status) = 0;
-
// Handles GetURL/GetURLNotify/PostURL/PostURLNotify requests initiated
// by plugins. If the plugin wants notification of the result, notify_id will
// be non-zero.
diff --git a/webkit/plugins/npapi/webplugin_delegate.h b/webkit/plugins/npapi/webplugin_delegate.h
index d2c9428..8ae84cf 100644
--- a/webkit/plugins/npapi/webplugin_delegate.h
+++ b/webkit/plugins/npapi/webplugin_delegate.h
@@ -118,9 +118,6 @@ class WebPluginDelegate {
// Indicates a failure in data receipt.
virtual void DidManualLoadFail() = 0;
- // Only supported when the plugin is the default plugin.
- virtual void InstallMissingPlugin() = 0;
-
// Creates a WebPluginResourceClient instance and returns the same.
virtual WebPluginResourceClient* CreateResourceClient(
unsigned long resource_id,
diff --git a/webkit/plugins/npapi/webplugin_delegate_impl.h b/webkit/plugins/npapi/webplugin_delegate_impl.h
index 4942d3a..84c46b9 100644
--- a/webkit/plugins/npapi/webplugin_delegate_impl.h
+++ b/webkit/plugins/npapi/webplugin_delegate_impl.h
@@ -123,7 +123,6 @@ class WebPluginDelegateImpl : public WebPluginDelegate {
virtual void DidReceiveManualData(const char* buffer, int length);
virtual void DidFinishManualLoading();
virtual void DidManualLoadFail();
- virtual void InstallMissingPlugin();
virtual WebPluginResourceClient* CreateResourceClient(
unsigned long resource_id, const GURL& url, int notify_id);
virtual WebPluginResourceClient* CreateSeekableResourceClient(
diff --git a/webkit/plugins/npapi/webplugin_delegate_impl_gtk.cc b/webkit/plugins/npapi/webplugin_delegate_impl_gtk.cc
index 7e2f584..422c95d 100644
--- a/webkit/plugins/npapi/webplugin_delegate_impl_gtk.cc
+++ b/webkit/plugins/npapi/webplugin_delegate_impl_gtk.cc
@@ -116,10 +116,6 @@ void WebPluginDelegateImpl::Paint(WebKit::WebCanvas* canvas,
WindowlessPaint(context, rect);
}
-void WebPluginDelegateImpl::InstallMissingPlugin() {
- NOTIMPLEMENTED();
-}
-
bool WebPluginDelegateImpl::WindowedCreatePlugin() {
DCHECK(!windowed_handle_);
DCHECK(!plug_);
diff --git a/webkit/plugins/npapi/webplugin_delegate_impl_mac.mm b/webkit/plugins/npapi/webplugin_delegate_impl_mac.mm
index a384e8a..bdd6eac 100644
--- a/webkit/plugins/npapi/webplugin_delegate_impl_mac.mm
+++ b/webkit/plugins/npapi/webplugin_delegate_impl_mac.mm
@@ -640,10 +640,6 @@ bool WebPluginDelegateImpl::PlatformHandleInputEvent(
return handled;
}
-void WebPluginDelegateImpl::InstallMissingPlugin() {
- NOTIMPLEMENTED();
-}
-
#pragma mark -
void WebPluginDelegateImpl::WindowlessUpdateGeometry(
diff --git a/webkit/plugins/npapi/webplugin_delegate_impl_win.cc b/webkit/plugins/npapi/webplugin_delegate_impl_win.cc
index 80582b3..ce24dec 100644
--- a/webkit/plugins/npapi/webplugin_delegate_impl_win.cc
+++ b/webkit/plugins/npapi/webplugin_delegate_impl_win.cc
@@ -532,14 +532,6 @@ void WebPluginDelegateImpl::Paint(WebKit::WebCanvas* canvas,
}
}
-void WebPluginDelegateImpl::InstallMissingPlugin() {
- NPEvent evt;
- evt.event = default_plugin::kInstallMissingPluginMessage;
- evt.lParam = 0;
- evt.wParam = 0;
- instance()->NPP_HandleEvent(&evt);
-}
-
bool WebPluginDelegateImpl::WindowedCreatePlugin() {
DCHECK(!windowed_handle_);
diff --git a/webkit/plugins/npapi/webplugin_impl.cc b/webkit/plugins/npapi/webplugin_impl.cc
index 764a071..efabcb7 100644
--- a/webkit/plugins/npapi/webplugin_impl.cc
+++ b/webkit/plugins/npapi/webplugin_impl.cc
@@ -737,10 +737,6 @@ std::string WebPluginImpl::GetCookies(const GURL& url,
return UTF16ToUTF8(cookie_jar->cookies(url, first_party_for_cookies));
}
-void WebPluginImpl::OnMissingPluginStatus(int status) {
- NOTREACHED();
-}
-
void WebPluginImpl::URLRedirectResponse(bool allow, int resource_id) {
for (size_t i = 0; i < clients_.size(); ++i) {
if (clients_[i].id == static_cast<unsigned long>(resource_id)) {
diff --git a/webkit/plugins/npapi/webplugin_impl.h b/webkit/plugins/npapi/webplugin_impl.h
index 61b7852..bc612ad 100644
--- a/webkit/plugins/npapi/webplugin_impl.h
+++ b/webkit/plugins/npapi/webplugin_impl.h
@@ -111,8 +111,6 @@ class WebPluginImpl : public WebPlugin,
const std::string& cookie);
virtual std::string GetCookies(const GURL& url,
const GURL& first_party_for_cookies);
- virtual void OnMissingPluginStatus(int status);
-
virtual void URLRedirectResponse(bool allow, int resource_id);
// Given a (maybe partial) url, completes using the base url.