| 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/child/notifications/notification_manager.h" | 5 #include "content/child/notifications/notification_manager.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 blink::WebNotificationDelegate* delegate) { | 202 blink::WebNotificationDelegate* delegate) { |
| 203 for (auto& iter : active_page_notifications_) { | 203 for (auto& iter : active_page_notifications_) { |
| 204 if (iter.second != delegate) | 204 if (iter.second != delegate) |
| 205 continue; | 205 continue; |
| 206 | 206 |
| 207 active_page_notifications_.erase(iter.first); | 207 active_page_notifications_.erase(iter.first); |
| 208 return; | 208 return; |
| 209 } | 209 } |
| 210 } | 210 } |
| 211 | 211 |
| 212 blink::mojom::blink::PermissionStatus NotificationManager::checkPermission( | |
| 213 const blink::WebSecurityOrigin& origin) { | |
| 214 blink::mojom::PermissionStatus permission_status = | |
| 215 blink::mojom::PermissionStatus::DENIED; | |
| 216 | |
| 217 // TODO(mkwst): This is potentially doing the wrong thing with unique | |
| 218 // origins. Perhaps also 'file:', 'blob:' and 'filesystem:'. See | |
| 219 // https://crbug.com/490074 for detail. | |
| 220 thread_safe_sender_->Send(new PlatformNotificationHostMsg_CheckPermission( | |
| 221 blink::WebStringToGURL(origin.toString()), &permission_status)); | |
| 222 | |
| 223 return static_cast<blink::mojom::blink::PermissionStatus>(permission_status); | |
| 224 } | |
| 225 | |
| 226 bool NotificationManager::OnMessageReceived(const IPC::Message& message) { | 212 bool NotificationManager::OnMessageReceived(const IPC::Message& message) { |
| 227 bool handled = true; | 213 bool handled = true; |
| 228 IPC_BEGIN_MESSAGE_MAP(NotificationManager, message) | 214 IPC_BEGIN_MESSAGE_MAP(NotificationManager, message) |
| 229 IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidShow, OnDidShow); | 215 IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidShow, OnDidShow); |
| 230 IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidShowPersistent, | 216 IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidShowPersistent, |
| 231 OnDidShowPersistent) | 217 OnDidShowPersistent) |
| 232 IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidClose, OnDidClose); | 218 IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidClose, OnDidClose); |
| 233 IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidClick, OnDidClick); | 219 IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidClick, OnDidClick); |
| 234 IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidGetNotifications, | 220 IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidGetNotifications, |
| 235 OnDidGetNotifications) | 221 OnDidGetNotifications) |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 | 286 |
| 301 notifications[i] = web_notification_info; | 287 notifications[i] = web_notification_info; |
| 302 } | 288 } |
| 303 | 289 |
| 304 callbacks->onSuccess(notifications); | 290 callbacks->onSuccess(notifications); |
| 305 | 291 |
| 306 pending_get_notification_requests_.Remove(request_id); | 292 pending_get_notification_requests_.Remove(request_id); |
| 307 } | 293 } |
| 308 | 294 |
| 309 } // namespace content | 295 } // namespace content |
| OLD | NEW |