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

Side by Side Diff: content/browser/notification_message_filter.cc

Issue 681783004: Implement the PageNotificationDelegate for the new Web Notification path. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/Ids/ids/ Created 6 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « content/browser/notification_message_filter.h ('k') | content/browser/notifications/OWNERS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/browser/notification_message_filter.h"
6
7 #include "content/common/platform_notification_messages.h"
8 #include "content/public/browser/content_browser_client.h"
9 #include "content/public/common/content_client.h"
10
11 namespace content {
12
13 NotificationMessageFilter::NotificationMessageFilter(
14 int process_id,
15 ResourceContext* resource_context)
16 : BrowserMessageFilter(PlatformNotificationMsgStart),
17 process_id_(process_id),
18 resource_context_(resource_context) {}
19
20 NotificationMessageFilter::~NotificationMessageFilter() {}
21
22 bool NotificationMessageFilter::OnMessageReceived(const IPC::Message& message) {
23 bool handled = true;
24 IPC_BEGIN_MESSAGE_MAP(NotificationMessageFilter, message)
25 IPC_MESSAGE_HANDLER(PlatformNotificationHostMsg_CheckPermission,
26 OnCheckNotificationPermission)
27 IPC_MESSAGE_HANDLER(PlatformNotificationHostMsg_Show,
28 OnShowPlatformNotification)
29 IPC_MESSAGE_HANDLER(PlatformNotificationHostMsg_Close,
30 OnClosePlatformNotification)
31 IPC_MESSAGE_UNHANDLED(handled = false)
32 IPC_END_MESSAGE_MAP()
33
34 return handled;
35 }
36
37 void NotificationMessageFilter::OverrideThreadForMessage(
38 const IPC::Message& message, content::BrowserThread::ID* thread) {
39 if (message.type() == PlatformNotificationHostMsg_Show::ID ||
40 message.type() == PlatformNotificationHostMsg_Close::ID)
41 *thread = BrowserThread::UI;
42 }
43
44 void NotificationMessageFilter::OnCheckNotificationPermission(
45 const GURL& origin, blink::WebNotificationPermission* permission) {
46 *permission =
47 GetContentClient()->browser()->CheckDesktopNotificationPermission(
48 origin,
49 resource_context_,
50 process_id_);
51 }
52
53 void NotificationMessageFilter::OnShowPlatformNotification(
54 int notification_id, const ShowDesktopNotificationHostMsgParams& params) {
55 // TODO(peter): Implement the DesktopNotificationDelegate.
56 NOTIMPLEMENTED();
57 }
58
59 void NotificationMessageFilter::OnClosePlatformNotification(
60 int notification_id) {
61 // TODO(peter): Implement the ability to close notifications.
62 NOTIMPLEMENTED();
63 }
64
65 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/notification_message_filter.h ('k') | content/browser/notifications/OWNERS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698