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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: content/public/browser/platform_notification_context.h
diff --git a/content/public/browser/platform_notification_context.h b/content/public/browser/platform_notification_context.h
new file mode 100644
index 0000000000000000000000000000000000000000..c009d178a5ac5a341965be9c779a0fdeec4c71f7
--- /dev/null
+++ b/content/public/browser/platform_notification_context.h
@@ -0,0 +1,65 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_CONTEXT_H_
+#define CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_CONTEXT_H_
+
+#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.
+
+#include "base/callback.h"
+#include "base/memory/ref_counted.h"
+
+class GURL;
+
+namespace content {
+
+struct NotificationDatabaseData;
+
+// Represents the storage context for persistent Web Notifications, specific to
+// the storage partition owning the instance. All methods defined in this
+// 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.
+class PlatformNotificationContext
+ : public base::RefCountedThreadSafe<PlatformNotificationContext> {
+ public:
+ using ReadResultCallback =
+ base::Callback<void(bool /* success */,
+ const NotificationDatabaseData&)>;
+
+ using WriteResultCallback =
+ base::Callback<void(bool /* success */,
+ 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.
+
+ using DeleteResultCallback = base::Callback<void(bool /* success */)>;
+
+ // Reads the data associated with |notification_id| belonging to |origin|
+ // from the database. |callback| will be invoked with the success status
+ // and a reference to the notification database data when completed.
+ virtual void ReadNotificationData(int64_t notification_id,
+ const GURL& origin,
+ const ReadResultCallback& callback) = 0;
+
+ // Writes the data associated with a notification to a database. When this
+ // action completed, |callback| will be invoked with the success status and
+ // the persistent notification id when written successfully.
+ virtual void WriteNotificationData(
+ const GURL& origin,
+ const NotificationDatabaseData& database_data,
+ const WriteResultCallback& callback) = 0;
+
+ // Deletes all data associated with |notification_id| belonging to |origin|
+ // from the database. |callback| will be invoked with the success status
+ // when the operation has completed.
+ virtual void DeleteNotificationData(int64_t notification_id,
+ const GURL& origin,
+ const DeleteResultCallback& callback) = 0;
+
+ protected:
+ friend class base::RefCountedThreadSafe<PlatformNotificationContext>;
+
+ virtual ~PlatformNotificationContext() {}
+};
+
+} // namespace content
+
+#endif // CONTENT_PUBLIC_BROWSER_PLATFORM_NOTIFICATION_CONTEXT_H_

Powered by Google App Engine
This is Rietveld 408576698