| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_PERSISTENT_NOTIFICATION_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_PERSISTENT_NOTIFICATION_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_NOTIFICATIONS_PERSISTENT_NOTIFICATION_DELEGATE_H_ | 6 #define CHROME_BROWSER_NOTIFICATIONS_PERSISTENT_NOTIFICATION_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "chrome/browser/notifications/notification_delegate.h" | 11 #include "chrome/browser/notifications/web_notification_delegate.h" |
| 12 #include "url/gurl.h" | 12 |
| 13 class GURL; |
| 13 | 14 |
| 14 namespace content { | 15 namespace content { |
| 15 class BrowserContext; | 16 class BrowserContext; |
| 16 } | 17 } |
| 17 | 18 |
| 18 // Delegate responsible for listening to the click event on persistent | 19 // Delegate responsible for listening to the click event on persistent |
| 19 // notifications, to forward them to the PlatformNotificationService so that | 20 // notifications, to forward them to the PlatformNotificationService so that |
| 20 // JavaScript events can be fired on the associated Service Worker. | 21 // JavaScript events can be fired on the associated Service Worker. |
| 21 class PersistentNotificationDelegate : public NotificationDelegate { | 22 class PersistentNotificationDelegate : public WebNotificationDelegate { |
| 22 public: | 23 public: |
| 23 PersistentNotificationDelegate(content::BrowserContext* browser_context, | 24 PersistentNotificationDelegate(content::BrowserContext* browser_context, |
| 24 const std::string& notification_id, | 25 const std::string& notification_id, |
| 25 const GURL& origin, | 26 const GURL& origin, |
| 26 int notification_settings_index); | 27 int notification_settings_index); |
| 27 | 28 |
| 28 // NotificationDelegate implementation. | 29 // NotificationDelegate implementation. |
| 29 void Display() override; | 30 void Display() override; |
| 30 void Close(bool by_user) override; | 31 void Close(bool by_user) override; |
| 31 void Click() override; | 32 void Click() override; |
| 32 void ButtonClick(int button_index) override; | 33 void ButtonClick(int button_index) override; |
| 33 void SettingsClick() override; | |
| 34 bool ShouldDisplaySettingsButton() override; | |
| 35 | |
| 36 std::string id() const override; | |
| 37 | 34 |
| 38 protected: | 35 protected: |
| 39 ~PersistentNotificationDelegate() override; | 36 ~PersistentNotificationDelegate() override; |
| 40 | 37 |
| 41 private: | 38 private: |
| 42 content::BrowserContext* browser_context_; | |
| 43 std::string notification_id_; | |
| 44 GURL origin_; | |
| 45 int notification_settings_index_; | 39 int notification_settings_index_; |
| 46 | 40 |
| 47 DISALLOW_COPY_AND_ASSIGN(PersistentNotificationDelegate); | 41 DISALLOW_COPY_AND_ASSIGN(PersistentNotificationDelegate); |
| 48 }; | 42 }; |
| 49 | 43 |
| 50 #endif // CHROME_BROWSER_NOTIFICATIONS_PERSISTENT_NOTIFICATION_DELEGATE_H_ | 44 #endif // CHROME_BROWSER_NOTIFICATIONS_PERSISTENT_NOTIFICATION_DELEGATE_H_ |
| OLD | NEW |