| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/notifications/native_notification_display_service.h" | 5 #include "chrome/browser/notifications/native_notification_display_service.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/strings/nullable_string16.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/notifications/non_persistent_notification_handler.h" | 10 #include "chrome/browser/notifications/non_persistent_notification_handler.h" |
| 10 #include "chrome/browser/notifications/notification.h" | 11 #include "chrome/browser/notifications/notification.h" |
| 11 #include "chrome/browser/notifications/notification_delegate.h" | 12 #include "chrome/browser/notifications/notification_delegate.h" |
| 12 #include "chrome/browser/notifications/notification_handler.h" | 13 #include "chrome/browser/notifications/notification_handler.h" |
| 13 #include "chrome/browser/notifications/notification_platform_bridge.h" | 14 #include "chrome/browser/notifications/notification_platform_bridge.h" |
| 14 #include "chrome/browser/notifications/persistent_notification_handler.h" | 15 #include "chrome/browser/notifications/persistent_notification_handler.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 16 | 17 |
| 17 namespace { | 18 namespace { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 void NativeNotificationDisplayService::ProcessNotificationOperation( | 78 void NativeNotificationDisplayService::ProcessNotificationOperation( |
| 78 NotificationCommon::Operation operation, | 79 NotificationCommon::Operation operation, |
| 79 NotificationCommon::Type notification_type, | 80 NotificationCommon::Type notification_type, |
| 80 const std::string& origin, | 81 const std::string& origin, |
| 81 const std::string& notification_id, | 82 const std::string& notification_id, |
| 82 int action_index) { | 83 int action_index) { |
| 83 NotificationHandler* handler = GetNotificationHandler(notification_type); | 84 NotificationHandler* handler = GetNotificationHandler(notification_type); |
| 84 CHECK(handler); | 85 CHECK(handler); |
| 85 switch (operation) { | 86 switch (operation) { |
| 86 case NotificationCommon::CLICK: | 87 case NotificationCommon::CLICK: |
| 87 handler->OnClick(profile_, origin, notification_id, action_index); | 88 handler->OnClick(profile_, origin, notification_id, action_index, |
| 89 base::NullableString16() /* reply */); |
| 88 break; | 90 break; |
| 89 case NotificationCommon::CLOSE: | 91 case NotificationCommon::CLOSE: |
| 90 handler->OnClose(profile_, origin, notification_id, true /* by_user */); | 92 handler->OnClose(profile_, origin, notification_id, true /* by_user */); |
| 91 break; | 93 break; |
| 92 case NotificationCommon::SETTINGS: | 94 case NotificationCommon::SETTINGS: |
| 93 handler->OpenSettings(profile_); | 95 handler->OpenSettings(profile_); |
| 94 break; | 96 break; |
| 95 } | 97 } |
| 96 } | 98 } |
| 97 | 99 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 108 notification_handlers_.erase(notification_type); | 110 notification_handlers_.erase(notification_type); |
| 109 } | 111 } |
| 110 | 112 |
| 111 NotificationHandler* NativeNotificationDisplayService::GetNotificationHandler( | 113 NotificationHandler* NativeNotificationDisplayService::GetNotificationHandler( |
| 112 NotificationCommon::Type notification_type) { | 114 NotificationCommon::Type notification_type) { |
| 113 DCHECK(notification_handlers_.find(notification_type) != | 115 DCHECK(notification_handlers_.find(notification_type) != |
| 114 notification_handlers_.end()) | 116 notification_handlers_.end()) |
| 115 << notification_type << " is not registered."; | 117 << notification_type << " is not registered."; |
| 116 return notification_handlers_[notification_type].get(); | 118 return notification_handlers_[notification_type].get(); |
| 117 } | 119 } |
| OLD | NEW |