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 notification_bridge_->Close(GetProfileId(profile_), notification_id); | 73 notification_bridge_->Close(GetProfileId(profile_), notification_id); |
74 | 74 |
75 // TODO(miguelg): Figure out something better here, passing an empty | 75 // TODO(miguelg): Figure out something better here, passing an empty |
76 // origin works because only non persistent notifications care about | 76 // origin works because only non persistent notifications care about |
77 // this method for JS generated close calls and they don't require | 77 // this method for JS generated close calls and they don't require |
78 // the origin. | 78 // the origin. |
79 handler->OnClose(profile_, "", notification_id, false /* by user */); | 79 handler->OnClose(profile_, "", notification_id, false /* by user */); |
80 } | 80 } |
81 | 81 |
82 void NativeNotificationDisplayService::GetDisplayed( | 82 void NativeNotificationDisplayService::GetDisplayed( |
83 const DisplayedNotificationsCallback& callback) const { | 83 const DisplayedNotificationsCallback& callback) { |
84 return notification_bridge_->GetDisplayed( | 84 return notification_bridge_->GetDisplayed( |
85 GetProfileId(profile_), profile_->IsOffTheRecord(), callback); | 85 GetProfileId(profile_), profile_->IsOffTheRecord(), callback); |
86 } | 86 } |
87 | 87 |
88 void NativeNotificationDisplayService::ProcessNotificationOperation( | 88 void NativeNotificationDisplayService::ProcessNotificationOperation( |
89 NotificationCommon::Operation operation, | 89 NotificationCommon::Operation operation, |
90 NotificationCommon::Type notification_type, | 90 NotificationCommon::Type notification_type, |
91 const std::string& origin, | 91 const std::string& origin, |
92 const std::string& notification_id, | 92 const std::string& notification_id, |
93 int action_index, | 93 int action_index, |
(...skipping 26 matching lines...) Expand all Loading... |
120 notification_handlers_.erase(notification_type); | 120 notification_handlers_.erase(notification_type); |
121 } | 121 } |
122 | 122 |
123 NotificationHandler* NativeNotificationDisplayService::GetNotificationHandler( | 123 NotificationHandler* NativeNotificationDisplayService::GetNotificationHandler( |
124 NotificationCommon::Type notification_type) { | 124 NotificationCommon::Type notification_type) { |
125 DCHECK(notification_handlers_.find(notification_type) != | 125 DCHECK(notification_handlers_.find(notification_type) != |
126 notification_handlers_.end()) | 126 notification_handlers_.end()) |
127 << notification_type << " is not registered."; | 127 << notification_type << " is not registered."; |
128 return notification_handlers_[notification_type].get(); | 128 return notification_handlers_[notification_type].get(); |
129 } | 129 } |
OLD | NEW |