| 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 CONTENT_RENDERER_ACTIVE_NOTIFICATION_TRACKER_H_ | 5 #ifndef CONTENT_RENDERER_ACTIVE_NOTIFICATION_TRACKER_H_ |
| 6 #define CONTENT_RENDERER_ACTIVE_NOTIFICATION_TRACKER_H_ | 6 #define CONTENT_RENDERER_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 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 // Methods for tracking active permission requests. | 36 // Methods for tracking active permission requests. |
| 37 int RegisterPermissionRequest( | 37 int RegisterPermissionRequest( |
| 38 WebKit::WebNotificationPermissionCallback* callback); | 38 WebKit::WebNotificationPermissionCallback* callback); |
| 39 void OnPermissionRequestComplete(int id); | 39 void OnPermissionRequestComplete(int id); |
| 40 WebKit::WebNotificationPermissionCallback* GetCallback(int id); | 40 WebKit::WebNotificationPermissionCallback* GetCallback(int id); |
| 41 | 41 |
| 42 // Clears out all active notifications. Useful on page navigation. | 42 // Clears out all active notifications. Useful on page navigation. |
| 43 void Clear(); | 43 void Clear(); |
| 44 | 44 |
| 45 // Detaches all active notifications from their presenter. Necessary | |
| 46 // when the Presenter is destroyed. | |
| 47 void DetachAll(); | |
| 48 | |
| 49 private: | 45 private: |
| 50 typedef std::map<WebKit::WebNotification, int> ReverseTable; | 46 typedef std::map<WebKit::WebNotification, int> ReverseTable; |
| 51 | 47 |
| 52 // Tracking maps for active notifications and permission requests. | 48 // Tracking maps for active notifications and permission requests. |
| 53 IDMap<WebKit::WebNotification> notification_table_; | 49 IDMap<WebKit::WebNotification> notification_table_; |
| 54 ReverseTable reverse_notification_table_; | 50 ReverseTable reverse_notification_table_; |
| 55 IDMap<WebKit::WebNotificationPermissionCallback> callback_table_; | 51 IDMap<WebKit::WebNotificationPermissionCallback> callback_table_; |
| 56 | 52 |
| 57 DISALLOW_COPY_AND_ASSIGN(ActiveNotificationTracker); | 53 DISALLOW_COPY_AND_ASSIGN(ActiveNotificationTracker); |
| 58 }; | 54 }; |
| 59 | 55 |
| 60 } // namespace content | 56 } // namespace content |
| 61 | 57 |
| 62 #endif // CONTENT_RENDERER_ACTIVE_NOTIFICATION_TRACKER_H_ | 58 #endif // CONTENT_RENDERER_ACTIVE_NOTIFICATION_TRACKER_H_ |
| OLD | NEW |