Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(817)

Unified Diff: chrome/browser/plugin_observer.cc

Issue 7810002: Move infobar handling to a tab helper. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/plugin_observer.cc
diff --git a/chrome/browser/plugin_observer.cc b/chrome/browser/plugin_observer.cc
index 4555ff88220f6f1e5309e923d73ec3483cdb2bc1..d88864944327652f01ffa5b5371413ce87e1f835 100644
--- a/chrome/browser/plugin_observer.cc
+++ b/chrome/browser/plugin_observer.cc
@@ -7,6 +7,7 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/google/google_util.h"
+#include "chrome/browser/infobars/infobar_tab_helper.h"
#include "chrome/browser/plugin_installer_infobar_delegate.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
@@ -314,17 +315,20 @@ 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(
+ tab_contents_->infobar_tab_helper()->AddInfoBar(
Peter Kasting 2011/08/31 18:47:32 Nit: Factor this infobar_tab_helper() out to a tem
new PluginInstallerInfoBarDelegate(tab_contents()));
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 < tab_contents_->infobar_tab_helper()->infobar_count();
+ ++i) {
+ InfoBarDelegate* delegate =
+ tab_contents_->infobar_tab_helper()->GetInfoBarDelegateAt(i);
if (delegate->AsPluginInstallerInfoBarDelegate() != NULL) {
- tab_contents_->RemoveInfoBar(delegate);
+ tab_contents_->infobar_tab_helper()->RemoveInfoBar(delegate);
return;
}
}
@@ -350,15 +354,17 @@ void PluginObserver::OnCrashedPlugin(const FilePath& plugin_path) {
}
gfx::Image* icon = &ResourceBundle::GetSharedInstance().GetNativeImageNamed(
IDR_INFOBAR_PLUGIN_CRASHED);
- tab_contents_->AddInfoBar(new SimpleAlertInfoBarDelegate(tab_contents(),
- icon,
- l10n_util::GetStringFUTF16(IDS_PLUGIN_CRASHED_PROMPT, plugin_name),
- true));
+ tab_contents_->infobar_tab_helper()->AddInfoBar(
+ new SimpleAlertInfoBarDelegate(
+ tab_contents(),
+ icon,
+ l10n_util::GetStringFUTF16(IDS_PLUGIN_CRASHED_PROMPT, plugin_name),
+ true));
}
void PluginObserver::OnBlockedOutdatedPlugin(const string16& name,
const GURL& update_url) {
- tab_contents_->AddInfoBar(update_url.is_empty() ?
+ tab_contents_->infobar_tab_helper()->AddInfoBar(update_url.is_empty() ?
static_cast<InfoBarDelegate*>(new BlockedPluginInfoBarDelegate(
tab_contents(), name)) :
new OutdatedPluginInfoBarDelegate(tab_contents(), name, update_url));

Powered by Google App Engine
This is Rietveld 408576698