summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-18 16:16:59 +0000
committerbauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-18 16:16:59 +0000
commit4f62d805c9db0281bde49a21e53a81d10470a776 (patch)
treeb868a1551cf6054a330a443715eb73e56ce661df
parent4750890f63f8d5d637192d1fc6d75f4ab3498507 (diff)
downloadchromium_src-4f62d805c9db0281bde49a21e53a81d10470a776.zip
chromium_src-4f62d805c9db0281bde49a21e53a81d10470a776.tar.gz
chromium_src-4f62d805c9db0281bde49a21e53a81d10470a776.tar.bz2
Add IPC message to open chrome://plugins from a missing plug-in placeholder.
BUG=110443 TEST=see bug for manual test Review URL: http://codereview.chromium.org/9244011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118100 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/plugin_observer.cc11
-rw-r--r--chrome/browser/plugin_observer.h1
-rw-r--r--chrome/common/render_messages.h7
-rw-r--r--chrome/renderer/plugins/blocked_plugin.cc26
-rw-r--r--chrome/renderer/plugins/blocked_plugin.h9
-rw-r--r--chrome/renderer/resources/disabled_plugin.html2
6 files changed, 31 insertions, 25 deletions
diff --git a/chrome/browser/plugin_observer.cc b/chrome/browser/plugin_observer.cc
index b2700b2..eb85064 100644
--- a/chrome/browser/plugin_observer.cc
+++ b/chrome/browser/plugin_observer.cc
@@ -419,6 +419,9 @@ bool PluginObserver::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(ChromeViewHostMsg_FindMissingPlugin,
OnFindMissingPlugin)
#endif
+ IPC_MESSAGE_HANDLER(ChromeViewHostMsg_OpenAboutPlugins,
+ OnOpenAboutPlugins)
+
IPC_MESSAGE_UNHANDLED(return false)
IPC_END_MESSAGE_MAP()
@@ -485,3 +488,11 @@ void PluginObserver::InstallMissingPlugin(PluginInstaller* installer) {
}
}
#endif // defined(ENABLE_PLUGIN_INSTALLATION)
+
+void PluginObserver::OnOpenAboutPlugins() {
+ web_contents()->OpenURL(OpenURLParams(
+ GURL(chrome::kAboutPluginsURL),
+ content::Referrer(web_contents()->GetURL(),
+ WebKit::WebReferrerPolicyDefault),
+ NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_TYPED, false));
+}
diff --git a/chrome/browser/plugin_observer.h b/chrome/browser/plugin_observer.h
index 2acca57..e8b8fdd 100644
--- a/chrome/browser/plugin_observer.h
+++ b/chrome/browser/plugin_observer.h
@@ -48,6 +48,7 @@ class PluginObserver : public content::WebContentsObserver {
void DidNotFindMissingPlugin(int placeholder_id);
void InstallMissingPlugin(PluginInstaller* installer);
#endif
+ void OnOpenAboutPlugins();
base::WeakPtrFactory<PluginObserver> weak_ptr_factory_;
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index 98a1b8a..dfcb00b 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -446,12 +446,17 @@ IPC_MESSAGE_ROUTED0(ChromeViewMsg_StartedDownloadingPlugin)
// Notifies a missing plug-in placeholder that we have finished downloading
// the plug-in.
IPC_MESSAGE_ROUTED0(ChromeViewMsg_FinishedDownloadingPlugin)
-#endif // defined(ENABLE_PLUGIN_INSTALLATION)
// Notifies a missing plug-in placeholder that there was an error downloading
// the plug-in.
IPC_MESSAGE_ROUTED1(ChromeViewMsg_ErrorDownloadingPlugin,
std::string /* message */)
+#endif // defined(ENABLE_PLUGIN_INSTALLATION)
+
+// Tells the browser to open chrome://plugins in a new tab. We use a separate
+// message because renderer processes aren't allowed to directly navigate to
+// chrome:// URLs.
+IPC_MESSAGE_ROUTED0(ChromeViewHostMsg_OpenAboutPlugins)
// Specifies the URL as the first parameter (a wstring) and thumbnail as
// binary data as the second parameter.
diff --git a/chrome/renderer/plugins/blocked_plugin.cc b/chrome/renderer/plugins/blocked_plugin.cc
index 3ae7cf2..ccabb20 100644
--- a/chrome/renderer/plugins/blocked_plugin.cc
+++ b/chrome/renderer/plugins/blocked_plugin.cc
@@ -102,8 +102,9 @@ void BlockedPlugin::BindWebFrame(WebFrame* frame) {
base::Unretained(this)));
BindCallback("hide", base::Bind(&BlockedPlugin::HideCallback,
base::Unretained(this)));
- BindCallback("openURL", base::Bind(&BlockedPlugin::OpenUrlCallback,
- base::Unretained(this)));
+ BindCallback("openAboutPlugins",
+ base::Bind(&BlockedPlugin::OpenAboutPluginsCallback,
+ base::Unretained(this)));
}
void BlockedPlugin::ShowContextMenu(const WebKit::WebMouseEvent& event) {
@@ -219,23 +220,10 @@ void BlockedPlugin::HideCallback(const CppArgumentList& args,
HidePlugin();
}
-void BlockedPlugin::OpenUrlCallback(const CppArgumentList& args,
- CppVariant* result) {
- if (args.size() < 1) {
- NOTREACHED();
- return;
- }
- if (!args[0].isString()) {
- NOTREACHED();
- return;
- }
-
- GURL url(args[0].ToString());
- WebURLRequest request;
- request.initialize();
- request.setURL(url);
- render_view()->LoadURLExternally(
- frame(), request, WebKit::WebNavigationPolicyNewForegroundTab);
+void BlockedPlugin::OpenAboutPluginsCallback(const CppArgumentList& args,
+ CppVariant* result) {
+ RenderThread::Get()->Send(
+ new ChromeViewHostMsg_OpenAboutPlugins(routing_id()));
}
void BlockedPlugin::HidePlugin() {
diff --git a/chrome/renderer/plugins/blocked_plugin.h b/chrome/renderer/plugins/blocked_plugin.h
index 597b5e7..453aa93 100644
--- a/chrome/renderer/plugins/blocked_plugin.h
+++ b/chrome/renderer/plugins/blocked_plugin.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -59,9 +59,10 @@ class BlockedPlugin : public PluginPlaceholder {
// Takes no arguments, and returns nothing.
void HideCallback(const CppArgumentList& args, CppVariant* result);
- // Opens a URL in a new tab.
- // Takes one argument, a string specifying the URL to open. Returns nothing.
- void OpenUrlCallback(const CppArgumentList& args, CppVariant* result);
+ // Opens chrome://plugins in a new tab.
+ // Takes no arguments, and returns nothing.
+ void OpenAboutPluginsCallback(const CppArgumentList& args,
+ CppVariant* result);
// Load the blocked plugin.
void LoadPlugin();
diff --git a/chrome/renderer/resources/disabled_plugin.html b/chrome/renderer/resources/disabled_plugin.html
index 579aa7c..ad035ca 100644
--- a/chrome/renderer/resources/disabled_plugin.html
+++ b/chrome/renderer/resources/disabled_plugin.html
@@ -88,7 +88,7 @@ p {
<div id="inner">
<div><img id="plugin_icon" src="plugin_blocked.png" /></div>
<h1 id="message" i18n-content="message">PLUGIN DISABLED (chrome://plugins)</h1>
-<div id="enable_link"><a href="" onclick="plugin.openURL('chrome://plugins');">chrome://plugins</a></div>
+<div id="enable_link"><a href="#" onclick="plugin.openAboutPlugins();">chrome://plugins</a></div>
<p id="debug"> </p>
</div>
<div id="close" i18n-values="title:hide" onclick="plugin.hide();" />