OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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_NOTIFICATIONS_WEB_NOTIFICATION_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_WEB_NOTIFICATION_DELEGATE_H_ |
6 #define CHROME_BROWSER_NOTIFICATIONS_WEB_NOTIFICATION_DELEGATE_H_ | 6 #define CHROME_BROWSER_NOTIFICATIONS_WEB_NOTIFICATION_DELEGATE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/feature_list.h" | |
11 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "chrome/browser/notifications/notification_common.h" |
12 #include "chrome/browser/notifications/notification_delegate.h" | 12 #include "chrome/browser/notifications/notification_delegate.h" |
13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
14 | 14 |
15 namespace content { | 15 class Profile; |
16 class BrowserContext; | |
17 } | |
18 | 16 |
19 namespace features { | 17 // Delegate class for Web Notifications. |
20 | |
21 extern const base::Feature kAllowFullscreenWebNotificationsFeature; | |
22 | |
23 } // namespace features | |
24 | |
25 // Base class for the PersistentNotificationDelegate and the | |
26 // NotificationObjectProxy. All common functionality for displaying web | |
27 // notifications is found here. | |
28 // TODO(peter, crbug.com/596161): Migrate this functionality offered by the | |
29 // delegate to the NotificationDisplayService. | |
30 class WebNotificationDelegate : public NotificationDelegate { | 18 class WebNotificationDelegate : public NotificationDelegate { |
31 public: | 19 public: |
| 20 WebNotificationDelegate(NotificationCommon::Type notification_type, |
| 21 Profile* profile, |
| 22 const std::string& notification_id, |
| 23 const GURL& origin); |
| 24 |
32 // NotificationDelegate implementation. | 25 // NotificationDelegate implementation. |
33 std::string id() const override; | 26 std::string id() const override; |
34 bool SettingsClick() override; | 27 bool SettingsClick() override; |
35 bool ShouldDisplaySettingsButton() override; | 28 bool ShouldDisplaySettingsButton() override; |
36 bool ShouldDisplayOverFullscreen() const override; | 29 bool ShouldDisplayOverFullscreen() const override; |
| 30 void Close(bool by_user) override; |
| 31 void Click() override; |
| 32 void ButtonClick(int button_index) override; |
| 33 void ButtonClickWithReply(int button_index, |
| 34 const base::string16& reply) override; |
37 | 35 |
38 protected: | 36 protected: |
39 WebNotificationDelegate(content::BrowserContext* browser_context, | |
40 const std::string& notification_id, | |
41 const GURL& origin); | |
42 | |
43 ~WebNotificationDelegate() override; | 37 ~WebNotificationDelegate() override; |
44 | |
45 content::BrowserContext* browser_context() { return browser_context_; } | |
46 const GURL& origin() { return origin_; } | 38 const GURL& origin() { return origin_; } |
47 | 39 |
48 private: | 40 private: |
49 content::BrowserContext* browser_context_; | 41 NotificationCommon::Type notification_type_; |
| 42 Profile* profile_; |
50 std::string notification_id_; | 43 std::string notification_id_; |
51 GURL origin_; | 44 GURL origin_; |
52 | 45 |
53 DISALLOW_COPY_AND_ASSIGN(WebNotificationDelegate); | 46 DISALLOW_COPY_AND_ASSIGN(WebNotificationDelegate); |
54 }; | 47 }; |
55 | 48 |
56 #endif // CHROME_BROWSER_NOTIFICATIONS_WEB_NOTIFICATION_DELEGATE_H_ | 49 #endif // CHROME_BROWSER_NOTIFICATIONS_WEB_NOTIFICATION_DELEGATE_H_ |
OLD | NEW |