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 <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 // Removes any notifications matching the supplied ID, either currently | 61 // Removes any notifications matching the supplied ID, either currently |
62 // displayed or in the queue. Returns true if anything was removed. | 62 // displayed or in the queue. Returns true if anything was removed. |
63 // This function can be bound for delayed execution, where a profile pointer | 63 // This function can be bound for delayed execution, where a profile pointer |
64 // may not be valid. Hence caller needs to call the static GetProfileID(...) | 64 // may not be valid. Hence caller needs to call the static GetProfileID(...) |
65 // function to turn a profile pointer into a profile id and pass that in. | 65 // function to turn a profile pointer into a profile id and pass that in. |
66 virtual bool CancelById(const std::string& delegate_id, | 66 virtual bool CancelById(const std::string& delegate_id, |
67 ProfileID profile_id) = 0; | 67 ProfileID profile_id) = 0; |
68 | 68 |
69 // Returns the set of all delegate IDs for notifications from the passed | 69 // Returns the set of all delegate IDs for notifications from the passed |
70 // |profile| and |source|. | 70 // |profile| and |source|. |
| 71 // TODO(peter): Change Profile* to ProfileID to clarify that the profile |
| 72 // should not be used for making any calls, as it might be dead. |
71 virtual std::set<std::string> GetAllIdsByProfileAndSourceOrigin( | 73 virtual std::set<std::string> GetAllIdsByProfileAndSourceOrigin( |
72 Profile* profile, | 74 Profile* profile, |
73 const GURL& source) = 0; | 75 const GURL& source) = 0; |
74 | 76 |
| 77 // Returns the set of all delegate IDs for notifications from |profile|. |
| 78 // TODO(peter): Change Profile* to ProfileID to clarify that the profile |
| 79 // should not be used for making any calls, as it might be dead. |
| 80 virtual std::set<std::string> GetAllIdsByProfile(Profile* profile) = 0; |
| 81 |
75 // Removes notifications matching the |source_origin| (which could be an | 82 // Removes notifications matching the |source_origin| (which could be an |
76 // extension ID). Returns true if anything was removed. | 83 // extension ID). Returns true if anything was removed. |
77 virtual bool CancelAllBySourceOrigin(const GURL& source_origin) = 0; | 84 virtual bool CancelAllBySourceOrigin(const GURL& source_origin) = 0; |
78 | 85 |
79 // Removes notifications matching |profile_id|. Returns true if any were | 86 // Removes notifications matching |profile_id|. Returns true if any were |
80 // removed. | 87 // removed. |
81 virtual bool CancelAllByProfile(ProfileID profile_id) = 0; | 88 virtual bool CancelAllByProfile(ProfileID profile_id) = 0; |
82 | 89 |
83 // Cancels all pending notifications and closes anything currently showing. | 90 // Cancels all pending notifications and closes anything currently showing. |
84 // Used when the app is terminating. | 91 // Used when the app is terminating. |
85 virtual void CancelAll() = 0; | 92 virtual void CancelAll() = 0; |
86 | 93 |
87 protected: | 94 protected: |
88 NotificationUIManager() {} | 95 NotificationUIManager() {} |
89 | 96 |
90 private: | 97 private: |
91 DISALLOW_COPY_AND_ASSIGN(NotificationUIManager); | 98 DISALLOW_COPY_AND_ASSIGN(NotificationUIManager); |
92 }; | 99 }; |
93 | 100 |
94 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_ | 101 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_ |
OLD | NEW |