| 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 "base/strings/string16.h" |
| 11 #include "chrome/browser/notifications/web_notification_delegate.h" | 12 #include "chrome/browser/notifications/web_notification_delegate.h" |
| 12 | 13 |
| 13 class GURL; | 14 class GURL; |
| 14 | 15 |
| 15 namespace content { | 16 namespace content { |
| 16 class BrowserContext; | 17 class BrowserContext; |
| 17 } | 18 } |
| 18 | 19 |
| 19 // Delegate responsible for listening to the click event on persistent | 20 // Delegate responsible for listening to the click event on persistent |
| 20 // notifications, to forward them to the PlatformNotificationService so that | 21 // notifications, to forward them to the PlatformNotificationService so that |
| 21 // JavaScript events can be fired on the associated Service Worker. | 22 // JavaScript events can be fired on the associated Service Worker. |
| 22 class PersistentNotificationDelegate : public WebNotificationDelegate { | 23 class PersistentNotificationDelegate : public WebNotificationDelegate { |
| 23 public: | 24 public: |
| 24 PersistentNotificationDelegate(content::BrowserContext* browser_context, | 25 PersistentNotificationDelegate(content::BrowserContext* browser_context, |
| 25 const std::string& notification_id, | 26 const std::string& notification_id, |
| 26 const GURL& origin, | 27 const GURL& origin, |
| 27 int notification_settings_index); | 28 int notification_settings_index); |
| 28 | 29 |
| 29 // NotificationDelegate implementation. | 30 // NotificationDelegate implementation. |
| 30 void Display() override; | 31 void Display() override; |
| 31 void Close(bool by_user) override; | 32 void Close(bool by_user) override; |
| 32 void Click() override; | 33 void Click() override; |
| 33 void ButtonClick(int button_index) override; | 34 void ButtonClick(int button_index) override; |
| 35 void ButtonClickWithReply(int button_index, |
| 36 const base::string16& reply) override; |
| 34 | 37 |
| 35 protected: | 38 protected: |
| 36 ~PersistentNotificationDelegate() override; | 39 ~PersistentNotificationDelegate() override; |
| 37 | 40 |
| 38 private: | 41 private: |
| 39 int notification_settings_index_; | 42 int notification_settings_index_; |
| 40 | 43 |
| 41 DISALLOW_COPY_AND_ASSIGN(PersistentNotificationDelegate); | 44 DISALLOW_COPY_AND_ASSIGN(PersistentNotificationDelegate); |
| 42 }; | 45 }; |
| 43 | 46 |
| 44 #endif // CHROME_BROWSER_NOTIFICATIONS_PERSISTENT_NOTIFICATION_DELEGATE_H_ | 47 #endif // CHROME_BROWSER_NOTIFICATIONS_PERSISTENT_NOTIFICATION_DELEGATE_H_ |
| OLD | NEW |