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

Side by Side Diff: content/public/browser/platform_notification_context.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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_CONTEXT_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_CONTEXT_H_
6 #define CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_CONTEXT_H_ 6 #define CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_CONTEXT_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 16 matching lines...) Expand all
27 using ReadResultCallback = 27 using ReadResultCallback =
28 base::Callback<void(bool /* success */, 28 base::Callback<void(bool /* success */,
29 const NotificationDatabaseData&)>; 29 const NotificationDatabaseData&)>;
30 30
31 using ReadAllResultCallback = 31 using ReadAllResultCallback =
32 base::Callback<void(bool /* success */, 32 base::Callback<void(bool /* success */,
33 const std::vector<NotificationDatabaseData>&)>; 33 const std::vector<NotificationDatabaseData>&)>;
34 34
35 using WriteResultCallback = 35 using WriteResultCallback =
36 base::Callback<void(bool /* success */, 36 base::Callback<void(bool /* success */,
37 int64_t /* notification_id */)>; 37 const std::string& /* notification_id */)>;
38 38
39 using DeleteResultCallback = base::Callback<void(bool /* success */)>; 39 using DeleteResultCallback = base::Callback<void(bool /* success */)>;
40 40
41 // Generates a notification Id for a given |persistent_notification_id| that
42 // belongs to |origin|, and replaces notifications having the same |tag|.
43 virtual std::string GenerateNotificationId(
44 const GURL& origin,
45 const std::string& tag,
46 int64_t persistent_notification_id) = 0;
47
41 // Reads the data associated with |notification_id| belonging to |origin| 48 // Reads the data associated with |notification_id| belonging to |origin|
42 // from the database. |callback| will be invoked with the success status 49 // from the database. |callback| will be invoked with the success status
43 // and a reference to the notification database data when completed. 50 // and a reference to the notification database data when completed.
44 virtual void ReadNotificationData(int64_t notification_id, 51 virtual void ReadNotificationData(const std::string& notification_id,
45 const GURL& origin, 52 const GURL& origin,
46 const ReadResultCallback& callback) = 0; 53 const ReadResultCallback& callback) = 0;
47 54
48 // Reads all data associated with |service_worker_registration_id| belonging 55 // Reads all data associated with |service_worker_registration_id| belonging
49 // to |origin| from the database. |callback| will be invoked with the success 56 // to |origin| from the database. |callback| will be invoked with the success
50 // status and a vector with all read notification data when completed. 57 // status and a vector with all read notification data when completed.
51 virtual void ReadAllNotificationDataForServiceWorkerRegistration( 58 virtual void ReadAllNotificationDataForServiceWorkerRegistration(
52 const GURL& origin, 59 const GURL& origin,
53 int64_t service_worker_registration_id, 60 int64_t service_worker_registration_id,
54 const ReadAllResultCallback& callback) = 0; 61 const ReadAllResultCallback& callback) = 0;
55 62
56 // Writes the data associated with a notification to a database. When this 63 // Writes the data associated with a notification to a database. When this
57 // action completed, |callback| will be invoked with the success status and 64 // action completed, |callback| will be invoked with the success status and
58 // the persistent notification id when written successfully. 65 // the persistent notification id when written successfully.
59 virtual void WriteNotificationData( 66 virtual void WriteNotificationData(
60 const GURL& origin, 67 const GURL& origin,
61 const NotificationDatabaseData& database_data, 68 const NotificationDatabaseData& database_data,
62 const WriteResultCallback& callback) = 0; 69 const WriteResultCallback& callback) = 0;
63 70
64 // Deletes all data associated with |notification_id| belonging to |origin| 71 // Deletes all data associated with |notification_id| belonging to |origin|
65 // from the database. |callback| will be invoked with the success status 72 // from the database. |callback| will be invoked with the success status
66 // when the operation has completed. 73 // when the operation has completed.
67 virtual void DeleteNotificationData(int64_t notification_id, 74 virtual void DeleteNotificationData(const std::string& notification_id,
68 const GURL& origin, 75 const GURL& origin,
69 const DeleteResultCallback& callback) = 0; 76 const DeleteResultCallback& callback) = 0;
70 77
71 protected: 78 protected:
72 friend class base::DeleteHelper<PlatformNotificationContext>; 79 friend class base::DeleteHelper<PlatformNotificationContext>;
73 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; 80 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>;
74 81
75 virtual ~PlatformNotificationContext() {} 82 virtual ~PlatformNotificationContext() {}
76 }; 83 };
77 84
78 } // namespace content 85 } // namespace content
79 86
80 #endif // CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_CONTEXT_H_ 87 #endif // CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698