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

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

Issue 2875673002: Minimize the delegate dependencies for native extension notifications. (Closed)
Patch Set: review Created 3 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/extensions/api/notifications/extension_notification_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef CHROME_BROWSER_EXTENSIONS_API_NOTIFICATIONS_EXTENSION_NOTIFICATION_HANDL ER_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_NOTIFICATIONS_EXTENSION_NOTIFICATION_HANDL ER_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_NOTIFICATIONS_EXTENSION_NOTIFICATION_HANDL ER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_NOTIFICATIONS_EXTENSION_NOTIFICATION_HANDL ER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "chrome/browser/notifications/non_persistent_notification_handler.h" 9 #include "chrome/browser/notifications/notification_handler.h"
10 #include "extensions/browser/event_router.h"
11
12 class Profile;
13
14 namespace extensions {
10 15
11 // Handler for notifications shown by extensions. Will be created and owned by 16 // Handler for notifications shown by extensions. Will be created and owned by
12 // the NotificationDisplayService. 17 // the NativeNotificationDisplayService.
13 class ExtensionNotificationHandler : public NonPersistentNotificationHandler { 18 class ExtensionNotificationHandler : public NotificationHandler {
14 public: 19 public:
15 ExtensionNotificationHandler(); 20 ExtensionNotificationHandler();
16 ~ExtensionNotificationHandler() override; 21 ~ExtensionNotificationHandler() override;
17 22
18 // NotificationHandler implementation. 23 // NotificationHandler implementation.
24 void OnClose(Profile* profile,
25 const std::string& origin,
26 const std::string& notification_id,
27 bool by_user) override;
28 void OnClick(Profile* profile,
29 const std::string& origin,
30 const std::string& notification_id,
31 int action_index,
32 const base::NullableString16& reply) override;
19 void OpenSettings(Profile* profile) override; 33 void OpenSettings(Profile* profile) override;
34 void RegisterNotification(const std::string& notification_id,
35 NotificationDelegate* delegate) override;
20 36
21 private: 37 protected:
38 // Overriden in unit tests.
39 virtual void SendEvent(Profile* profile,
40 const std::string& extension_id,
41 events::HistogramValue histogram_value,
42 const std::string& name,
43 EventRouter::UserGestureState user_gesture,
44 std::unique_ptr<base::ListValue> args);
45
22 DISALLOW_COPY_AND_ASSIGN(ExtensionNotificationHandler); 46 DISALLOW_COPY_AND_ASSIGN(ExtensionNotificationHandler);
23 }; 47 };
24 48
49 } // namespace extensions
50
25 #endif // CHROME_BROWSER_EXTENSIONS_API_NOTIFICATIONS_EXTENSION_NOTIFICATION_HA NDLER_H_ 51 #endif // CHROME_BROWSER_EXTENSIONS_API_NOTIFICATIONS_EXTENSION_NOTIFICATION_HA NDLER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/notifications/extension_notification_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698