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

Unified Diff: trunk/src/chrome/browser/ui/hung_plugin_tab_helper.cc

Issue 102163002: Revert 238283 "Infobar system refactor." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years 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: trunk/src/chrome/browser/ui/hung_plugin_tab_helper.cc
===================================================================
--- trunk/src/chrome/browser/ui/hung_plugin_tab_helper.cc (revision 238401)
+++ trunk/src/chrome/browser/ui/hung_plugin_tab_helper.cc (working copy)
@@ -130,15 +130,16 @@
class HungPluginInfoBarDelegate : public ConfirmInfoBarDelegate {
public:
- // Creates a hung plugin infobar and delegate and adds the infobar to
- // |infobar_service|. Returns the infobar if it was successfully added.
- static InfoBar* Create(InfoBarService* infobar_service,
- HungPluginTabHelper* helper,
- int plugin_child_id,
- const string16& plugin_name);
+ // Creates a hung plugin infobar delegate and adds it to |infobar_service|.
+ // Returns the delegate if it was successfully added.
+ static HungPluginInfoBarDelegate* Create(InfoBarService* infobar_service,
+ HungPluginTabHelper* helper,
+ int plugin_child_id,
+ const string16& plugin_name);
private:
HungPluginInfoBarDelegate(HungPluginTabHelper* helper,
+ InfoBarService* infobar_service,
int plugin_child_id,
const string16& plugin_name);
virtual ~HungPluginInfoBarDelegate();
@@ -158,20 +159,22 @@
};
// static
-InfoBar* HungPluginInfoBarDelegate::Create(InfoBarService* infobar_service,
- HungPluginTabHelper* helper,
- int plugin_child_id,
- const string16& plugin_name) {
- return infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar(
- scoped_ptr<ConfirmInfoBarDelegate>(new HungPluginInfoBarDelegate(
- helper, plugin_child_id, plugin_name))));
+HungPluginInfoBarDelegate* HungPluginInfoBarDelegate::Create(
+ InfoBarService* infobar_service,
+ HungPluginTabHelper* helper,
+ int plugin_child_id,
+ const string16& plugin_name) {
+ return static_cast<HungPluginInfoBarDelegate*>(infobar_service->AddInfoBar(
+ scoped_ptr<InfoBarDelegate>(new HungPluginInfoBarDelegate(
+ helper, infobar_service, plugin_child_id, plugin_name))));
}
HungPluginInfoBarDelegate::HungPluginInfoBarDelegate(
HungPluginTabHelper* helper,
+ InfoBarService* infobar_service,
int plugin_child_id,
const string16& plugin_name)
- : ConfirmInfoBarDelegate(),
+ : ConfirmInfoBarDelegate(infobar_service),
helper_(helper),
plugin_child_id_(plugin_child_id),
message_(l10n_util::GetStringFUTF16(
@@ -220,7 +223,7 @@
string16 name;
// Possibly-null if we're not showing an infobar right now.
- InfoBar* infobar;
+ InfoBarDelegate* infobar;
// Time to delay before re-showing the infobar for a hung plugin. This is
// increased each time the user cancels it.
@@ -324,7 +327,14 @@
const content::NotificationSource& source,
const content::NotificationDetails& details) {
DCHECK_EQ(chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_REMOVED, type);
- InfoBar* infobar = content::Details<InfoBar::RemovedDetails>(details)->first;
+ // Note: do not dereference. The InfoBarContainer will delete the object when
+ // it gets this notification, we only remove our tracking info, if we have
+ // any.
+ //
+ // TODO(pkasting): This comment will be incorrect and should be removed once
+ // InfoBars own their delegates.
+ InfoBarDelegate* infobar =
+ content::Details<InfoBar::RemovedDetails>(details)->first;
for (PluginStateMap::iterator i = hung_plugins_.begin();
i != hung_plugins_.end(); ++i) {
PluginState* state = i->second.get();

Powered by Google App Engine
This is Rietveld 408576698