Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: chrome/common/desktop_notifications/active_notification_tracker.h

Issue 194079: renderer process notifications support (Closed)
Patch Set: last change for code review Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_COMMON_DESKTOP_NOTIFICATIONS_ACTIVE_NOTIFICATION_TRACKER_H_
6 #define CHROME_COMMON_DESKTOP_NOTIFICATIONS_ACTIVE_NOTIFICATION_TRACKER_H_
7
8 #include <map>
9
10 #include "base/basictypes.h"
11 #include "base/id_map.h"
12 #include "base/hash_tables.h"
13 #include "webkit/api/public/WebNotification.h"
14
15 namespace WebKit {
16 class WebNotificationPermissionCallback;
17 }
18
19 // This class manages the set of active Notification objects in either
20 // a render or worker process. This class should be accessed only on
21 // the main thread.
22 class ActiveNotificationTracker {
23 public:
24 ActiveNotificationTracker() {}
25
26 // Methods for tracking active notification objects.
27 int RegisterNotification(const WebKit::WebNotification& notification);
28 void UnregisterNotification(int id);
29 bool GetId(const WebKit::WebNotification& notification, int& id);
30 bool GetNotification(int id, WebKit::WebNotification* notification);
31
32 // Methods for tracking active permission requests.
33 int RegisterPermissionRequest(
34 WebKit::WebNotificationPermissionCallback* callback);
35 void OnPermissionRequestComplete(int id);
36 WebKit::WebNotificationPermissionCallback* GetCallback(int id);
37
38 private:
39 typedef std::map<WebKit::WebNotification, int> ReverseTable;
40
41 // Tracking maps for active notifications and permission requests.
42 IDMap<WebKit::WebNotification> notification_table_;
43 ReverseTable reverse_notification_table_;
44 IDMap<WebKit::WebNotificationPermissionCallback> callback_table_;
45
46 DISALLOW_COPY_AND_ASSIGN(ActiveNotificationTracker);
47 };
48
49 #endif // CHROME_COMMON_DESKTOP_NOTIFICATIONS_ACTIVE_NOTIFICATION_TRACKER_H_
50
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698