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

Unified Diff: content/browser/notifications/platform_notification_context_impl.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/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..8eff3f9ee722eb28f45c5f5dbd7a54be5af6136a 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,23 @@ 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,
+ std::string GenerateNotificationId(
+ const GURL& origin,
+ const std::string& tag,
+ int64_t persistent_notification_id) override;
+ 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 +126,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 +148,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 +178,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