OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_COMMON_DESKTOP_NOTIFICATIONS_ACTIVE_NOTIFICATION_TRACKER_H_ | 5 #ifndef CHROME_COMMON_DESKTOP_NOTIFICATIONS_ACTIVE_NOTIFICATION_TRACKER_H_ |
6 #define CHROME_COMMON_DESKTOP_NOTIFICATIONS_ACTIVE_NOTIFICATION_TRACKER_H_ | 6 #define CHROME_COMMON_DESKTOP_NOTIFICATIONS_ACTIVE_NOTIFICATION_TRACKER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 void UnregisterNotification(int id); | 28 void UnregisterNotification(int id); |
29 bool GetId(const WebKit::WebNotification& notification, int& id); | 29 bool GetId(const WebKit::WebNotification& notification, int& id); |
30 bool GetNotification(int id, WebKit::WebNotification* notification); | 30 bool GetNotification(int id, WebKit::WebNotification* notification); |
31 | 31 |
32 // Methods for tracking active permission requests. | 32 // Methods for tracking active permission requests. |
33 int RegisterPermissionRequest( | 33 int RegisterPermissionRequest( |
34 WebKit::WebNotificationPermissionCallback* callback); | 34 WebKit::WebNotificationPermissionCallback* callback); |
35 void OnPermissionRequestComplete(int id); | 35 void OnPermissionRequestComplete(int id); |
36 WebKit::WebNotificationPermissionCallback* GetCallback(int id); | 36 WebKit::WebNotificationPermissionCallback* GetCallback(int id); |
37 | 37 |
| 38 // Clears out all active notifications. Useful on page navigation. |
| 39 void Clear(); |
| 40 |
38 private: | 41 private: |
39 typedef std::map<WebKit::WebNotification, int> ReverseTable; | 42 typedef std::map<WebKit::WebNotification, int> ReverseTable; |
40 | 43 |
41 // Tracking maps for active notifications and permission requests. | 44 // Tracking maps for active notifications and permission requests. |
42 IDMap<WebKit::WebNotification> notification_table_; | 45 IDMap<WebKit::WebNotification> notification_table_; |
43 ReverseTable reverse_notification_table_; | 46 ReverseTable reverse_notification_table_; |
44 IDMap<WebKit::WebNotificationPermissionCallback> callback_table_; | 47 IDMap<WebKit::WebNotificationPermissionCallback> callback_table_; |
45 | 48 |
46 DISALLOW_COPY_AND_ASSIGN(ActiveNotificationTracker); | 49 DISALLOW_COPY_AND_ASSIGN(ActiveNotificationTracker); |
47 }; | 50 }; |
48 | 51 |
49 #endif // CHROME_COMMON_DESKTOP_NOTIFICATIONS_ACTIVE_NOTIFICATION_TRACKER_H_ | 52 #endif // CHROME_COMMON_DESKTOP_NOTIFICATIONS_ACTIVE_NOTIFICATION_TRACKER_H_ |
50 | |
OLD | NEW |