OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "chrome/browser/notifications/notification_delegate.h" | 11 #include "chrome/browser/notifications/notification_delegate.h" |
12 | 12 |
13 // A NotificationObjectProxy stands in for the JavaScript Notification object | 13 // A NotificationObjectProxy stands in for the JavaScript Notification object |
14 // which corresponds to a notification toast on the desktop. It can be signaled | 14 // which corresponds to a notification toast on the desktop. It can be signaled |
15 // when various events occur regarding the desktop notification, and the | 15 // when various events occur regarding the desktop notification, and the |
16 // attached JS listeners will be invoked in the renderer or worker process. | 16 // attached JS listeners will be invoked in the renderer or worker process. |
17 class NotificationObjectProxy | 17 class NotificationObjectProxy |
18 : public NotificationDelegate { | 18 : public NotificationDelegate { |
19 public: | 19 public: |
20 // Creates a Proxy object with the necessary callback information. | 20 // Creates a Proxy object with the necessary callback information. |
21 NotificationObjectProxy(int process_id, int route_id, | 21 NotificationObjectProxy(int process_id, int route_id, |
22 int notification_id, bool worker); | 22 int notification_id, bool worker); |
23 | 23 |
24 // NotificationDelegate implementation. | 24 // NotificationDelegate implementation. |
25 virtual void Display(); | 25 virtual void Display() OVERRIDE; |
26 virtual void Error(); | 26 virtual void Error() OVERRIDE; |
27 virtual void Close(bool by_user); | 27 virtual void Close(bool by_user) OVERRIDE; |
28 virtual void Click(); | 28 virtual void Click() OVERRIDE; |
29 virtual std::string id() const; | 29 virtual std::string id() const OVERRIDE; |
30 | 30 |
31 protected: | 31 protected: |
32 friend class base::RefCountedThreadSafe<NotificationObjectProxy>; | 32 friend class base::RefCountedThreadSafe<NotificationObjectProxy>; |
33 | 33 |
34 virtual ~NotificationObjectProxy() {} | 34 virtual ~NotificationObjectProxy() {} |
35 | 35 |
36 private: | 36 private: |
37 // Callback information to find the JS Notification object where it lives. | 37 // Callback information to find the JS Notification object where it lives. |
38 int process_id_; | 38 int process_id_; |
39 int route_id_; | 39 int route_id_; |
40 int notification_id_; | 40 int notification_id_; |
41 bool worker_; | 41 bool worker_; |
42 }; | 42 }; |
43 | 43 |
44 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_OBJECT_PROXY_H_ | 44 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_OBJECT_PROXY_H_ |
OLD | NEW |