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

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

Issue 1904163002: Move Web Notifications to use Mojo Base URL: https://chromium.googlesource.com/chromium/src.git@skbitmap-blink
Patch Set: it works \o/ Created 4 years, 8 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..5f4c6e4816c222a46236cfee300b4ad1bebf2cb8 100644
--- a/content/browser/notifications/platform_notification_context_impl.h
+++ b/content/browser/notifications/platform_notification_context_impl.h
@@ -8,6 +8,7 @@
#include <stdint.h>
#include <set>
#include <string>
+#include <unordered_set>
#include "base/callback.h"
#include "base/compiler_specific.h"
@@ -18,6 +19,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 +29,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 +58,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 +96,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 +172,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::unordered_set<BlinkNotificationServiceImpl*> services_;
+
DISALLOW_COPY_AND_ASSIGN(PlatformNotificationContextImpl);
};

Powered by Google App Engine
This is Rietveld 408576698