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

Unified Diff: content/browser/notifications/platform_notification_context_impl.h

Issue 2003023002: Introduce the Blink NotificationService, move permission checks there (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 7 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_impl.h b/content/browser/notifications/platform_notification_context_impl.h
index f2eb599f4db5d489aec943122325727978c56f49..7d05ad11d099c3492ffa24eeaa77d1f1267d2bf1 100644
--- a/content/browser/notifications/platform_notification_context_impl.h
+++ b/content/browser/notifications/platform_notification_context_impl.h
@@ -6,8 +6,8 @@
#define CONTENT_BROWSER_NOTIFICATIONS_PLATFORM_NOTIFICATION_CONTEXT_IMPL_H_
#include <stdint.h>
-#include <set>
#include <string>
+#include <vector>
#include "base/callback.h"
#include "base/compiler_specific.h"
@@ -18,6 +18,7 @@
#include "content/common/content_export.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/platform_notification_context.h"
+#include "third_party/WebKit/public/platform/modules/notifications/notification_service.mojom.h"
class GURL;
@@ -27,9 +28,11 @@ class SequencedTaskRunner;
namespace content {
+class BlinkNotificationServiceImpl;
class BrowserContext;
class NotificationDatabase;
struct NotificationDatabaseData;
+class ResourceContext;
class ServiceWorkerContextWrapper;
// Implementation of the Web Notification storage context. The public methods
@@ -54,6 +57,17 @@ class CONTENT_EXPORT PlatformNotificationContextImpl
// To be called on the UI thread when the context is being shut down.
void Shutdown();
+ // Creates a BlinkNotificationServiceImpl that is owned by this context. Must
+ // be called on the UI thread, although the service will be created on and
+ // bound to the IO thread.
+ void CreateService(
+ int render_process_id,
+ mojo::InterfaceRequest<blink::mojom::NotificationService> request);
+
+ // Removes |service| from the list of owned services, for example because the
+ // Mojo pipe disconnected. Must be called on the IO thread.
+ void RemoveService(BlinkNotificationServiceImpl* service);
+
// PlatformNotificationContext implementation.
void ReadNotificationData(int64_t notification_id,
const GURL& origin,
@@ -81,6 +95,10 @@ class CONTENT_EXPORT PlatformNotificationContextImpl
void InitializeOnIO();
void ShutdownOnIO();
+ void CreateServiceOnIO(
+ int render_process_id,
+ ResourceContext* resource_context,
+ mojo::InterfaceRequest<blink::mojom::NotificationService> request);
// Initializes the database if neccesary. Must be called on the IO thread.
// |success_closure| will be invoked on a the |task_runner_| thread when
@@ -153,6 +171,10 @@ class CONTENT_EXPORT PlatformNotificationContextImpl
// Indicates whether the database should be pruned when it's opened.
bool prune_database_on_open_ = false;
+ // The notification services are owned by the platform context, and will be
+ // removed when either this class is destroyed or the Mojo pipe disconnects.
+ std::vector<std::unique_ptr<BlinkNotificationServiceImpl>> services_;
+
DISALLOW_COPY_AND_ASSIGN(PlatformNotificationContextImpl);
};

Powered by Google App Engine
This is Rietveld 408576698