Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: chrome/browser/extensions/api/notifications/extension_notification_handler.cc

Issue 2888303004: Minimize the delegate dependencies for non persistent notifications. (Closed)
Patch Set: review Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
103 void ExtensionNotificationHandler::SendEvent( 99 void ExtensionNotificationHandler::SendEvent(
104 Profile* profile, 100 Profile* profile,
105 const std::string& extension_id, 101 const std::string& extension_id,
106 events::HistogramValue histogram_value, 102 events::HistogramValue histogram_value,
107 const std::string& event_name, 103 const std::string& event_name,
108 EventRouter::UserGestureState user_gesture, 104 EventRouter::UserGestureState user_gesture,
109 std::unique_ptr<base::ListValue> args) { 105 std::unique_ptr<base::ListValue> args) {
110 if (extension_id.empty()) 106 if (extension_id.empty())
111 return; 107 return;
112 108
113 EventRouter* event_router = EventRouter::Get(profile); 109 EventRouter* event_router = EventRouter::Get(profile);
114 if (!event_router) 110 if (!event_router)
115 return; 111 return;
116 112
117 std::unique_ptr<Event> event( 113 std::unique_ptr<Event> event(
118 new Event(histogram_value, event_name, std::move(args))); 114 new Event(histogram_value, event_name, std::move(args)));
119 event->user_gesture = user_gesture; 115 event->user_gesture = user_gesture;
120 event_router->DispatchEventToExtension(extension_id, std::move(event)); 116 event_router->DispatchEventToExtension(extension_id, std::move(event));
121 } 117 }
122 118
123 } // namespace extensions 119 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698