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

Unified Diff: chrome/browser/extensions/app_notify_channel_ui_impl.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
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) {
« no previous file with comments | « chrome/browser/extensions/api/debugger/debugger_api.cc ('k') | chrome/browser/extensions/extension_infobar_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698