Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_NOTIFICATION_OBJECT_PROXY_H_ | 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_OBJECT_PROXY_H_ |
| 6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_OBJECT_PROXY_H_ | 6 #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_OBJECT_PROXY_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "chrome/browser/notifications/notification_delegate.h" | 12 #include "chrome/browser/notifications/web_notification_delegate.h" |
| 13 #include "url/gurl.h" | |
|
Peter Beverloo
2016/09/27 17:17:36
nit: forward declare
bmalcolm
2016/09/27 20:34:36
Done. Also fixed it in persistent_notification_del
| |
| 13 | 14 |
| 14 namespace content { | 15 namespace content { |
| 15 class BrowserContext; | 16 class BrowserContext; |
| 16 class DesktopNotificationDelegate; | 17 class DesktopNotificationDelegate; |
| 17 } | 18 } |
| 18 | 19 |
| 19 // A NotificationObjectProxy stands in for the JavaScript Notification object | 20 // A NotificationObjectProxy stands in for the JavaScript Notification object |
| 20 // which corresponds to a notification toast on the desktop. It can be signaled | 21 // which corresponds to a notification toast on the desktop. It can be signaled |
| 21 // when various events occur regarding the desktop notification, and the | 22 // when various events occur regarding the desktop notification, and the |
| 22 // attached JS listeners will be invoked in the renderer or worker process. | 23 // attached JS listeners will be invoked in the renderer or worker process. |
| 23 class NotificationObjectProxy : public NotificationDelegate { | 24 class NotificationObjectProxy : public WebNotificationDelegate { |
| 24 public: | 25 public: |
| 25 // Creates a Proxy object with the necessary callback information. The Proxy | 26 // Creates a Proxy object with the necessary callback information. The Proxy |
| 26 // will take ownership of |delegate|. | 27 // will take ownership of |delegate|. |
| 27 NotificationObjectProxy( | 28 NotificationObjectProxy( |
| 28 content::BrowserContext* browser_context, | 29 content::BrowserContext* browser_context, |
| 29 const std::string& notification_id, | 30 const std::string& notification_id, |
| 31 const GURL& origin, | |
| 30 std::unique_ptr<content::DesktopNotificationDelegate> delegate); | 32 std::unique_ptr<content::DesktopNotificationDelegate> delegate); |
| 31 | 33 |
| 32 // NotificationDelegate implementation. | 34 // NotificationDelegate implementation. |
| 33 void Display() override; | 35 void Display() override; |
| 34 void Close(bool by_user) override; | 36 void Close(bool by_user) override; |
| 35 void Click() override; | 37 void Click() override; |
| 36 void ButtonClick(int button_index) override; | 38 void ButtonClick(int button_index) override; |
| 37 void SettingsClick() override; | |
| 38 bool ShouldDisplaySettingsButton() override; | |
| 39 std::string id() const override; | |
| 40 | 39 |
| 41 protected: | 40 protected: |
| 42 ~NotificationObjectProxy() override; | 41 ~NotificationObjectProxy() override; |
| 43 | 42 |
| 44 private: | 43 private: |
| 45 content::BrowserContext* browser_context_; | |
| 46 std::unique_ptr<content::DesktopNotificationDelegate> delegate_; | 44 std::unique_ptr<content::DesktopNotificationDelegate> delegate_; |
| 47 bool displayed_; | 45 bool displayed_; |
| 48 std::string notification_id_; | |
| 49 | 46 |
| 50 DISALLOW_COPY_AND_ASSIGN(NotificationObjectProxy); | 47 DISALLOW_COPY_AND_ASSIGN(NotificationObjectProxy); |
| 51 }; | 48 }; |
| 52 | 49 |
| 53 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_OBJECT_PROXY_H_ | 50 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_OBJECT_PROXY_H_ |
| OLD | NEW |