diff options
author | bauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-31 13:50:34 +0000 |
---|---|---|
committer | bauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-31 13:50:34 +0000 |
commit | cc5f78155f857e3e2a3570fe56e06a219e2eb839 (patch) | |
tree | cd4e8d47b5a1c1917bfb57860ee9b6516e424318 /chrome | |
parent | bc283e13693260a986454f6b8b176e406ac8b670 (diff) | |
download | chromium_src-cc5f78155f857e3e2a3570fe56e06a219e2eb839.zip chromium_src-cc5f78155f857e3e2a3570fe56e06a219e2eb839.tar.gz chromium_src-cc5f78155f857e3e2a3570fe56e06a219e2eb839.tar.bz2 |
Show infobar when a plug-in couldn't be loaded.
BUG=123580
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10448098
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139781 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/app/generated_resources.grd | 5 | ||||
-rw-r--r-- | chrome/browser/plugin_observer.cc | 26 | ||||
-rw-r--r-- | chrome/browser/plugin_observer.h | 1 | ||||
-rw-r--r-- | chrome/common/render_messages.h | 4 | ||||
-rw-r--r-- | chrome/renderer/plugins/plugin_placeholder.cc | 3 |
5 files changed, 33 insertions, 6 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 1b10bc3..d3545f9 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -10293,7 +10293,10 @@ experiment id: "<ph name="EXPERIMENT_ID">$5<ex>ar1</ex></ph>" Try again </message> <message name="IDS_PLUGIN_CRASHED_PROMPT" desc="Info Bar message to notify about a crashed plugin"> - The following plug-in has crashed: <ph name="PLUGIN_NAME">$1<ex>Shockwave</ex></ph> + <ph name="PLUGIN_NAME">$1<ex>Shockwave</ex> has crashed.</ph> + </message> + <message name="IDS_PLUGIN_INITIALIZATION_ERROR_PROMPT" desc="Info Bar message to notify that we couldn't load a plugin"> + Could not load <ph name="PLUGIN_NAME">$1<ex>Shockwave</ex>.</ph> </message> <message name="IDS_WEBWORKER_CRASHED_PROMPT" desc="Info Bar message to notify about a crashed WebWorker"> A part of this page (HTML WebWorker) has crashed, so it might not function correctly. diff --git a/chrome/browser/plugin_observer.cc b/chrome/browser/plugin_observer.cc index 094a9a5..5497c5c 100644 --- a/chrome/browser/plugin_observer.cc +++ b/chrome/browser/plugin_observer.cc @@ -202,6 +202,8 @@ bool PluginObserver::OnMessageReceived(const IPC::Message& message) { #endif IPC_MESSAGE_HANDLER(ChromeViewHostMsg_OpenAboutPlugins, OnOpenAboutPlugins) + IPC_MESSAGE_HANDLER(ChromeViewHostMsg_CouldNotLoadPlugin, + OnCouldNotLoadPlugin) IPC_MESSAGE_UNHANDLED(return false) IPC_END_MESSAGE_MAP() @@ -298,9 +300,23 @@ void PluginObserver::OnRemovePluginPlaceholderHost(int placeholder_id) { #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)); + web_contents()->OpenURL(OpenURLParams( + GURL(chrome::kAboutPluginsURL), + content::Referrer(web_contents()->GetURL(), + WebKit::WebReferrerPolicyDefault), + NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_AUTO_BOOKMARK, false)); } + +void PluginObserver::OnCouldNotLoadPlugin(const FilePath& plugin_path) { + string16 plugin_name = + PluginService::GetInstance()->GetPluginDisplayNameByPath(plugin_path); + InfoBarTabHelper* infobar_helper = tab_contents_->infobar_tab_helper(); + infobar_helper->AddInfoBar(new SimpleAlertInfoBarDelegate( + infobar_helper, + &ResourceBundle::GetSharedInstance().GetNativeImageNamed( + IDR_INFOBAR_PLUGIN_CRASHED), + l10n_util::GetStringFUTF16(IDS_PLUGIN_INITIALIZATION_ERROR_PROMPT, + plugin_name), + true /* auto_expire */)); +} + diff --git a/chrome/browser/plugin_observer.h b/chrome/browser/plugin_observer.h index 39287f2..3861f76 100644 --- a/chrome/browser/plugin_observer.h +++ b/chrome/browser/plugin_observer.h @@ -57,6 +57,7 @@ class PluginObserver : public content::WebContentsObserver { void OnRemovePluginPlaceholderHost(int placeholder_id); #endif void OnOpenAboutPlugins(); + void OnCouldNotLoadPlugin(const FilePath& plugin_path); base::WeakPtrFactory<PluginObserver> weak_ptr_factory_; diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index dec2997..ff023cf 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -462,6 +462,10 @@ IPC_MESSAGE_ROUTED0(ChromeViewMsg_CancelledDownloadingPlugin) // chrome:// URLs. IPC_MESSAGE_ROUTED0(ChromeViewHostMsg_OpenAboutPlugins) +// Tells the browser that there was an error loading a plug-in. +IPC_MESSAGE_ROUTED1(ChromeViewHostMsg_CouldNotLoadPlugin, + FilePath /* plugin_path */) + // Specifies the URL as the first parameter (a wstring) and thumbnail as // binary data as the second parameter. IPC_MESSAGE_ROUTED3(ChromeViewHostMsg_Thumbnail, diff --git a/chrome/renderer/plugins/plugin_placeholder.cc b/chrome/renderer/plugins/plugin_placeholder.cc index cf85d24..a55ede4 100644 --- a/chrome/renderer/plugins/plugin_placeholder.cc +++ b/chrome/renderer/plugins/plugin_placeholder.cc @@ -142,6 +142,9 @@ PluginPlaceholder* PluginPlaceholder::CreateErrorPlugin( PluginPlaceholder* plugin = new PluginPlaceholder( render_view, NULL, params, html_data, params.mimeType); + RenderThread::Get()->Send( + new ChromeViewHostMsg_CouldNotLoadPlugin(plugin->routing_id(), + file_path)); return plugin; } |