cc: Make picture pile base thread safe.
[chromium-blink-merge.git] / content / browser / notification_message_filter.cc
blobda666397c9adc34ba9e5fb93374f0272d2c33238
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.
5 #include "content/browser/notification_message_filter.h"
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"
11 namespace content {
13 NotificationMessageFilter::NotificationMessageFilter(
14 int process_id,
15 ResourceContext* resource_context)
16 : BrowserMessageFilter(PlatformNotificationMsgStart),
17 process_id_(process_id),
18 resource_context_(resource_context) {}
20 NotificationMessageFilter::~NotificationMessageFilter() {}
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()
34 return handled;
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;
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_);
53 void NotificationMessageFilter::OnShowPlatformNotification(
54 int notification_id, const ShowDesktopNotificationHostMsgParams& params) {
55 // TODO(peter): Implement the DesktopNotificationDelegate.
56 NOTIMPLEMENTED();
59 void NotificationMessageFilter::OnClosePlatformNotification(
60 int notification_id) {
61 // TODO(peter): Implement the ability to close notifications.
62 NOTIMPLEMENTED();
65 } // namespace content