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

Unified Diff: content/browser/notifications/platform_notification_context_impl.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 side-by-side diff with in-line comments
Download patch
Index: content/browser/notifications/platform_notification_context_impl.h
diff --git a/content/browser/notifications/platform_notification_context.h b/content/browser/notifications/platform_notification_context_impl.h
similarity index 68%
rename from content/browser/notifications/platform_notification_context.h
rename to content/browser/notifications/platform_notification_context_impl.h
index cdb39d704ed372c1dc2c12b60b92fd5f399e766f..812bda64e3cde7fc77c1e9414735efca7bb8c9f6 100644
--- a/content/browser/notifications/platform_notification_context.h
+++ b/content/browser/notifications/platform_notification_context_impl.h
@@ -2,15 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CONTENT_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_CONTEXT_H_
-#define CONTENT_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_CONTEXT_H_
+#ifndef CONTENT_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_CONTEXT_IMPL_H_
+#define CONTENT_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_CONTEXT_IMPL_H_
#include <stdint.h>
#include "base/callback.h"
+#include "base/compiler_specific.h"
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
#include "content/common/content_export.h"
+#include "content/public/browser/platform_notification_context.h"
class GURL;
@@ -23,55 +25,31 @@ namespace content {
class NotificationDatabase;
struct NotificationDatabaseData;
-// Implementation of the Web Notification storage context.
-//
-// Represents the storage context for persistent Web Notifications, specific to
-// the storage partition owning the instance. The public methods defined in this
-// interface must only be called on the IO thread.
-class CONTENT_EXPORT PlatformNotificationContext
- : public base::RefCountedThreadSafe<PlatformNotificationContext> {
+// Implementation of the Web Notification storage context. The public methods
+// defined in this interface must only be called on the IO thread.
+class CONTENT_EXPORT PlatformNotificationContextImpl
+ : public NON_EXPORTED_BASE(PlatformNotificationContext) {
public:
// Constructs a new platform notification context. If |path| is non-empty, the
// database will be initialized in the "Platform Notifications" subdirectory
// of |path|. Otherwise, the database will be initialized in memory.
- explicit PlatformNotificationContext(const base::FilePath& path);
+ explicit PlatformNotificationContextImpl(const base::FilePath& path);
- using ReadResultCallback =
- base::Callback<void(bool /* success */,
- const NotificationDatabaseData&)>;
-
- using WriteResultCallback =
- base::Callback<void(bool /* success */,
- int64_t /* notification_id */)>;
-
- 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.
+ // PlatformNotificationContext implementation.
void ReadNotificationData(int64_t notification_id,
const GURL& origin,
- const ReadResultCallback& callback);
-
- // 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.
+ const ReadResultCallback& callback) override;
void WriteNotificationData(const GURL& origin,
const NotificationDatabaseData& database_data,
- const WriteResultCallback& callback);
-
- // 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.
+ const WriteResultCallback& callback) override;
void DeleteNotificationData(int64_t notification_id,
const GURL& origin,
- const DeleteResultCallback& callback);
+ const DeleteResultCallback& callback) override;
private:
- friend class base::RefCountedThreadSafe<PlatformNotificationContext>;
friend class PlatformNotificationContextTest;
- virtual ~PlatformNotificationContext();
+ ~PlatformNotificationContextImpl() override;
// Initializes the database if neccesary. Must be called on the IO thread.
// |success_closure| will be invoked on a the |task_runner_| thread when
@@ -119,9 +97,9 @@ class CONTENT_EXPORT PlatformNotificationContext
scoped_refptr<base::SequencedTaskRunner> task_runner_;
scoped_ptr<NotificationDatabase> database_;
- DISALLOW_COPY_AND_ASSIGN(PlatformNotificationContext);
+ DISALLOW_COPY_AND_ASSIGN(PlatformNotificationContextImpl);
};
} // namespace content
-#endif // CONTENT_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_CONTEXT_H_
+#endif // CONTENT_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_CONTEXT_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698