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

Unified Diff: content/browser/notifications/platform_notification_context_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: content/browser/notifications/platform_notification_context_impl.h
diff --git a/content/browser/notifications/platform_notification_context_impl.h b/content/browser/notifications/platform_notification_context_impl.h
index 7d05ad11d099c3492ffa24eeaa77d1f1267d2bf1..3110a20a7e98e44aed2b8f8fba5227d0d9e2f31e 100644
--- a/content/browser/notifications/platform_notification_context_impl.h
+++ b/content/browser/notifications/platform_notification_context_impl.h
@@ -14,6 +14,7 @@
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
+#include "content/browser/notifications/notification_id_generator.h"
#include "content/browser/service_worker/service_worker_context_observer.h"
#include "content/common/content_export.h"
#include "content/public/browser/browser_thread.h"
@@ -68,14 +69,19 @@ class CONTENT_EXPORT PlatformNotificationContextImpl
// Mojo pipe disconnected. Must be called on the IO thread.
void RemoveService(BlinkNotificationServiceImpl* service);
+ // Returns the notification Id generator owned by the context.
+ NotificationIdGenerator* notification_id_generator() {
+ return &notification_id_generator_;
+ }
+
// PlatformNotificationContext implementation.
- void ReadNotificationData(int64_t notification_id,
+ void ReadNotificationData(const std::string& notification_id,
const GURL& origin,
const ReadResultCallback& callback) override;
void WriteNotificationData(const GURL& origin,
const NotificationDatabaseData& database_data,
const WriteResultCallback& callback) override;
- void DeleteNotificationData(int64_t notification_id,
+ void DeleteNotificationData(const std::string& notification_id,
const GURL& origin,
const DeleteResultCallback& callback) override;
void ReadAllNotificationDataForServiceWorkerRegistration(
@@ -116,7 +122,7 @@ class CONTENT_EXPORT PlatformNotificationContextImpl
// Actually reads the notification data from the database. Must only be
// called on the |task_runner_| thread. |callback| will be invoked on the
// IO thread when the operation has completed.
- void DoReadNotificationData(int64_t notification_id,
+ void DoReadNotificationData(const std::string& notification_id,
const GURL& origin,
const ReadResultCallback& callback);
@@ -138,7 +144,7 @@ class CONTENT_EXPORT PlatformNotificationContextImpl
// Actually deletes the notification information from the database. Must only
// be called on the |task_runner_| thread. |callback| will be invoked on the
// IO thread when the operation has completed.
- void DoDeleteNotificationData(int64_t notification_id,
+ void DoDeleteNotificationData(const std::string& notification_id,
const GURL& origin,
const DeleteResultCallback& callback);
@@ -168,6 +174,8 @@ class CONTENT_EXPORT PlatformNotificationContextImpl
scoped_refptr<base::SequencedTaskRunner> task_runner_;
std::unique_ptr<NotificationDatabase> database_;
+ NotificationIdGenerator notification_id_generator_;
+
// Indicates whether the database should be pruned when it's opened.
bool prune_database_on_open_ = false;

Powered by Google App Engine
This is Rietveld 408576698