Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / content / public / browser / platform_notification_context.h
blob74dd47100144fec3f20e0d174528b26fc9b91b82
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_CONTEXT_H_
6 #define CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_CONTEXT_H_
8 #include <stdint.h>
9 #include <vector>
11 #include "base/callback.h"
12 #include "content/public/browser/notification_database_data.h"
14 class GURL;
16 namespace content {
18 // Represents the storage context for persistent Web Notifications, specific to
19 // the storage partition owning the instance. All methods defined in this
20 // interface may only be used on the IO thread.
21 class PlatformNotificationContext {
22 public:
23 using ReadResultCallback =
24 base::Callback<void(bool /* success */,
25 const NotificationDatabaseData&)>;
27 using ReadAllResultCallback =
28 base::Callback<void(bool /* success */,
29 const std::vector<NotificationDatabaseData>&)>;
31 using WriteResultCallback =
32 base::Callback<void(bool /* success */,
33 int64_t /* notification_id */)>;
35 using DeleteResultCallback = base::Callback<void(bool /* success */)>;
37 // Reads the data associated with |notification_id| belonging to |origin|
38 // from the database. |callback| will be invoked with the success status
39 // and a reference to the notification database data when completed.
40 virtual void ReadNotificationData(int64_t notification_id,
41 const GURL& origin,
42 const ReadResultCallback& callback) = 0;
44 // Reads all data associated with |service_worker_registration_id| belonging
45 // to |origin| from the database. |callback| will be invoked with the success
46 // status and a vector with all read notification data when completed.
47 virtual void ReadAllNotificationDataForServiceWorkerRegistration(
48 const GURL& origin,
49 int64_t service_worker_registration_id,
50 const ReadAllResultCallback& callback) = 0;
52 // Writes the data associated with a notification to a database. When this
53 // action completed, |callback| will be invoked with the success status and
54 // the persistent notification id when written successfully.
55 virtual void WriteNotificationData(
56 const GURL& origin,
57 const NotificationDatabaseData& database_data,
58 const WriteResultCallback& callback) = 0;
60 // Deletes all data associated with |notification_id| belonging to |origin|
61 // from the database. |callback| will be invoked with the success status
62 // when the operation has completed.
63 virtual void DeleteNotificationData(int64_t notification_id,
64 const GURL& origin,
65 const DeleteResultCallback& callback) = 0;
67 protected:
68 virtual ~PlatformNotificationContext() {}
71 } // namespace content
73 #endif // CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_CONTEXT_H_