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

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

Issue 1010833002: Expose bits of the Web Notification database in the //content API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@n-db-DeleteInContext
Patch Set: add NON_EXPORTED_BASE Created 5 years, 9 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
« no previous file with comments | « content/public/browser/notification_database_data.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
5 #ifndef CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_CONTEXT_H_
6 #define CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_CONTEXT_H_
7
8 #include <stdint.h>
9
10 #include "base/callback.h"
11 #include "base/memory/ref_counted.h"
12
13 class GURL;
14
15 namespace content {
16
17 struct NotificationDatabaseData;
18
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&)>;
28
29 using WriteResultCallback =
30 base::Callback<void(bool /* success */,
31 int64_t /* notification_id */)>;
32
33 using DeleteResultCallback = base::Callback<void(bool /* success */)>;
34
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;
41
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;
49
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;
56
57 protected:
58 friend class base::RefCountedThreadSafe<PlatformNotificationContext>;
59
60 virtual ~PlatformNotificationContext() {}
61 };
62
63 } // namespace content
64
65 #endif // CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_CONTEXT_H_
OLDNEW
« no previous file with comments | « content/public/browser/notification_database_data.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698