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

Unified Diff: chrome/browser/notifications/desktop_notification_service.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/nacl_host/nacl_infobar.cc ('k') | chrome/browser/omnibox_search_hint.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/notifications/desktop_notification_service.cc
===================================================================
--- chrome/browser/notifications/desktop_notification_service.cc (revision 175396)
+++ chrome/browser/notifications/desktop_notification_service.cc (working copy)
@@ -59,6 +59,17 @@
// permissions.
class NotificationPermissionInfoBarDelegate : public ConfirmInfoBarDelegate {
public:
+ // Creates a notification permission delegate and adds it to
+ // |infobar_service|.
+ static void Create(InfoBarService* infobar_service,
+ DesktopNotificationService* notification_service,
+ const GURL& origin,
+ const string16& display_name,
+ int process_id,
+ int route_id,
+ int callback_context);
+
+ private:
NotificationPermissionInfoBarDelegate(
InfoBarService* infobar_service,
DesktopNotificationService* notification_service,
@@ -67,8 +78,6 @@
int process_id,
int route_id,
int callback_context);
-
- private:
virtual ~NotificationPermissionInfoBarDelegate();
// ConfirmInfoBarDelegate:
@@ -101,6 +110,21 @@
DISALLOW_COPY_AND_ASSIGN(NotificationPermissionInfoBarDelegate);
};
+// static
+void NotificationPermissionInfoBarDelegate::Create(
+ InfoBarService* infobar_service,
+ DesktopNotificationService* notification_service,
+ const GURL& origin,
+ const string16& display_name,
+ int process_id,
+ int route_id,
+ int callback_context) {
+ infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>(
+ new NotificationPermissionInfoBarDelegate(
+ infobar_service, notification_service, origin, display_name,
+ process_id, route_id, callback_context)));
+}
+
NotificationPermissionInfoBarDelegate::NotificationPermissionInfoBarDelegate(
InfoBarService* infobar_service,
DesktopNotificationService* notification_service,
@@ -416,7 +440,7 @@
// browser action popup, extension background page, or any HTML that runs
// outside of a tab.
if (infobar_service) {
- infobar_service->AddInfoBar(new NotificationPermissionInfoBarDelegate(
+ NotificationPermissionInfoBarDelegate::Create(
infobar_service,
DesktopNotificationServiceFactory::GetForProfile(
Profile::FromBrowserContext(contents->GetBrowserContext())),
@@ -424,7 +448,7 @@
DisplayNameForOrigin(origin),
process_id,
route_id,
- callback_context));
+ callback_context);
return;
}
}
« no previous file with comments | « chrome/browser/nacl_host/nacl_infobar.cc ('k') | chrome/browser/omnibox_search_hint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698