OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer/notification_provider.h" | 5 #include "content/renderer/notification_provider.h" |
6 | 6 |
7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
8 #include "content/common/desktop_notification_messages.h" | 8 #include "content/common/desktop_notification_messages.h" |
9 #include "content/common/view_messages.h" | 9 #include "content/common/view_messages.h" |
10 #include "content/renderer/render_view_impl.h" | 10 #include "content/renderer/render_view_impl.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 using WebKit::WebUserGestureIndicator; | 25 using WebKit::WebUserGestureIndicator; |
26 | 26 |
27 namespace content { | 27 namespace content { |
28 | 28 |
29 | 29 |
30 NotificationProvider::NotificationProvider(RenderViewImpl* render_view) | 30 NotificationProvider::NotificationProvider(RenderViewImpl* render_view) |
31 : RenderViewObserver(render_view) { | 31 : RenderViewObserver(render_view) { |
32 } | 32 } |
33 | 33 |
34 NotificationProvider::~NotificationProvider() { | 34 NotificationProvider::~NotificationProvider() { |
35 manager_.DetachAll(); | |
36 } | 35 } |
37 | 36 |
38 bool NotificationProvider::show(const WebNotification& notification) { | 37 bool NotificationProvider::show(const WebNotification& notification) { |
39 int notification_id = manager_.RegisterNotification(notification); | 38 int notification_id = manager_.RegisterNotification(notification); |
40 if (notification.isHTML()) | 39 if (notification.isHTML()) |
41 return ShowHTML(notification, notification_id); | 40 return ShowHTML(notification, notification_id); |
42 else | 41 else |
43 return ShowText(notification, notification_id); | 42 return ShowText(notification, notification_id); |
44 } | 43 } |
45 | 44 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 DCHECK(callback); | 172 DCHECK(callback); |
174 callback->permissionRequestComplete(); | 173 callback->permissionRequestComplete(); |
175 manager_.OnPermissionRequestComplete(id); | 174 manager_.OnPermissionRequestComplete(id); |
176 } | 175 } |
177 | 176 |
178 void NotificationProvider::OnNavigate() { | 177 void NotificationProvider::OnNavigate() { |
179 manager_.Clear(); | 178 manager_.Clear(); |
180 } | 179 } |
181 | 180 |
182 } // namespace content | 181 } // namespace content |
OLD | NEW |