OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_ |
6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_ | 6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_ |
7 | 7 |
8 #include <set> | |
8 #include <string> | 9 #include <string> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
12 | 13 |
13 class GURL; | 14 class GURL; |
14 class Notification; | 15 class Notification; |
15 class PrefService; | 16 class PrefService; |
16 class Profile; | 17 class Profile; |
17 | 18 |
(...skipping 11 matching lines...) Expand all Loading... | |
29 Profile* profile) = 0; | 30 Profile* profile) = 0; |
30 | 31 |
31 // Returns true if any notifications match the supplied ID, either currently | 32 // Returns true if any notifications match the supplied ID, either currently |
32 // displayed or in the queue. | 33 // displayed or in the queue. |
33 virtual bool DoesIdExist(const std::string& notification_id) = 0; | 34 virtual bool DoesIdExist(const std::string& notification_id) = 0; |
34 | 35 |
35 // Removes any notifications matching the supplied ID, either currently | 36 // Removes any notifications matching the supplied ID, either currently |
36 // displayed or in the queue. Returns true if anything was removed. | 37 // displayed or in the queue. Returns true if anything was removed. |
37 virtual bool CancelById(const std::string& notification_id) = 0; | 38 virtual bool CancelById(const std::string& notification_id) = 0; |
38 | 39 |
40 // Adds the notification_id for each outstanding notification to the set | |
41 // |notification_ids| (must not be NULL). | |
42 virtual void GetAllIdsByProfileAndSourceOrigin( | |
43 Profile* profile, | |
44 const GURL& source, | |
45 std::set<std::string>* notification_ids) = 0; | |
Dmitry Titov
2013/05/16 20:39:15
This can just return a set, this is ok (fast) with
dewittj
2013/05/16 23:40:34
Done.
| |
46 | |
39 // Removes notifications matching the |source_origin| (which could be an | 47 // Removes notifications matching the |source_origin| (which could be an |
40 // extension ID). Returns true if anything was removed. | 48 // extension ID). Returns true if anything was removed. |
41 virtual bool CancelAllBySourceOrigin(const GURL& source_origin) = 0; | 49 virtual bool CancelAllBySourceOrigin(const GURL& source_origin) = 0; |
42 | 50 |
43 // Removes notifications matching |profile|. Returns true if any were removed. | 51 // Removes notifications matching |profile|. Returns true if any were removed. |
44 virtual bool CancelAllByProfile(Profile* profile) = 0; | 52 virtual bool CancelAllByProfile(Profile* profile) = 0; |
45 | 53 |
46 // Cancels all pending notifications and closes anything currently showing. | 54 // Cancels all pending notifications and closes anything currently showing. |
47 // Used when the app is terminating. | 55 // Used when the app is terminating. |
48 virtual void CancelAll() = 0; | 56 virtual void CancelAll() = 0; |
49 | 57 |
50 // Temporary, while we have two implementations of Notifications UI Managers. | 58 // Temporary, while we have two implementations of Notifications UI Managers. |
51 // One is older BalloonCollection-based and uses renderers to show | 59 // One is older BalloonCollection-based and uses renderers to show |
52 // notifications, another delegates to the new MessageCenter and uses native | 60 // notifications, another delegates to the new MessageCenter and uses native |
53 // UI widgets. | 61 // UI widgets. |
54 // TODO(dimich): remove these eventually. | 62 // TODO(dimich): remove these eventually. |
55 static bool DelegatesToMessageCenter(); | 63 static bool DelegatesToMessageCenter(); |
56 | 64 |
57 protected: | 65 protected: |
58 NotificationUIManager() {} | 66 NotificationUIManager() {} |
59 | 67 |
60 private: | 68 private: |
61 DISALLOW_COPY_AND_ASSIGN(NotificationUIManager); | 69 DISALLOW_COPY_AND_ASSIGN(NotificationUIManager); |
62 }; | 70 }; |
63 | 71 |
64 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_ | 72 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_ |
OLD | NEW |