| 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 27 matching lines...) Expand all Loading... |
| 38 return static_cast<ProfileID>(profile); | 38 return static_cast<ProfileID>(profile); |
| 39 } | 39 } |
| 40 | 40 |
| 41 virtual ~NotificationUIManager() {} | 41 virtual ~NotificationUIManager() {} |
| 42 | 42 |
| 43 // Creates an initialized UI manager. | 43 // Creates an initialized UI manager. |
| 44 // TODO(dewittj): Remove the PrefService argument which is unused. See | 44 // TODO(dewittj): Remove the PrefService argument which is unused. See |
| 45 // crbug.com/530376 | 45 // crbug.com/530376 |
| 46 static NotificationUIManager* Create(PrefService* local_state); | 46 static NotificationUIManager* Create(PrefService* local_state); |
| 47 | 47 |
| 48 // Some platforms can integrate their notifications with their own |
| 49 // notification center. |
| 50 #if defined(OS_MACOSX) |
| 51 static NotificationUIManager* CreateNativeNotificationManager(); |
| 52 #endif |
| 53 |
| 48 // Adds a notification to be displayed. Virtual for unit test override. | 54 // Adds a notification to be displayed. Virtual for unit test override. |
| 49 virtual void Add(const Notification& notification, Profile* profile) = 0; | 55 virtual void Add(const Notification& notification, Profile* profile) = 0; |
| 50 | 56 |
| 51 // Updates an existing notification. If |update_progress_only|, assume | 57 // Updates an existing notification. If |update_progress_only|, assume |
| 52 // only message and progress properties are updated. | 58 // only message and progress properties are updated. |
| 53 virtual bool Update(const Notification& notification, Profile* profile) = 0; | 59 virtual bool Update(const Notification& notification, Profile* profile) = 0; |
| 54 | 60 |
| 55 // Returns the pointer to a notification if it match the supplied ID, either | 61 // Returns the pointer to a notification if it match the supplied ID, either |
| 56 // currently displayed or in the queue. | 62 // currently displayed or in the queue. |
| 57 // 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 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 82 virtual bool CancelAllBySourceOrigin(const GURL& source_origin) = 0; | 88 virtual bool CancelAllBySourceOrigin(const GURL& source_origin) = 0; |
| 83 | 89 |
| 84 // Removes notifications matching |profile_id|. Returns true if any were | 90 // Removes notifications matching |profile_id|. Returns true if any were |
| 85 // removed. | 91 // removed. |
| 86 virtual bool CancelAllByProfile(ProfileID profile_id) = 0; | 92 virtual bool CancelAllByProfile(ProfileID profile_id) = 0; |
| 87 | 93 |
| 88 // Cancels all pending notifications and closes anything currently showing. | 94 // Cancels all pending notifications and closes anything currently showing. |
| 89 // Used when the app is terminating. | 95 // Used when the app is terminating. |
| 90 virtual void CancelAll() = 0; | 96 virtual void CancelAll() = 0; |
| 91 | 97 |
| 98 // Return whether the notification center can be used for native |
| 99 // notifications. |
| 100 virtual bool AcceptNativeNotifications() = 0; |
| 101 |
| 92 protected: | 102 protected: |
| 93 NotificationUIManager() {} | 103 NotificationUIManager() {} |
| 94 | 104 |
| 95 private: | 105 private: |
| 96 DISALLOW_COPY_AND_ASSIGN(NotificationUIManager); | 106 DISALLOW_COPY_AND_ASSIGN(NotificationUIManager); |
| 97 }; | 107 }; |
| 98 | 108 |
| 99 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_ | 109 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_UI_MANAGER_H_ |
| OLD | NEW |