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

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

Issue 2344983003: Merge the code paths for closing different kinds of notifications. (Closed)
Patch Set: rebase Created 4 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 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 b556c8e1318c7c3e136754f4f0d7ab478c34683f..da673a4597db165dc4c100ab90e434d1aebde1c5 100644
--- a/content/child/notifications/notification_manager.h
+++ b/content/child/notifications/notification_manager.h
@@ -56,10 +56,9 @@ class NotificationManager : public blink::WebNotificationManager,
const blink::WebString& filter_tag,
blink::WebServiceWorkerRegistration* service_worker_registration,
blink::WebNotificationGetCallbacks* callbacks) override;
- void close(blink::WebNotificationDelegate* delegate) override;
- void closePersistent(const blink::WebSecurityOrigin& origin,
- const blink::WebString& tag,
- const blink::WebString& notification_id) override;
+ void close(const blink::WebSecurityOrigin& origin,
+ const blink::WebString& tag,
+ const blink::WebString& notification_id) override;
void notifyDelegateDestroyed(
blink::WebNotificationDelegate* delegate) override;
@@ -71,10 +70,12 @@ class NotificationManager : public blink::WebNotificationManager,
NotificationDispatcher* notification_dispatcher);
// IPC message handlers.
- void OnDidShow(int notification_id);
+ void OnDidShow(int non_persistent_notification_id,
+ const std::string& notification_id);
void OnDidShowPersistent(int request_id, bool success);
- void OnDidClose(int notification_id);
- void OnDidClick(int notification_id);
+ void OnDidClose(int non_persistent_notification_id,
+ const std::string& notification_id);
+ void OnDidClick(int non_persistent_notification_id);
void OnDidGetNotifications(
int request_id,
const std::vector<PersistentNotificationInfo>& notification_infos);
@@ -90,21 +91,14 @@ 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::unordered_map<int, ActiveNotificationData> active_page_notifications_;
+ // Map from the notification ID to the associated delegate for non-persistent
+ // notifications, for the purposes of triggering events.
+ std::unordered_map<int, blink::WebNotificationDelegate*>
+ non_persistent_notifications_;
+
+ // Association from the notification ID string to the non-persistent
+ // notification ID for non-persistent notifications.
+ std::unordered_map<std::string, int> non_persistent_notification_ids_;
DISALLOW_COPY_AND_ASSIGN(NotificationManager);
};
« no previous file with comments | « content/browser/notifications/page_notification_delegate.cc ('k') | content/child/notifications/notification_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698