| 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 #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/feature_list.h" |
| 8 #include "base/macros.h" | 9 #include "base/macros.h" |
| 9 #include "chrome/browser/notifications/notification_handler.h" | 10 #include "chrome/browser/notifications/notification_handler.h" |
| 10 #include "extensions/browser/event_router.h" | 11 #include "extensions/browser/event_router.h" |
| 11 | 12 |
| 12 class Profile; | 13 class Profile; |
| 13 | 14 |
| 14 namespace extensions { | 15 namespace extensions { |
| 15 | 16 |
| 17 // Exposed publicly for tests. |
| 18 // TODO(miguelg) we can probably get rid of this now. |
| 19 extern const base::Feature kAllowFullscreenAppNotificationsFeature; |
| 20 |
| 16 // Handler for notifications shown by extensions. Will be created and owned by | 21 // Handler for notifications shown by extensions. Will be created and owned by |
| 17 // the NativeNotificationDisplayService. | 22 // the NativeNotificationDisplayService. |
| 18 class ExtensionNotificationHandler : public NotificationHandler { | 23 class ExtensionNotificationHandler : public NotificationHandler { |
| 19 public: | 24 public: |
| 20 ExtensionNotificationHandler(); | 25 ExtensionNotificationHandler(); |
| 21 ~ExtensionNotificationHandler() override; | 26 ~ExtensionNotificationHandler() override; |
| 22 | 27 |
| 23 // NotificationHandler implementation. | 28 // NotificationHandler implementation. |
| 24 void OnShow(Profile* profile, const std::string& notification_id) override; | 29 void OnShow(Profile* profile, const std::string& notification_id) override; |
| 25 void OnClose(Profile* profile, | 30 void OnClose(Profile* profile, |
| 26 const std::string& origin, | 31 const std::string& origin, |
| 27 const std::string& notification_id, | 32 const std::string& notification_id, |
| 28 bool by_user) override; | 33 bool by_user) override; |
| 29 void OnClick(Profile* profile, | 34 void OnClick(Profile* profile, |
| 30 const std::string& origin, | 35 const std::string& origin, |
| 31 const std::string& notification_id, | 36 const std::string& notification_id, |
| 32 int action_index, | 37 int action_index, |
| 33 const base::NullableString16& reply) override; | 38 const base::NullableString16& reply) override; |
| 34 void OpenSettings(Profile* profile) override; | 39 void OpenSettings(Profile* profile) override; |
| 40 bool ShouldDisplayOnFullScreen(Profile* profile, |
| 41 const std::string& origin) const override; |
| 35 | 42 |
| 36 protected: | 43 protected: |
| 37 // Overriden in unit tests. | 44 // Overriden in unit tests. |
| 38 virtual void SendEvent(Profile* profile, | 45 virtual void SendEvent(Profile* profile, |
| 39 const std::string& extension_id, | 46 const std::string& extension_id, |
| 40 events::HistogramValue histogram_value, | 47 events::HistogramValue histogram_value, |
| 41 const std::string& name, | 48 const std::string& name, |
| 42 EventRouter::UserGestureState user_gesture, | 49 EventRouter::UserGestureState user_gesture, |
| 43 std::unique_ptr<base::ListValue> args); | 50 std::unique_ptr<base::ListValue> args); |
| 44 | 51 |
| 45 DISALLOW_COPY_AND_ASSIGN(ExtensionNotificationHandler); | 52 DISALLOW_COPY_AND_ASSIGN(ExtensionNotificationHandler); |
| 46 }; | 53 }; |
| 47 | 54 |
| 48 } // namespace extensions | 55 } // namespace extensions |
| 49 | 56 |
| 50 #endif // CHROME_BROWSER_EXTENSIONS_API_NOTIFICATIONS_EXTENSION_NOTIFICATION_HA
NDLER_H_ | 57 #endif // CHROME_BROWSER_EXTENSIONS_API_NOTIFICATIONS_EXTENSION_NOTIFICATION_HA
NDLER_H_ |
| OLD | NEW |