| 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 <cmath> | 7 #include <cmath> |
| 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 | 267 |
| 268 void NotificationManager::OnDidClose(int notification_id) { | 268 void NotificationManager::OnDidClose(int notification_id) { |
| 269 const auto& iter = active_page_notifications_.find(notification_id); | 269 const auto& iter = active_page_notifications_.find(notification_id); |
| 270 if (iter == active_page_notifications_.end()) | 270 if (iter == active_page_notifications_.end()) |
| 271 return; | 271 return; |
| 272 | 272 |
| 273 iter->second->dispatchCloseEvent(); | 273 iter->second->dispatchCloseEvent(); |
| 274 active_page_notifications_.erase(iter); | 274 active_page_notifications_.erase(iter); |
| 275 } | 275 } |
| 276 | 276 |
| 277 void NotificationManager::OnDidClick(int notification_id) { | 277 void NotificationManager::OnDidClick(int notification_id, int action_index) { |
| 278 const auto& iter = active_page_notifications_.find(notification_id); | 278 const auto& iter = active_page_notifications_.find(notification_id); |
| 279 if (iter == active_page_notifications_.end()) | 279 if (iter == active_page_notifications_.end()) |
| 280 return; | 280 return; |
| 281 | 281 |
| 282 iter->second->dispatchClickEvent(); | 282 iter->second->dispatchClickEvent(action_index); |
| 283 } | 283 } |
| 284 | 284 |
| 285 void NotificationManager::OnDidGetNotifications( | 285 void NotificationManager::OnDidGetNotifications( |
| 286 int request_id, | 286 int request_id, |
| 287 const std::vector<PersistentNotificationInfo>& notification_infos) { | 287 const std::vector<PersistentNotificationInfo>& notification_infos) { |
| 288 blink::WebNotificationGetCallbacks* callbacks = | 288 blink::WebNotificationGetCallbacks* callbacks = |
| 289 pending_get_notification_requests_.Lookup(request_id); | 289 pending_get_notification_requests_.Lookup(request_id); |
| 290 DCHECK(callbacks); | 290 DCHECK(callbacks); |
| 291 if (!callbacks) | 291 if (!callbacks) |
| 292 return; | 292 return; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 | 342 |
| 343 // TODO(mkwst): This is potentially doing the wrong thing with unique | 343 // TODO(mkwst): This is potentially doing the wrong thing with unique |
| 344 // origins. Perhaps also 'file:', 'blob:' and 'filesystem:'. See | 344 // origins. Perhaps also 'file:', 'blob:' and 'filesystem:'. See |
| 345 // https://crbug.com/490074 for detail. | 345 // https://crbug.com/490074 for detail. |
| 346 thread_safe_sender_->Send(new PlatformNotificationHostMsg_ShowPersistent( | 346 thread_safe_sender_->Send(new PlatformNotificationHostMsg_ShowPersistent( |
| 347 request_id, service_worker_registration_id, GURL(origin.toString()), icon, | 347 request_id, service_worker_registration_id, GURL(origin.toString()), icon, |
| 348 ToPlatformNotificationData(notification_data))); | 348 ToPlatformNotificationData(notification_data))); |
| 349 } | 349 } |
| 350 | 350 |
| 351 } // namespace content | 351 } // namespace content |
| OLD | NEW |