| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "base/ref_counted.h" | 8 #include "base/ref_counted.h" |
| 9 | 9 |
| 10 class MessageLoop; | 10 class MessageLoop; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 int notification_id, bool worker); | 24 int notification_id, bool worker); |
| 25 | 25 |
| 26 // To be called when the desktop notification is actually shown. | 26 // To be called when the desktop notification is actually shown. |
| 27 void Display(); | 27 void Display(); |
| 28 | 28 |
| 29 // To be called when the desktop notification cannot be shown due to an | 29 // To be called when the desktop notification cannot be shown due to an |
| 30 // error. | 30 // error. |
| 31 void Error(); | 31 void Error(); |
| 32 | 32 |
| 33 // To be called when the desktop notification is closed. If closed by a | 33 // To be called when the desktop notification is closed. If closed by a |
| 34 // user explicitly (as opposed to timeout), |by_user| should be true. | 34 // user explicitly (as opposed to timeout/script), |by_user| should be true. q |
| 35 void Close(bool by_user); | 35 void Close(bool by_user); |
| 36 | 36 |
| 37 // Compares two proxies by ids to decide if they are equal. |
| 38 bool IsSame(const NotificationObjectProxy& other) const { |
| 39 return (notification_id_ == other.notification_id_ && |
| 40 route_id_ == other.route_id_ && |
| 41 process_id_ == other.process_id_ && |
| 42 worker_ == other.worker_); |
| 43 } |
| 44 |
| 37 private: | 45 private: |
| 38 // Called on UI thread to schedule a message for sending. | 46 // Called on UI thread to schedule a message for sending. |
| 39 void DeliverMessage(IPC::Message* message); | 47 void DeliverMessage(IPC::Message* message); |
| 40 | 48 |
| 41 // Called via Task on IO thread to actually send a message to a notification. | 49 // Called via Task on IO thread to actually send a message to a notification. |
| 42 void Send(IPC::Message* message); | 50 void Send(IPC::Message* message); |
| 43 | 51 |
| 44 // Callback information to find the JS Notification object where it lives. | 52 // Callback information to find the JS Notification object where it lives. |
| 45 int process_id_; | 53 int process_id_; |
| 46 int route_id_; | 54 int route_id_; |
| 47 int notification_id_; | 55 int notification_id_; |
| 48 bool worker_; | 56 bool worker_; |
| 49 }; | 57 }; |
| 50 | 58 |
| 51 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_OBJECT_PROXY_H_ | 59 #endif // CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_OBJECT_PROXY_H_ |
| OLD | NEW |