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

Side by Side Diff: content/browser/notifications/page_notification_delegate.cc

Issue 2906883003: Deprecate per notification type delegates. (Closed)
Patch Set: review Created 3 years, 6 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 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(
15 int render_process_id,
16 int non_persistent_notification_id,
17 const std::string& notification_id)
18 : render_process_id_(render_process_id),
19 non_persistent_notification_id_(non_persistent_notification_id),
20 notification_id_(notification_id) {}
21
22 PageNotificationDelegate::~PageNotificationDelegate() {}
23
24 void PageNotificationDelegate::NotificationDisplayed() {
25 RenderProcessHost* sender = RenderProcessHost::FromID(render_process_id_);
26 if (!sender)
27 return;
28
29 sender->Send(
30 new PlatformNotificationMsg_DidShow(non_persistent_notification_id_));
31 }
32
33 void PageNotificationDelegate::NotificationClosed() {
34 RenderProcessHost* sender = RenderProcessHost::FromID(render_process_id_);
35 if (!sender)
36 return;
37
38 sender->Send(
39 new PlatformNotificationMsg_DidClose(non_persistent_notification_id_));
40
41 static_cast<RenderProcessHostImpl*>(sender)
42 ->notification_message_filter()
43 ->DidCloseNotification(notification_id_);
44 }
45
46 void PageNotificationDelegate::NotificationClick() {
47 RenderProcessHost* sender = RenderProcessHost::FromID(render_process_id_);
48 if (!sender)
49 return;
50
51 sender->Send(
52 new PlatformNotificationMsg_DidClick(non_persistent_notification_id_));
53 }
54
55 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/notifications/page_notification_delegate.h ('k') | content/public/browser/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698