| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/extensions/api/notifications/extension_notification_han
dler.h" | 5 #include "chrome/browser/extensions/api/notifications/extension_notification_han
dler.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/nullable_string16.h" | 8 #include "base/strings/nullable_string16.h" |
| 9 #include "base/strings/string_piece.h" | 9 #include "base/strings/string_piece.h" |
| 10 #include "chrome/browser/extensions/api/notifications/extension_notification_dis
play_helper.h" | 10 #include "chrome/browser/extensions/api/notifications/extension_notification_dis
play_helper.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 89 |
| 90 SendEvent(profile, extension_id, histogram_value, event_name, | 90 SendEvent(profile, extension_id, histogram_value, event_name, |
| 91 EventRouter::USER_GESTURE_ENABLED, std::move(args)); | 91 EventRouter::USER_GESTURE_ENABLED, std::move(args)); |
| 92 } | 92 } |
| 93 | 93 |
| 94 void ExtensionNotificationHandler::OpenSettings(Profile* profile) { | 94 void ExtensionNotificationHandler::OpenSettings(Profile* profile) { |
| 95 // Extension notifications don't display a settings button. | 95 // Extension notifications don't display a settings button. |
| 96 NOTREACHED(); | 96 NOTREACHED(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 void ExtensionNotificationHandler::RegisterNotification( |
| 100 const std::string& notification_id, |
| 101 NotificationDelegate* delegate) {} |
| 102 |
| 99 void ExtensionNotificationHandler::SendEvent( | 103 void ExtensionNotificationHandler::SendEvent( |
| 100 Profile* profile, | 104 Profile* profile, |
| 101 const std::string& extension_id, | 105 const std::string& extension_id, |
| 102 events::HistogramValue histogram_value, | 106 events::HistogramValue histogram_value, |
| 103 const std::string& event_name, | 107 const std::string& event_name, |
| 104 EventRouter::UserGestureState user_gesture, | 108 EventRouter::UserGestureState user_gesture, |
| 105 std::unique_ptr<base::ListValue> args) { | 109 std::unique_ptr<base::ListValue> args) { |
| 106 if (extension_id.empty()) | 110 if (extension_id.empty()) |
| 107 return; | 111 return; |
| 108 | 112 |
| 109 EventRouter* event_router = EventRouter::Get(profile); | 113 EventRouter* event_router = EventRouter::Get(profile); |
| 110 if (!event_router) | 114 if (!event_router) |
| 111 return; | 115 return; |
| 112 | 116 |
| 113 std::unique_ptr<Event> event( | 117 std::unique_ptr<Event> event( |
| 114 new Event(histogram_value, event_name, std::move(args))); | 118 new Event(histogram_value, event_name, std::move(args))); |
| 115 event->user_gesture = user_gesture; | 119 event->user_gesture = user_gesture; |
| 116 event_router->DispatchEventToExtension(extension_id, std::move(event)); | 120 event_router->DispatchEventToExtension(extension_id, std::move(event)); |
| 117 } | 121 } |
| 118 | 122 |
| 119 } // namespace extensions | 123 } // namespace extensions |
| OLD | NEW |