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

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

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.cc
diff --git a/content/browser/notifications/platform_notification_context_impl.cc b/content/browser/notifications/platform_notification_context_impl.cc
index 99c9591c1fbbb000f8fd7413b123dc777fc0743f..0f8539c8cd9c4ff2249c3add06a76bc0a38a68ac 100644
--- a/content/browser/notifications/platform_notification_context_impl.cc
+++ b/content/browser/notifications/platform_notification_context_impl.cc
@@ -7,9 +7,12 @@
#include "base/bind_helpers.h"
#include "base/files/file_util.h"
#include "base/metrics/histogram_macros.h"
+#include "base/stl_util.h"
#include "base/threading/sequenced_worker_pool.h"
+#include "content/browser/notifications/blink_notification_service_impl.h"
#include "content/browser/notifications/notification_database.h"
#include "content/browser/service_worker/service_worker_context_wrapper.h"
+#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/notification_database_data.h"
@@ -94,11 +97,43 @@ void PlatformNotificationContextImpl::Shutdown() {
void PlatformNotificationContextImpl::ShutdownOnIO() {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
+ STLDeleteElements(&services_);
+
// |service_worker_context_| may be NULL in tests.
if (service_worker_context_)
service_worker_context_->RemoveObserver(this);
}
+void PlatformNotificationContextImpl::CreateService(
+ int render_process_id,
+ mojo::InterfaceRequest<blink::mojom::NotificationService> request) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
+ base::Bind(&PlatformNotificationContextImpl::CreateServiceOnIO, this,
+ render_process_id, browser_context_->GetResourceContext(),
+ base::Passed(&request)));
+}
+
+void PlatformNotificationContextImpl::CreateServiceOnIO(
+ int render_process_id,
+ ResourceContext* resource_context,
+ mojo::InterfaceRequest<blink::mojom::NotificationService> request) {
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
+ services_.insert(new BlinkNotificationServiceImpl(
+ this, browser_context_, resource_context, render_process_id,
+ std::move(request)));
+}
+
+void PlatformNotificationContextImpl::RemoveService(
+ BlinkNotificationServiceImpl* service) {
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
+ DCHECK(ContainsValue(services_, service));
+
+ services_.erase(service);
+ delete service;
+}
+
void PlatformNotificationContextImpl::ReadNotificationData(
int64_t notification_id,
const GURL& origin,
« no previous file with comments | « content/browser/notifications/platform_notification_context_impl.h ('k') | content/browser/notifications/type_converters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698