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

Side by Side Diff: content/public/browser/platform_notification_context.h

Issue 2300093002: Make //content responsible for generating notification Ids (Closed)
Patch Set: 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 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 // Reads the data associated with |notification_id| belonging to |origin| 41 // Reads the data associated with |notification_id| belonging to |origin|
42 // from the database. |callback| will be invoked with the success status 42 // from the database. |callback| will be invoked with the success status
43 // and a reference to the notification database data when completed. 43 // and a reference to the notification database data when completed.
44 virtual void ReadNotificationData(int64_t notification_id, 44 virtual void ReadNotificationData(const std::string& notification_id,
45 const GURL& origin, 45 const GURL& origin,
46 const ReadResultCallback& callback) = 0; 46 const ReadResultCallback& callback) = 0;
47 47
48 // Reads all data associated with |service_worker_registration_id| belonging 48 // Reads all data associated with |service_worker_registration_id| belonging
49 // to |origin| from the database. |callback| will be invoked with the success 49 // to |origin| from the database. |callback| will be invoked with the success
50 // status and a vector with all read notification data when completed. 50 // status and a vector with all read notification data when completed.
51 virtual void ReadAllNotificationDataForServiceWorkerRegistration( 51 virtual void ReadAllNotificationDataForServiceWorkerRegistration(
52 const GURL& origin, 52 const GURL& origin,
53 int64_t service_worker_registration_id, 53 int64_t service_worker_registration_id,
54 const ReadAllResultCallback& callback) = 0; 54 const ReadAllResultCallback& callback) = 0;
55 55
56 // Writes the data associated with a notification to a database. When this 56 // Writes the data associated with a notification to a database. When this
57 // action completed, |callback| will be invoked with the success status and 57 // action completed, |callback| will be invoked with the success status and
58 // the persistent notification id when written successfully. 58 // the notification id when written successfully. The notification ID field
59 // for |database_data| will be generated, and thus must be empty.
59 virtual void WriteNotificationData( 60 virtual void WriteNotificationData(
60 const GURL& origin, 61 const GURL& origin,
61 const NotificationDatabaseData& database_data, 62 const NotificationDatabaseData& database_data,
62 const WriteResultCallback& callback) = 0; 63 const WriteResultCallback& callback) = 0;
63 64
64 // Deletes all data associated with |notification_id| belonging to |origin| 65 // Deletes all data associated with |notification_id| belonging to |origin|
65 // from the database. |callback| will be invoked with the success status 66 // from the database. |callback| will be invoked with the success status
66 // when the operation has completed. 67 // when the operation has completed.
67 virtual void DeleteNotificationData(int64_t notification_id, 68 virtual void DeleteNotificationData(const std::string& notification_id,
68 const GURL& origin, 69 const GURL& origin,
69 const DeleteResultCallback& callback) = 0; 70 const DeleteResultCallback& callback) = 0;
70 71
71 protected: 72 protected:
72 friend class base::DeleteHelper<PlatformNotificationContext>; 73 friend class base::DeleteHelper<PlatformNotificationContext>;
73 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; 74 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>;
74 75
75 virtual ~PlatformNotificationContext() {} 76 virtual ~PlatformNotificationContext() {}
76 }; 77 };
77 78
78 } // namespace content 79 } // namespace content
79 80
80 #endif // CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_CONTEXT_H_ 81 #endif // CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_CONTEXT_H_
OLDNEW
« no previous file with comments | « content/public/browser/notification_event_dispatcher.h ('k') | content/public/browser/platform_notification_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698