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

Unified Diff: content/child/notifications/notification_manager.h

Issue 2300093002: Make //content responsible for generating notification Ids (Closed)
Patch Set: Make //content responsible for generating notification Ids Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: content/child/notifications/notification_manager.h
diff --git a/content/child/notifications/notification_manager.h b/content/child/notifications/notification_manager.h
index 2a71c314e601a2423c18193429096e43d0edeb06..b556c8e1318c7c3e136754f4f0d7ab478c34683f 100644
--- a/content/child/notifications/notification_manager.h
+++ b/content/child/notifications/notification_manager.h
@@ -8,9 +8,9 @@
#include <stddef.h>
#include <stdint.h>
-#include <map>
#include <memory>
#include <set>
+#include <unordered_map>
#include <vector>
#include "base/id_map.h"
@@ -58,7 +58,8 @@ class NotificationManager : public blink::WebNotificationManager,
blink::WebNotificationGetCallbacks* callbacks) override;
void close(blink::WebNotificationDelegate* delegate) override;
void closePersistent(const blink::WebSecurityOrigin& origin,
- int64_t persistent_notification_id) override;
+ const blink::WebString& tag,
+ const blink::WebString& notification_id) override;
void notifyDelegateDestroyed(
blink::WebNotificationDelegate* delegate) override;
@@ -89,8 +90,21 @@ class NotificationManager : public blink::WebNotificationManager,
IDMap<blink::WebNotificationShowCallbacks, IDMapOwnPointer>
pending_show_notification_requests_;
+ // Structure holding the information for active non-persistent notifications.
+ struct ActiveNotificationData {
+ ActiveNotificationData() = default;
+ ActiveNotificationData(blink::WebNotificationDelegate* delegate,
+ const GURL& origin,
+ const std::string& tag);
+ ~ActiveNotificationData();
+
+ blink::WebNotificationDelegate* delegate = nullptr;
+ GURL origin;
+ std::string tag;
+ };
+
// Map to store the delegate associated with a notification request Id.
- std::map<int, blink::WebNotificationDelegate*> active_page_notifications_;
+ std::unordered_map<int, ActiveNotificationData> active_page_notifications_;
DISALLOW_COPY_AND_ASSIGN(NotificationManager);
};

Powered by Google App Engine
This is Rietveld 408576698