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

Unified Diff: content/browser/notification_message_filter.cc

Issue 644643005: Implement a RenderFrame-less path for Web Notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add OWNERS file Created 6 years, 2 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/notification_message_filter.cc
diff --git a/content/browser/notification_message_filter.cc b/content/browser/notification_message_filter.cc
new file mode 100644
index 0000000000000000000000000000000000000000..da666397c9adc34ba9e5fb93374f0272d2c33238
--- /dev/null
+++ b/content/browser/notification_message_filter.cc
@@ -0,0 +1,65 @@
+// Copyright 2014 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.
+
+#include "content/browser/notification_message_filter.h"
+
+#include "content/common/platform_notification_messages.h"
+#include "content/public/browser/content_browser_client.h"
+#include "content/public/common/content_client.h"
+
+namespace content {
+
+NotificationMessageFilter::NotificationMessageFilter(
+ int process_id,
+ ResourceContext* resource_context)
+ : BrowserMessageFilter(PlatformNotificationMsgStart),
+ process_id_(process_id),
+ resource_context_(resource_context) {}
+
+NotificationMessageFilter::~NotificationMessageFilter() {}
+
+bool NotificationMessageFilter::OnMessageReceived(const IPC::Message& message) {
+ bool handled = true;
+ IPC_BEGIN_MESSAGE_MAP(NotificationMessageFilter, message)
+ IPC_MESSAGE_HANDLER(PlatformNotificationHostMsg_CheckPermission,
+ OnCheckNotificationPermission)
+ IPC_MESSAGE_HANDLER(PlatformNotificationHostMsg_Show,
+ OnShowPlatformNotification)
+ IPC_MESSAGE_HANDLER(PlatformNotificationHostMsg_Close,
+ OnClosePlatformNotification)
+ IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_END_MESSAGE_MAP()
+
+ return handled;
+}
+
+void NotificationMessageFilter::OverrideThreadForMessage(
+ const IPC::Message& message, content::BrowserThread::ID* thread) {
+ if (message.type() == PlatformNotificationHostMsg_Show::ID ||
+ message.type() == PlatformNotificationHostMsg_Close::ID)
+ *thread = BrowserThread::UI;
+}
+
+void NotificationMessageFilter::OnCheckNotificationPermission(
+ const GURL& origin, blink::WebNotificationPermission* permission) {
+ *permission =
+ GetContentClient()->browser()->CheckDesktopNotificationPermission(
+ origin,
+ resource_context_,
+ process_id_);
+}
+
+void NotificationMessageFilter::OnShowPlatformNotification(
+ int notification_id, const ShowDesktopNotificationHostMsgParams& params) {
+ // TODO(peter): Implement the DesktopNotificationDelegate.
+ NOTIMPLEMENTED();
+}
+
+void NotificationMessageFilter::OnClosePlatformNotification(
+ int notification_id) {
+ // TODO(peter): Implement the ability to close notifications.
+ NOTIMPLEMENTED();
+}
+
+} // namespace content
« no previous file with comments | « content/browser/notification_message_filter.h ('k') | content/browser/renderer_host/render_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698