Chromium Code Reviews| Index: chrome/renderer/plugins/chrome_plugin_placeholder.cc |
| diff --git a/chrome/renderer/plugins/chrome_plugin_placeholder.cc b/chrome/renderer/plugins/chrome_plugin_placeholder.cc |
| index 0f35197e27cbaacbde7c35fa4d943306f4e8f3fe..a42759dc90b26c857127f353e9023704da7d5d78 100644 |
| --- a/chrome/renderer/plugins/chrome_plugin_placeholder.cc |
| +++ b/chrome/renderer/plugins/chrome_plugin_placeholder.cc |
| @@ -74,10 +74,10 @@ ChromePluginPlaceholder::~ChromePluginPlaceholder() { |
| if (context_menu_request_id_ && render_frame()) |
| render_frame()->CancelContextMenu(context_menu_request_id_); |
| -#if defined(ENABLE_PLUGIN_INSTALLATION) |
| if (placeholder_routing_id_ == MSG_ROUTING_NONE) |
| return; |
| RenderThread::Get()->RemoveRoute(placeholder_routing_id_); |
| +#if defined(ENABLE_PLUGIN_INSTALLATION) |
| if (has_host_) { |
| RenderThread::Get()->Send(new ChromeViewHostMsg_RemovePluginPlaceholderHost( |
| routing_id(), placeholder_routing_id_)); |
| @@ -175,17 +175,15 @@ void ChromePluginPlaceholder::SetStatus( |
| status_ = status; |
| } |
| -#if defined(ENABLE_PLUGIN_INSTALLATION) |
| int32_t ChromePluginPlaceholder::CreateRoutingId() { |
| placeholder_routing_id_ = RenderThread::Get()->GenerateRoutingID(); |
| RenderThread::Get()->AddRoute(placeholder_routing_id_, this); |
| return placeholder_routing_id_; |
| } |
| -#endif |
| bool ChromePluginPlaceholder::OnMessageReceived(const IPC::Message& message) { |
| -#if defined(ENABLE_PLUGIN_INSTALLATION) |
| bool handled = true; |
| +#if defined(ENABLE_PLUGIN_INSTALLATION) |
| IPC_BEGIN_MESSAGE_MAP(ChromePluginPlaceholder, message) |
| IPC_MESSAGE_HANDLER(ChromeViewMsg_FoundMissingPlugin, OnFoundMissingPlugin) |
| IPC_MESSAGE_HANDLER(ChromeViewMsg_DidNotFindMissingPlugin, |
| @@ -205,6 +203,20 @@ bool ChromePluginPlaceholder::OnMessageReceived(const IPC::Message& message) { |
| return true; |
| #endif |
| + handled = true; |
| + IPC_BEGIN_MESSAGE_MAP(ChromePluginPlaceholder, message) |
| + IPC_MESSAGE_HANDLER(ChromeViewMsg_PluginComponentUpdateDownloading, |
|
Bernhard Bauer
2016/07/28 10:25:10
Couldn't you merge these message handlers into the
waffles
2016/07/28 20:06:27
Done.
|
| + OnPluginComponentUpdateDownloading) |
| + IPC_MESSAGE_HANDLER(ChromeViewMsg_PluginComponentUpdateSuccess, |
| + OnPluginComponentUpdateSuccess) |
| + IPC_MESSAGE_HANDLER(ChromeViewMsg_PluginComponentUpdateFailure, |
| + OnPluginComponentUpdateFailure) |
| + IPC_MESSAGE_UNHANDLED(handled = false) |
| + IPC_END_MESSAGE_MAP() |
| + |
| + if (handled) |
| + return true; |
| + |
| // We don't swallow these messages because multiple blocked plugins and other |
| // objects have an interest in them. |
| IPC_BEGIN_MESSAGE_MAP(ChromePluginPlaceholder, message) |
| @@ -257,6 +269,19 @@ void ChromePluginPlaceholder::OnCancelledDownloadingPlugin() { |
| } |
| #endif // defined(ENABLE_PLUGIN_INSTALLATION) |
| +void ChromePluginPlaceholder::OnPluginComponentUpdateDownloading() { |
| + SetMessage(l10n_util::GetStringFUTF16(IDS_PLUGIN_DOWNLOADING, plugin_name_)); |
| +} |
| + |
| +void ChromePluginPlaceholder::OnPluginComponentUpdateSuccess() { |
| + PluginListChanged(); |
| +} |
| + |
| +void ChromePluginPlaceholder::OnPluginComponentUpdateFailure() { |
| + SetMessage(l10n_util::GetStringFUTF16(IDS_PLUGIN_DOWNLOAD_ERROR_SHORT, |
| + plugin_name_)); |
| +} |
| + |
| void ChromePluginPlaceholder::PluginListChanged() { |
| if (!GetFrame() || !plugin()) |
| return; |