Refactors gesture conversion functions to ui/events/blink
[chromium-blink-merge.git] / content / public / browser / platform_notification_context.h
blob781635fd5530b10d824bc08b96c30f76efdc24db
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>
10 #include "base/callback.h"
11 #include "base/memory/ref_counted.h"
13 class GURL;
15 namespace content {
17 struct NotificationDatabaseData;
19 // Represents the storage context for persistent Web Notifications, specific to
20 // the storage partition owning the instance. All methods defined in this
21 // interface may only be used on the IO thread.
22 class PlatformNotificationContext
23 : public base::RefCountedThreadSafe<PlatformNotificationContext> {
24 public:
25 using ReadResultCallback =
26 base::Callback<void(bool /* success */,
27 const NotificationDatabaseData&)>;
29 using WriteResultCallback =
30 base::Callback<void(bool /* success */,
31 int64_t /* notification_id */)>;
33 using DeleteResultCallback = base::Callback<void(bool /* success */)>;
35 // Reads the data associated with |notification_id| belonging to |origin|
36 // from the database. |callback| will be invoked with the success status
37 // and a reference to the notification database data when completed.
38 virtual void ReadNotificationData(int64_t notification_id,
39 const GURL& origin,
40 const ReadResultCallback& callback) = 0;
42 // Writes the data associated with a notification to a database. When this
43 // action completed, |callback| will be invoked with the success status and
44 // the persistent notification id when written successfully.
45 virtual void WriteNotificationData(
46 const GURL& origin,
47 const NotificationDatabaseData& database_data,
48 const WriteResultCallback& callback) = 0;
50 // Deletes all data associated with |notification_id| belonging to |origin|
51 // from the database. |callback| will be invoked with the success status
52 // when the operation has completed.
53 virtual void DeleteNotificationData(int64_t notification_id,
54 const GURL& origin,
55 const DeleteResultCallback& callback) = 0;
57 protected:
58 friend class base::RefCountedThreadSafe<PlatformNotificationContext>;
60 virtual ~PlatformNotificationContext() {}
63 } // namespace content
65 #endif // CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_CONTEXT_H_