1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_
6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_
11 #include "base/basictypes.h"
18 // This virtual interface is used to manage the UI surfaces for desktop
19 // notifications. There is one instance per profile.
20 class NotificationUIManager
{
22 virtual ~NotificationUIManager() {}
24 // Creates an initialized UI manager.
25 static NotificationUIManager
* Create(PrefService
* local_state
);
27 // Adds a notification to be displayed. Virtual for unit test override.
28 virtual void Add(const Notification
& notification
,
29 Profile
* profile
) = 0;
31 // Returns true if any notifications match the supplied ID, either currently
32 // displayed or in the queue.
33 virtual bool DoesIdExist(const std::string
& notification_id
) = 0;
35 // Removes any notifications matching the supplied ID, either currently
36 // displayed or in the queue. Returns true if anything was removed.
37 virtual bool CancelById(const std::string
& notification_id
) = 0;
39 // Removes notifications matching the |source_origin| (which could be an
40 // extension ID). Returns true if anything was removed.
41 virtual bool CancelAllBySourceOrigin(const GURL
& source_origin
) = 0;
43 // Removes notifications matching |profile|. Returns true if any were removed.
44 virtual bool CancelAllByProfile(Profile
* profile
) = 0;
46 // Cancels all pending notifications and closes anything currently showing.
47 // Used when the app is terminating.
48 virtual void CancelAll() = 0;
50 // Temporary, while we have two implementations of Notifications UI Managers.
51 // One is older BalloonCollection-based and uses renderers to show
52 // notifications, another delegates to the new MessageCenter and uses native
54 // TODO(dimich): remove these eventually.
55 static bool DelegatesToMessageCenter();
58 NotificationUIManager() {}
61 DISALLOW_COPY_AND_ASSIGN(NotificationUIManager
);
64 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_