| 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/nullable_string16.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/notifications/non_persistent_notification_handler.h" | 10 #include "chrome/browser/notifications/non_persistent_notification_handler.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 std::set<std::string>* notifications) const { | 73 std::set<std::string>* notifications) const { |
| 74 return notification_bridge_->GetDisplayed( | 74 return notification_bridge_->GetDisplayed( |
| 75 GetProfileId(profile_), profile_->IsOffTheRecord(), notifications); | 75 GetProfileId(profile_), profile_->IsOffTheRecord(), notifications); |
| 76 } | 76 } |
| 77 | 77 |
| 78 void NativeNotificationDisplayService::ProcessNotificationOperation( | 78 void NativeNotificationDisplayService::ProcessNotificationOperation( |
| 79 NotificationCommon::Operation operation, | 79 NotificationCommon::Operation operation, |
| 80 NotificationCommon::Type notification_type, | 80 NotificationCommon::Type notification_type, |
| 81 const std::string& origin, | 81 const std::string& origin, |
| 82 const std::string& notification_id, | 82 const std::string& notification_id, |
| 83 int action_index) { | 83 int action_index, |
| 84 const base::NullableString16& reply) { |
| 84 NotificationHandler* handler = GetNotificationHandler(notification_type); | 85 NotificationHandler* handler = GetNotificationHandler(notification_type); |
| 85 CHECK(handler); | 86 CHECK(handler); |
| 86 switch (operation) { | 87 switch (operation) { |
| 87 case NotificationCommon::CLICK: | 88 case NotificationCommon::CLICK: |
| 88 handler->OnClick(profile_, origin, notification_id, action_index, | 89 handler->OnClick(profile_, origin, notification_id, action_index, reply); |
| 89 base::NullableString16() /* reply */); | |
| 90 break; | 90 break; |
| 91 case NotificationCommon::CLOSE: | 91 case NotificationCommon::CLOSE: |
| 92 handler->OnClose(profile_, origin, notification_id, true /* by_user */); | 92 handler->OnClose(profile_, origin, notification_id, true /* by_user */); |
| 93 break; | 93 break; |
| 94 case NotificationCommon::SETTINGS: | 94 case NotificationCommon::SETTINGS: |
| 95 handler->OpenSettings(profile_); | 95 handler->OpenSettings(profile_); |
| 96 break; | 96 break; |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 | 99 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 110 notification_handlers_.erase(notification_type); | 110 notification_handlers_.erase(notification_type); |
| 111 } | 111 } |
| 112 | 112 |
| 113 NotificationHandler* NativeNotificationDisplayService::GetNotificationHandler( | 113 NotificationHandler* NativeNotificationDisplayService::GetNotificationHandler( |
| 114 NotificationCommon::Type notification_type) { | 114 NotificationCommon::Type notification_type) { |
| 115 DCHECK(notification_handlers_.find(notification_type) != | 115 DCHECK(notification_handlers_.find(notification_type) != |
| 116 notification_handlers_.end()) | 116 notification_handlers_.end()) |
| 117 << notification_type << " is not registered."; | 117 << notification_type << " is not registered."; |
| 118 return notification_handlers_[notification_type].get(); | 118 return notification_handlers_[notification_type].get(); |
| 119 } | 119 } |
| OLD | NEW |