bmalcolm | f8395c56 | 2016-09-29 22:49:14 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CHROME_BROWSER_NOTIFICATIONS_WEB_NOTIFICATION_DELEGATE_H_ |
| 6 | #define CHROME_BROWSER_NOTIFICATIONS_WEB_NOTIFICATION_DELEGATE_H_ |
| 7 | |
| 8 | #include <string> |
| 9 | |
bmalcolm | 989c7324 | 2016-10-10 17:42:45 | [diff] [blame] | 10 | #include "base/feature_list.h" |
bmalcolm | f8395c56 | 2016-09-29 22:49:14 | [diff] [blame] | 11 | #include "base/macros.h" |
miguelg | 40b10fd | 2017-06-09 13:54:09 | [diff] [blame] | 12 | #include "chrome/browser/notifications/notification_common.h" |
bmalcolm | f8395c56 | 2016-09-29 22:49:14 | [diff] [blame] | 13 | #include "chrome/browser/notifications/notification_delegate.h" |
| 14 | #include "url/gurl.h" |
| 15 | |
miguelg | 40b10fd | 2017-06-09 13:54:09 | [diff] [blame] | 16 | class Profile; |
bmalcolm | f8395c56 | 2016-09-29 22:49:14 | [diff] [blame] | 17 | |
bmalcolm | 989c7324 | 2016-10-10 17:42:45 | [diff] [blame] | 18 | namespace features { |
| 19 | |
| 20 | extern const base::Feature kAllowFullscreenWebNotificationsFeature; |
| 21 | |
| 22 | } // namespace features |
| 23 | |
miguelg | 40b10fd | 2017-06-09 13:54:09 | [diff] [blame] | 24 | // Delegate class for Web Notifications. |
bmalcolm | f8395c56 | 2016-09-29 22:49:14 | [diff] [blame] | 25 | class WebNotificationDelegate : public NotificationDelegate { |
| 26 | public: |
miguelg | 40b10fd | 2017-06-09 13:54:09 | [diff] [blame] | 27 | WebNotificationDelegate(NotificationCommon::Type notification_type, |
| 28 | Profile* profile, |
| 29 | const std::string& notification_id, |
| 30 | const GURL& origin); |
| 31 | |
bmalcolm | f8395c56 | 2016-09-29 22:49:14 | [diff] [blame] | 32 | // NotificationDelegate implementation. |
| 33 | std::string id() const override; |
peter | 9b6e3c7 | 2017-04-10 18:35:45 | [diff] [blame] | 34 | bool SettingsClick() override; |
bmalcolm | f8395c56 | 2016-09-29 22:49:14 | [diff] [blame] | 35 | bool ShouldDisplaySettingsButton() override; |
| 36 | bool ShouldDisplayOverFullscreen() const override; |
miguelg | 40b10fd | 2017-06-09 13:54:09 | [diff] [blame] | 37 | void Close(bool by_user) override; |
| 38 | void Click() override; |
| 39 | void ButtonClick(int button_index) override; |
| 40 | void ButtonClickWithReply(int button_index, |
| 41 | const base::string16& reply) override; |
bmalcolm | f8395c56 | 2016-09-29 22:49:14 | [diff] [blame] | 42 | |
| 43 | protected: |
bmalcolm | f8395c56 | 2016-09-29 22:49:14 | [diff] [blame] | 44 | ~WebNotificationDelegate() override; |
bmalcolm | f8395c56 | 2016-09-29 22:49:14 | [diff] [blame] | 45 | const GURL& origin() { return origin_; } |
| 46 | |
| 47 | private: |
miguelg | 40b10fd | 2017-06-09 13:54:09 | [diff] [blame] | 48 | NotificationCommon::Type notification_type_; |
| 49 | Profile* profile_; |
bmalcolm | f8395c56 | 2016-09-29 22:49:14 | [diff] [blame] | 50 | std::string notification_id_; |
| 51 | GURL origin_; |
| 52 | |
| 53 | DISALLOW_COPY_AND_ASSIGN(WebNotificationDelegate); |
| 54 | }; |
| 55 | |
| 56 | #endif // CHROME_BROWSER_NOTIFICATIONS_WEB_NOTIFICATION_DELEGATE_H_ |