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

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

Issue 2344983003: Merge the code paths for closing different kinds of notifications. (Closed)
Patch Set: rebase Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/notifications/page_notification_delegate.h" 5 #include "content/browser/notifications/page_notification_delegate.h"
6 6
7 #include "content/browser/notifications/notification_message_filter.h" 7 #include "content/browser/notifications/notification_message_filter.h"
8 #include "content/browser/renderer_host/render_process_host_impl.h" 8 #include "content/browser/renderer_host/render_process_host_impl.h"
9 #include "content/common/platform_notification_messages.h" 9 #include "content/common/platform_notification_messages.h"
10 #include "content/public/browser/render_process_host.h" 10 #include "content/public/browser/render_process_host.h"
11 11
12 namespace content { 12 namespace content {
13 13
14 PageNotificationDelegate::PageNotificationDelegate( 14 PageNotificationDelegate::PageNotificationDelegate(
15 int render_process_id, 15 int render_process_id,
16 int non_persistent_notification_id, 16 int non_persistent_notification_id,
17 const std::string& notification_id) 17 const std::string& notification_id)
18 : render_process_id_(render_process_id), 18 : render_process_id_(render_process_id),
19 non_persistent_notification_id_(non_persistent_notification_id), 19 non_persistent_notification_id_(non_persistent_notification_id),
20 notification_id_(notification_id) {} 20 notification_id_(notification_id) {}
21 21
22 PageNotificationDelegate::~PageNotificationDelegate() {} 22 PageNotificationDelegate::~PageNotificationDelegate() {}
23 23
24 void PageNotificationDelegate::NotificationDisplayed() { 24 void PageNotificationDelegate::NotificationDisplayed() {
25 RenderProcessHost* sender = RenderProcessHost::FromID(render_process_id_); 25 RenderProcessHost* sender = RenderProcessHost::FromID(render_process_id_);
26 if (!sender) 26 if (!sender)
27 return; 27 return;
28 28
29 sender->Send( 29 sender->Send(new PlatformNotificationMsg_DidShow(
30 new PlatformNotificationMsg_DidShow(non_persistent_notification_id_)); 30 non_persistent_notification_id_, notification_id_));
31 } 31 }
32 32
33 void PageNotificationDelegate::NotificationClosed() { 33 void PageNotificationDelegate::NotificationClosed() {
34 RenderProcessHost* sender = RenderProcessHost::FromID(render_process_id_); 34 RenderProcessHost* sender = RenderProcessHost::FromID(render_process_id_);
35 if (!sender) 35 if (!sender)
36 return; 36 return;
37 37
38 sender->Send( 38 sender->Send(new PlatformNotificationMsg_DidClose(
39 new PlatformNotificationMsg_DidClose(non_persistent_notification_id_)); 39 non_persistent_notification_id_, notification_id_));
40 40
41 static_cast<RenderProcessHostImpl*>(sender) 41 static_cast<RenderProcessHostImpl*>(sender)
42 ->notification_message_filter() 42 ->notification_message_filter()
43 ->DidCloseNotification(notification_id_); 43 ->DidCloseNotification(notification_id_);
44 } 44 }
45 45
46 void PageNotificationDelegate::NotificationClick() { 46 void PageNotificationDelegate::NotificationClick() {
47 RenderProcessHost* sender = RenderProcessHost::FromID(render_process_id_); 47 RenderProcessHost* sender = RenderProcessHost::FromID(render_process_id_);
48 if (!sender) 48 if (!sender)
49 return; 49 return;
50 50
51 sender->Send( 51 sender->Send(
52 new PlatformNotificationMsg_DidClick(non_persistent_notification_id_)); 52 new PlatformNotificationMsg_DidClick(non_persistent_notification_id_));
53 } 53 }
54 54
55 } // namespace content 55 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/notifications/notification_message_filter.cc ('k') | content/child/notifications/notification_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698