Chromium Code Reviews| Index: chrome/browser/plugin_observer.cc |
| =================================================================== |
| --- chrome/browser/plugin_observer.cc (revision 98657) |
| +++ chrome/browser/plugin_observer.cc (working copy) |
| @@ -292,45 +292,57 @@ |
| 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) |
| - IPC_MESSAGE_UNHANDLED(return false) |
| - IPC_END_MESSAGE_MAP() |
| +void PluginObserver::OnMissingPluginStatus(int status, |
|
jam
2011/08/31 17:34:42
why is this method now on PluginObserver, since it
ananta
2011/08/31 20:18:14
Moved the handling to ChromePluginMessageFilter.
|
| + int render_process_id, |
| + int render_view_id, |
| + int 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; |
| - return true; |
| -} |
| + TabContentsWrapper* tcw = TabContentsWrapper::GetCurrentWrapperForContents( |
| + host->delegate()->GetAsTabContents()); |
| + if (!tcw) |
| + return; |
| -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())); |
| + 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 < tab_contents_->infobar_count(); ++i) { |
| - InfoBarDelegate* delegate = tab_contents_->GetInfoBarDelegateAt(i); |
| + for (size_t i = 0; i < tcw->infobar_count(); ++i) { |
| + InfoBarDelegate* delegate = tcw->GetInfoBarDelegateAt(i); |
| if (delegate->AsPluginInstallerInfoBarDelegate() != NULL) { |
| - tab_contents_->RemoveInfoBar(delegate); |
| + tcw->RemoveInfoBar(delegate); |
| return; |
| } |
| } |
| -#endif |
| +#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 |
| } |
| +bool PluginObserver::OnMessageReceived(const IPC::Message& message) { |
| + IPC_BEGIN_MESSAGE_MAP(PluginObserver, message) |
| + IPC_MESSAGE_HANDLER(ViewHostMsg_CrashedPlugin, OnCrashedPlugin) |
| + IPC_MESSAGE_HANDLER(ChromeViewHostMsg_BlockedOutdatedPlugin, |
| + OnBlockedOutdatedPlugin) |
| + IPC_MESSAGE_UNHANDLED(return false) |
| + IPC_END_MESSAGE_MAP() |
| + |
| + return true; |
| +} |
| + |
| void PluginObserver::OnCrashedPlugin(const FilePath& plugin_path) { |
| DCHECK(!plugin_path.value().empty()); |