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

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: update a comment 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
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>
johnme 2015/03/17 12:28:27 Remove
Peter Beverloo 2015/03/17 13:55:31 Dito - we use int64_t in this file.
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 // instance may only be used on the IO thread.
johnme 2015/03/17 12:28:27 s/instance may/interface may/
Peter Beverloo 2015/03/17 13:55:31 Done.
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 */)>;
johnme 2015/03/17 12:28:27 int64 (ditto below)
Peter Beverloo 2015/03/17 13:55:31 Dito - int64 is preferred, int64_t is the new way.
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

Powered by Google App Engine
This is Rietveld 408576698