[email protected] | 6ffdb900 | 2011-11-15 00:09:24 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
[email protected] | 4bb33630 | 2009-10-12 05:44:26 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
5 | #ifndef CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_OBJECT_PROXY_H_ | ||||
6 | #define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_OBJECT_PROXY_H_ | ||||
[email protected] | 32b76ef | 2010-07-26 23:08:24 | [diff] [blame] | 7 | #pragma once |
[email protected] | 4bb33630 | 2009-10-12 05:44:26 | [diff] [blame] | 8 | |
[email protected] | 3b84575 | 2010-03-17 01:19:06 | [diff] [blame] | 9 | #include <string> |
10 | |||||
11 | #include "chrome/browser/notifications/notification_delegate.h" | ||||
[email protected] | 4bb33630 | 2009-10-12 05:44:26 | [diff] [blame] | 12 | |
[email protected] | 4bb33630 | 2009-10-12 05:44:26 | [diff] [blame] | 13 | // A NotificationObjectProxy stands in for the JavaScript Notification object |
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 | ||||
16 | // attached JS listeners will be invoked in the renderer or worker process. | ||||
[email protected] | 11f485728 | 2009-11-13 19:56:17 | [diff] [blame] | 17 | class NotificationObjectProxy |
[email protected] | 3b84575 | 2010-03-17 01:19:06 | [diff] [blame] | 18 | : public NotificationDelegate { |
[email protected] | 4bb33630 | 2009-10-12 05:44:26 | [diff] [blame] | 19 | public: |
20 | // Creates a Proxy object with the necessary callback information. | ||||
21 | NotificationObjectProxy(int process_id, int route_id, | ||||
22 | int notification_id, bool worker); | ||||
23 | |||||
[email protected] | 3b84575 | 2010-03-17 01:19:06 | [diff] [blame] | 24 | // NotificationDelegate implementation. |
[email protected] | 0d5c08e | 2011-11-21 16:51:06 | [diff] [blame] | 25 | virtual void Display() OVERRIDE; |
26 | virtual void Error() OVERRIDE; | ||||
27 | virtual void Close(bool by_user) OVERRIDE; | ||||
28 | virtual void Click() OVERRIDE; | ||||
29 | virtual std::string id() const OVERRIDE; | ||||
[email protected] | b52448bb | 2009-11-04 21:29:11 | [diff] [blame] | 30 | |
[email protected] | 8b7135d6aa | 2009-11-11 17:40:31 | [diff] [blame] | 31 | protected: |
[email protected] | 7991a23 | 2009-11-06 01:55:48 | [diff] [blame] | 32 | friend class base::RefCountedThreadSafe<NotificationObjectProxy>; |
33 | |||||
[email protected] | 8b7135d6aa | 2009-11-11 17:40:31 | [diff] [blame] | 34 | virtual ~NotificationObjectProxy() {} |
[email protected] | 7991a23 | 2009-11-06 01:55:48 | [diff] [blame] | 35 | |
[email protected] | 8b7135d6aa | 2009-11-11 17:40:31 | [diff] [blame] | 36 | private: |
[email protected] | 4bb33630 | 2009-10-12 05:44:26 | [diff] [blame] | 37 | // Callback information to find the JS Notification object where it lives. |
38 | int process_id_; | ||||
39 | int route_id_; | ||||
40 | int notification_id_; | ||||
41 | bool worker_; | ||||
42 | }; | ||||
43 | |||||
44 | #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_OBJECT_PROXY_H_ |