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

Side by Side Diff: content/browser/notifications/page_notification_delegate.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
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/notifications/page_notification_delegate.h"
6
7 #include "content/browser/notifications/notification_message_filter.h"
8 #include "content/browser/renderer_host/render_process_host_impl.h"
9 #include "content/common/platform_notification_messages.h"
10 #include "content/public/browser/render_process_host.h"
11
12 namespace content {
13
14 PageNotificationDelegate::PageNotificationDelegate(int render_process_id,
15 int notification_id)
16 : render_process_id_(render_process_id),
17 notification_id_(notification_id) {}
18
19 PageNotificationDelegate::~PageNotificationDelegate() {}
20
21 void PageNotificationDelegate::NotificationDisplayed() {
22 RenderProcessHost* sender = RenderProcessHost::FromID(render_process_id_);
23 if (!sender)
24 return;
25
26 sender->Send(new PlatformNotificationMsg_DidShow(notification_id_));
27 }
28
29 void PageNotificationDelegate::NotificationError() {
30 RenderProcessHost* sender = RenderProcessHost::FromID(render_process_id_);
31 if (!sender)
32 return;
33
34 sender->Send(new PlatformNotificationMsg_DidError(notification_id_));
35 }
36
37 // TODO(peter): Remove |by_user| since we're not using that anywhere.
38 void PageNotificationDelegate::NotificationClosed(bool by_user) {
39 RenderProcessHost* sender = RenderProcessHost::FromID(render_process_id_);
40 if (!sender)
41 return;
42
43 sender->Send(new PlatformNotificationMsg_DidClose(notification_id_));
44 static_cast<RenderProcessHostImpl*>(sender)
45 ->notification_message_filter()->DidCloseNotification(notification_id_);
46 }
47
48 void PageNotificationDelegate::NotificationClick() {
49 RenderProcessHost* sender = RenderProcessHost::FromID(render_process_id_);
50 if (!sender)
51 return;
52
53 sender->Send(new PlatformNotificationMsg_DidClick(notification_id_));
54 }
55
56 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/notifications/page_notification_delegate.h ('k') | content/browser/renderer_host/render_process_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698