summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-13 21:40:05 +0000
committerbauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-13 21:40:05 +0000
commitdd840a3fabf0def317a186433dff7cb7be20ea72 (patch)
treec2a0f806007397b670e2387010d4b6164f66239e
parent15438a027b0edc9c4eb0f9664374f276c148a7cd (diff)
downloadchromium_src-dd840a3fabf0def317a186433dff7cb7be20ea72.zip
chromium_src-dd840a3fabf0def317a186433dff7cb7be20ea72.tar.gz
chromium_src-dd840a3fabf0def317a186433dff7cb7be20ea72.tar.bz2
Check owner in PluginInstallerInfobarDelegate before removing itself.
Also, don't show the infobar if we're downloading the plug-in. BUG=110032 TEST=see bug for manual test Review URL: http://codereview.chromium.org/9188040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117702 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/plugin_installer_infobar_delegate.cc3
-rw-r--r--chrome/browser/plugin_observer.cc9
-rw-r--r--chrome/browser/plugin_observer.h3
3 files changed, 11 insertions, 4 deletions
diff --git a/chrome/browser/plugin_installer_infobar_delegate.cc b/chrome/browser/plugin_installer_infobar_delegate.cc
index 6917b2e..9e040c8 100644
--- a/chrome/browser/plugin_installer_infobar_delegate.cc
+++ b/chrome/browser/plugin_installer_infobar_delegate.cc
@@ -88,5 +88,6 @@ bool PluginInstallerInfoBarDelegate::LinkClicked(
}
void PluginInstallerInfoBarDelegate::DidStartDownload() {
- owner()->RemoveInfoBar(this);
+ if (owner())
+ owner()->RemoveInfoBar(this);
}
diff --git a/chrome/browser/plugin_observer.cc b/chrome/browser/plugin_observer.cc
index 91f30f9..b2700b2 100644
--- a/chrome/browser/plugin_observer.cc
+++ b/chrome/browser/plugin_observer.cc
@@ -371,6 +371,7 @@ class PluginObserver::MissingPluginHost : public PluginInstallerObserver {
case PluginInstaller::kStateIdle: {
observer->Send(new ChromeViewMsg_FoundMissingPlugin(routing_id_,
installer->name()));
+ observer->ShowPluginInstallationInfoBar(installer);
break;
}
case PluginInstaller::kStateDownloading: {
@@ -453,15 +454,17 @@ void PluginObserver::FoundMissingPlugin(int placeholder_id,
PluginInstaller* installer) {
missing_plugins_.push_back(
new MissingPluginHost(this, placeholder_id, installer));
+}
+
+void PluginObserver::ShowPluginInstallationInfoBar(PluginInstaller* installer) {
InfoBarTabHelper* infobar_helper = tab_contents_->infobar_tab_helper();
- PluginInstallerInfoBarDelegate* delegate = new PluginInstallerInfoBarDelegate(
+ infobar_helper->AddInfoBar(new PluginInstallerInfoBarDelegate(
installer,
infobar_helper,
installer->name(),
installer->help_url(),
base::Bind(&PluginObserver::InstallMissingPlugin,
- weak_ptr_factory_.GetWeakPtr(), installer));
- infobar_helper->AddInfoBar(delegate);
+ weak_ptr_factory_.GetWeakPtr(), installer)));
}
void PluginObserver::DidNotFindMissingPlugin(int placeholder_id) {
diff --git a/chrome/browser/plugin_observer.h b/chrome/browser/plugin_observer.h
index 9deaedd..2acca57 100644
--- a/chrome/browser/plugin_observer.h
+++ b/chrome/browser/plugin_observer.h
@@ -30,6 +30,9 @@ class PluginObserver : public content::WebContentsObserver {
// content::WebContentsObserver implementation.
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
+ // Shows the infobar that offers to install a missing plug-in.
+ void ShowPluginInstallationInfoBar(PluginInstaller* installer);
+
private:
#if defined(ENABLE_PLUGIN_INSTALLATION)
class MissingPluginHost;