| 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 |
| 212 bool NotificationManager::OnMessageReceived(const IPC::Message& message) { | 226 bool NotificationManager::OnMessageReceived(const IPC::Message& message) { |
| 213 bool handled = true; | 227 bool handled = true; |
| 214 IPC_BEGIN_MESSAGE_MAP(NotificationManager, message) | 228 IPC_BEGIN_MESSAGE_MAP(NotificationManager, message) |
| 215 IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidShow, OnDidShow); | 229 IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidShow, OnDidShow); |
| 216 IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidShowPersistent, | 230 IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidShowPersistent, |
| 217 OnDidShowPersistent) | 231 OnDidShowPersistent) |
| 218 IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidClose, OnDidClose); | 232 IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidClose, OnDidClose); |
| 219 IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidClick, OnDidClick); | 233 IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidClick, OnDidClick); |
| 220 IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidGetNotifications, | 234 IPC_MESSAGE_HANDLER(PlatformNotificationMsg_DidGetNotifications, |
| 221 OnDidGetNotifications) | 235 OnDidGetNotifications) |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 | 300 |
| 287 notifications[i] = web_notification_info; | 301 notifications[i] = web_notification_info; |
| 288 } | 302 } |
| 289 | 303 |
| 290 callbacks->onSuccess(notifications); | 304 callbacks->onSuccess(notifications); |
| 291 | 305 |
| 292 pending_get_notification_requests_.Remove(request_id); | 306 pending_get_notification_requests_.Remove(request_id); |
| 293 } | 307 } |
| 294 | 308 |
| 295 } // namespace content | 309 } // namespace content |
| OLD | NEW |