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

Unified Diff: chrome/browser/notifications/platform_notification_service_impl.h

Issue 2300093002: Make //content responsible for generating notification Ids (Closed)
Patch Set: rebase + comments 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: chrome/browser/notifications/platform_notification_service_impl.h
diff --git a/chrome/browser/notifications/platform_notification_service_impl.h b/chrome/browser/notifications/platform_notification_service_impl.h
index 95b4d712e4674686290e5f39a5d8383e38544e2c..88642b3797ea5d1e02b1eaf3575d2c092f726f60 100644
--- a/chrome/browser/notifications/platform_notification_service_impl.h
+++ b/chrome/browser/notifications/platform_notification_service_impl.h
@@ -50,18 +50,17 @@ class PlatformNotificationServiceImpl
// To be called when a persistent notification has been clicked on. The
// Service Worker associated with the registration will be started if
// needed, on which the event will be fired. Must be called on the UI thread.
- void OnPersistentNotificationClick(
- content::BrowserContext* browser_context,
- int64_t persistent_notification_id,
- const GURL& origin,
- int action_index);
+ void OnPersistentNotificationClick(content::BrowserContext* browser_context,
+ const std::string& notification_id,
+ const GURL& origin,
+ int action_index);
// To be called when a persistent notification has been closed. The data
// associated with the notification has to be pruned from the database in this
// case, to make sure that it continues to be in sync. Must be called on the
// UI thread.
void OnPersistentNotificationClose(content::BrowserContext* browser_context,
- int64_t persistent_notification_id,
+ const std::string& notification_id,
const GURL& origin,
bool by_user);
@@ -76,6 +75,7 @@ class PlatformNotificationServiceImpl
int render_process_id) override;
void DisplayNotification(
content::BrowserContext* browser_context,
+ const std::string& notification_id,
const GURL& origin,
const content::PlatformNotificationData& notification_data,
const content::NotificationResources& notification_resources,
@@ -83,14 +83,13 @@ class PlatformNotificationServiceImpl
base::Closure* cancel_callback) override;
void DisplayPersistentNotification(
content::BrowserContext* browser_context,
- int64_t persistent_notification_id,
+ const std::string& notification_id,
const GURL& service_worker_scope,
const GURL& origin,
const content::PlatformNotificationData& notification_data,
const content::NotificationResources& notification_resources) override;
- void ClosePersistentNotification(
- content::BrowserContext* browser_context,
- int64_t persistent_notification_id) override;
+ void ClosePersistentNotification(content::BrowserContext* browser_context,
+ const std::string& notification_id) override;
bool GetDisplayedPersistentNotifications(
content::BrowserContext* browser_context,
std::set<std::string>* displayed_notifications) override;
@@ -149,13 +148,9 @@ class PlatformNotificationServiceImpl
int pending_click_dispatch_events_;
#endif
- // Mapping between a persistent notification id and the id of the associated
- // message_center::Notification object. Must only be used on the UI thread.
- std::map<int64_t, std::string> persistent_notifications_;
-
// Tracks the id of persistent notifications that have been closed
// programmatically to avoid dispatching close events for them.
- std::unordered_set<int64_t> closed_notifications_;
+ std::unordered_set<std::string> closed_notifications_;
// Only set and used for tests, owned by the caller in that case.
NotificationDisplayService* test_display_service_;

Powered by Google App Engine
This is Rietveld 408576698