summaryrefslogtreecommitdiffstats
path: root/chrome/browser/plugin_observer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/plugin_observer.cc')
-rw-r--r--chrome/browser/plugin_observer.cc32
1 files changed, 18 insertions, 14 deletions
diff --git a/chrome/browser/plugin_observer.cc b/chrome/browser/plugin_observer.cc
index dabdac1..da09dc6 100644
--- a/chrome/browser/plugin_observer.cc
+++ b/chrome/browser/plugin_observer.cc
@@ -11,10 +11,10 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/tab_contents/confirm_infobar_delegate.h"
#include "chrome/browser/tab_contents/simple_alert_infobar_delegate.h"
+#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/url_constants.h"
#include "content/browser/renderer_host/render_view_host.h"
-#include "content/browser/tab_contents/tab_contents.h"
#include "content/browser/user_metrics.h"
#include "content/common/view_messages.h"
#include "grit/generated_resources.h"
@@ -303,17 +303,19 @@ 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()));
+ TabContentsWrapper::GetCurrentWrapperForContents(tab_contents())->
+ AddInfoBar(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);
+ TabContentsWrapper* wrapper =
+ TabContentsWrapper::GetCurrentWrapperForContents(tab_contents());
+ for (size_t i = 0; i < wrapper->infobar_count(); ++i) {
+ InfoBarDelegate* delegate = wrapper->GetInfoBarDelegateAt(i);
if (delegate->AsPluginInstallerInfoBarDelegate() != NULL) {
- tab_contents()->RemoveInfoBar(delegate);
+ wrapper->RemoveInfoBar(delegate);
return;
}
}
@@ -339,16 +341,18 @@ 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));
+ TabContentsWrapper::GetCurrentWrapperForContents(tab_contents())->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() ?
- static_cast<InfoBarDelegate*>(new BlockedPluginInfoBarDelegate(
- tab_contents(), name)) :
- new OutdatedPluginInfoBarDelegate(tab_contents(), name, update_url));
+ TabContentsWrapper::GetCurrentWrapperForContents(tab_contents())->AddInfoBar(
+ update_url.is_empty() ?
+ static_cast<InfoBarDelegate*>(new BlockedPluginInfoBarDelegate(
+ tab_contents(), name)) :
+ new OutdatedPluginInfoBarDelegate(tab_contents(), name, update_url));
}