summaryrefslogtreecommitdiffstats
path: root/chrome/browser/plugin_installer.cc
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-25 01:06:05 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-25 01:06:05 +0000
commitf86a07024080cd1b000105bce34ce45b2bd5159b (patch)
treed47e27fae62581ffb7f4e4209c7dd0106b88763f /chrome/browser/plugin_installer.cc
parent2d42a37132679537eb9e8db9f45a6dfe92dde996 (diff)
downloadchromium_src-f86a07024080cd1b000105bce34ce45b2bd5159b.zip
chromium_src-f86a07024080cd1b000105bce34ce45b2bd5159b.tar.gz
chromium_src-f86a07024080cd1b000105bce34ce45b2bd5159b.tar.bz2
Re-land 5929 (r5882) with crash fix and also this change:
http://codereview.chromium.org/11392/show which fixes the remainder of the UI test issues apparently. http://crbug.com/4620 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5954 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/plugin_installer.cc')
-rw-r--r--chrome/browser/plugin_installer.cc62
1 files changed, 20 insertions, 42 deletions
diff --git a/chrome/browser/plugin_installer.cc b/chrome/browser/plugin_installer.cc
index 1d42d80..afd0314 100644
--- a/chrome/browser/plugin_installer.cc
+++ b/chrome/browser/plugin_installer.cc
@@ -4,9 +4,9 @@
#include "chrome/browser/plugin_installer.h"
-#include "chrome/app/theme/theme_resources.h"
-#include "chrome/browser/web_contents_view.h"
#include "base/string_util.h"
+#include "chrome/app/theme/theme_resources.h"
+#include "chrome/browser/web_contents.h"
#include "chrome/common/l10n_util.h"
#include "chrome/common/resource_bundle.h"
#include "webkit/default_plugin/default_plugin_shared.h"
@@ -15,33 +15,24 @@
PluginInstaller::PluginInstaller(WebContents* web_contents)
: web_contents_(web_contents),
- current_bar_(NULL) {
+ ConfirmInfoBarDelegate(web_contents) {
}
PluginInstaller::~PluginInstaller() {
- if (current_bar_)
- current_bar_->Close();
+ // Remove any InfoBars we may be showing.
+ web_contents_->RemoveInfoBar(this);
}
void PluginInstaller::OnMissingPluginStatus(int status) {
switch(status) {
case default_plugin::MISSING_PLUGIN_AVAILABLE: {
- // Display missing plugin InfoBar if a missing plugin is available.
- if (current_bar_)
- return;
-
- // TODO(brettw) have a more general way to add to the info bar rather
- // than mucking with it directly.
- InfoBarView* view = web_contents_->view()->GetInfoBarView();
- current_bar_ = new PluginInstallerBar(this);
- view->AddChildView(current_bar_);
+ web_contents_->AddInfoBar(this);
break;
}
case default_plugin::MISSING_PLUGIN_USER_STARTED_DOWNLOAD: {
// Hide the InfoBar if user already started download/install of the
// missing plugin.
- if (current_bar_)
- current_bar_->Close();
+ web_contents_->RemoveInfoBar(this);
break;
}
default: {
@@ -51,38 +42,25 @@ void PluginInstaller::OnMissingPluginStatus(int status) {
}
}
-void PluginInstaller::OnStartLoading() {
- if (current_bar_)
- current_bar_->BeginClose();
-}
-
-void PluginInstaller::OnBarDestroy(InfoBarConfirmView* bar) {
- if (current_bar_ == bar)
- current_bar_ = NULL;
+std::wstring PluginInstaller::GetMessageText() const {
+ return l10n_util::GetString(IDS_PLUGININSTALLER_MISSINGPLUGIN_PROMPT);
}
-void PluginInstaller::OnOKButtonPressed() {
- current_bar_->BeginClose();
- web_contents_->render_view_host()->InstallMissingPlugin();
+SkBitmap* PluginInstaller::GetIcon() const {
+ return ResourceBundle::GetSharedInstance().GetBitmapNamed(
+ IDR_INFOBAR_PLUGIN_INSTALL);
}
-PluginInstaller::PluginInstallerBar
- ::PluginInstallerBar(PluginInstaller* plugin_installer)
- : plugin_installer_(plugin_installer),
- InfoBarConfirmView(
- l10n_util::GetString(IDS_PLUGININSTALLER_MISSINGPLUGIN_PROMPT)) {
- SetOKButtonLabel(
- l10n_util::GetString(IDS_PLUGININSTALLER_INSTALLPLUGIN_BUTTON));
- RemoveCancelButton();
- ResourceBundle &rb = ResourceBundle::GetSharedInstance();
- SetIcon(*rb.GetBitmapNamed(IDR_INFOBAR_PLUGIN_INSTALL));
+int PluginInstaller::GetButtons() const {
+ return BUTTON_OK;
}
-PluginInstaller::PluginInstallerBar::~PluginInstallerBar() {
- plugin_installer_->OnBarDestroy(this);
+std::wstring PluginInstaller::GetButtonLabel(InfoBarButton button) const {
+ if (button == BUTTON_OK)
+ return l10n_util::GetString(IDS_PLUGININSTALLER_INSTALLPLUGIN_BUTTON);
+ return ConfirmInfoBarDelegate::GetButtonLabel(button);
}
-void PluginInstaller::PluginInstallerBar::OKButtonPressed() {
- plugin_installer_->OnOKButtonPressed();
+void PluginInstaller::Accept() {
+ web_contents_->render_view_host()->InstallMissingPlugin();
}
-