OLD | NEW |
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(int render_process_id, | 14 PageNotificationDelegate::PageNotificationDelegate( |
15 int notification_id) | 15 int render_process_id, |
| 16 int non_persistent_notification_id, |
| 17 const std::string& notification_id) |
16 : render_process_id_(render_process_id), | 18 : render_process_id_(render_process_id), |
| 19 non_persistent_notification_id_(non_persistent_notification_id), |
17 notification_id_(notification_id) {} | 20 notification_id_(notification_id) {} |
18 | 21 |
19 PageNotificationDelegate::~PageNotificationDelegate() {} | 22 PageNotificationDelegate::~PageNotificationDelegate() {} |
20 | 23 |
21 void PageNotificationDelegate::NotificationDisplayed() { | 24 void PageNotificationDelegate::NotificationDisplayed() { |
22 RenderProcessHost* sender = RenderProcessHost::FromID(render_process_id_); | 25 RenderProcessHost* sender = RenderProcessHost::FromID(render_process_id_); |
23 if (!sender) | 26 if (!sender) |
24 return; | 27 return; |
25 | 28 |
26 sender->Send(new PlatformNotificationMsg_DidShow(notification_id_)); | 29 sender->Send( |
| 30 new PlatformNotificationMsg_DidShow(non_persistent_notification_id_)); |
27 } | 31 } |
28 | 32 |
29 void PageNotificationDelegate::NotificationClosed() { | 33 void PageNotificationDelegate::NotificationClosed() { |
30 RenderProcessHost* sender = RenderProcessHost::FromID(render_process_id_); | 34 RenderProcessHost* sender = RenderProcessHost::FromID(render_process_id_); |
31 if (!sender) | 35 if (!sender) |
32 return; | 36 return; |
33 | 37 |
34 sender->Send(new PlatformNotificationMsg_DidClose(notification_id_)); | 38 sender->Send( |
| 39 new PlatformNotificationMsg_DidClose(non_persistent_notification_id_)); |
| 40 |
35 static_cast<RenderProcessHostImpl*>(sender) | 41 static_cast<RenderProcessHostImpl*>(sender) |
36 ->notification_message_filter() | 42 ->notification_message_filter() |
37 ->DidCloseNotification(notification_id_); | 43 ->DidCloseNotification(notification_id_); |
38 } | 44 } |
39 | 45 |
40 void PageNotificationDelegate::NotificationClick() { | 46 void PageNotificationDelegate::NotificationClick() { |
41 RenderProcessHost* sender = RenderProcessHost::FromID(render_process_id_); | 47 RenderProcessHost* sender = RenderProcessHost::FromID(render_process_id_); |
42 if (!sender) | 48 if (!sender) |
43 return; | 49 return; |
44 | 50 |
45 sender->Send(new PlatformNotificationMsg_DidClick(notification_id_)); | 51 sender->Send( |
| 52 new PlatformNotificationMsg_DidClick(non_persistent_notification_id_)); |
46 } | 53 } |
47 | 54 |
48 } // namespace content | 55 } // namespace content |
OLD | NEW |