Index: chrome/browser/extensions/app_notify_channel_ui_impl.cc |
=================================================================== |
--- chrome/browser/extensions/app_notify_channel_ui_impl.cc (revision 175396) |
+++ chrome/browser/extensions/app_notify_channel_ui_impl.cc (working copy) |
@@ -33,10 +33,10 @@ |
class AppNotifyChannelUIInfoBarDelegate : public ConfirmInfoBarDelegate { |
public: |
- AppNotifyChannelUIInfoBarDelegate(AppNotifyChannelUIImpl* creator, |
- InfoBarService* infobar_service, |
- const std::string& app_name); |
- virtual ~AppNotifyChannelUIInfoBarDelegate(); |
+ // Creates an app notify channel UI delegate and adds it to |infobar_service|. |
+ static void Create(InfoBarService* infobar_service, |
+ AppNotifyChannelUIImpl* creator, |
+ const std::string& app_name); |
// ConfirmInfoBarDelegate. |
virtual string16 GetMessageText() const OVERRIDE; |
@@ -46,24 +46,26 @@ |
virtual void InfoBarDismissed() OVERRIDE; |
private: |
+ AppNotifyChannelUIInfoBarDelegate(AppNotifyChannelUIImpl* creator, |
+ InfoBarService* infobar_service, |
+ const std::string& app_name); |
+ virtual ~AppNotifyChannelUIInfoBarDelegate(); |
+ |
AppNotifyChannelUIImpl* creator_; |
std::string app_name_; |
DISALLOW_COPY_AND_ASSIGN(AppNotifyChannelUIInfoBarDelegate); |
}; |
-AppNotifyChannelUIInfoBarDelegate::AppNotifyChannelUIInfoBarDelegate( |
- AppNotifyChannelUIImpl* creator, |
- InfoBarService* infobar_service, |
- const std::string& app_name) |
- : ConfirmInfoBarDelegate(infobar_service), |
- creator_(creator), |
- app_name_(app_name) { |
+// static |
+void AppNotifyChannelUIInfoBarDelegate::Create(InfoBarService* infobar_service, |
+ AppNotifyChannelUIImpl* creator, |
+ const std::string& app_name) { |
+ infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>( |
+ new AppNotifyChannelUIInfoBarDelegate(creator, infobar_service, |
+ app_name))); |
} |
-AppNotifyChannelUIInfoBarDelegate::~AppNotifyChannelUIInfoBarDelegate() { |
-} |
- |
string16 AppNotifyChannelUIInfoBarDelegate::GetMessageText() const { |
return l10n_util::GetStringFUTF16(IDS_APP_NOTIFICATION_NEED_SIGNIN, |
UTF8ToUTF16(app_name_)); |
@@ -95,6 +97,18 @@ |
Cancel(); |
} |
+AppNotifyChannelUIInfoBarDelegate::AppNotifyChannelUIInfoBarDelegate( |
+ AppNotifyChannelUIImpl* creator, |
+ InfoBarService* infobar_service, |
+ const std::string& app_name) |
+ : ConfirmInfoBarDelegate(infobar_service), |
+ creator_(creator), |
+ app_name_(app_name) { |
+} |
+ |
+AppNotifyChannelUIInfoBarDelegate::~AppNotifyChannelUIInfoBarDelegate() { |
+} |
+ |
} // namespace |
@@ -142,10 +156,8 @@ |
return; |
} |
- InfoBarService* infobar_service = |
- InfoBarService::FromWebContents(web_contents_); |
- infobar_service->AddInfoBar(new AppNotifyChannelUIInfoBarDelegate( |
- this, infobar_service, app_name_)); |
+ AppNotifyChannelUIInfoBarDelegate::Create( |
+ InfoBarService::FromWebContents(web_contents_), this, app_name_); |
} |
void AppNotifyChannelUIImpl::OnInfoBarResult(bool accepted) { |