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

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

Issue 11644059: Change infobar creation to use a public static Create() method on the infobar delegate classes. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 11 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
« no previous file with comments | « chrome/browser/ui/gtk/collected_cookies_gtk.cc ('k') | chrome/browser/ui/media_stream_infobar_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/hung_plugin_tab_helper.cc
===================================================================
--- chrome/browser/ui/hung_plugin_tab_helper.cc (revision 175396)
+++ chrome/browser/ui/hung_plugin_tab_helper.cc (working copy)
@@ -124,11 +124,12 @@
class HungPluginInfoBarDelegate : public ConfirmInfoBarDelegate {
public:
- HungPluginInfoBarDelegate(HungPluginTabHelper* helper,
- InfoBarService* infobar_service,
- int plugin_child_id,
- const string16& plugin_name);
- virtual ~HungPluginInfoBarDelegate();
+ // Creates a hung plugin 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);
// ConfirmInfoBarDelegate:
virtual gfx::Image* GetIcon() const OVERRIDE;
@@ -138,6 +139,12 @@
virtual bool Accept() OVERRIDE;
private:
+ HungPluginInfoBarDelegate(HungPluginTabHelper* helper,
+ InfoBarService* infobar_service,
+ int plugin_child_id,
+ const string16& plugin_name);
+ virtual ~HungPluginInfoBarDelegate();
+
HungPluginTabHelper* helper_;
int plugin_child_id_;
@@ -146,6 +153,17 @@
gfx::Image* icon_;
};
+// static
+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,
@@ -362,9 +380,9 @@
return;
DCHECK(!state->info_bar);
- state->info_bar = new HungPluginInfoBarDelegate(this, infobar_service,
- child_id, state->name);
- infobar_service->AddInfoBar(state->info_bar);
+ state->info_bar =
+ HungPluginInfoBarDelegate::Create(infobar_service, this, child_id,
+ state->name);
}
void HungPluginTabHelper::CloseBar(PluginState* state) {
« no previous file with comments | « chrome/browser/ui/gtk/collected_cookies_gtk.cc ('k') | chrome/browser/ui/media_stream_infobar_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698