| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 UI_MESSAGE_CENTER_NOTIFICATION_DELEGATE_H_ | 5 #ifndef UI_MESSAGE_CENTER_NOTIFICATION_DELEGATE_H_ |
| 6 #define UI_MESSAGE_CENTER_NOTIFICATION_DELEGATE_H_ | 6 #define UI_MESSAGE_CENTER_NOTIFICATION_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "ui/message_center/message_center_export.h" | 12 #include "ui/message_center/message_center_export.h" |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 class RenderViewHost; | 15 class RenderViewHost; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace message_center { | 18 namespace message_center { |
| 19 | 19 |
| 20 // Delegate for a notification. This class has two roles: to implement callback | 20 // Delegate for a notification. This class has two roles: to implement callback |
| 21 // methods for notification, and to provide an identity of the associated | 21 // methods for notification, and to provide an identity of the associated |
| 22 // notification. | 22 // notification. |
| 23 class MESSAGE_CENTER_EXPORT NotificationDelegate | 23 class MESSAGE_CENTER_EXPORT NotificationDelegate |
| 24 : public base::RefCountedThreadSafe<NotificationDelegate> { | 24 : public base::RefCountedThreadSafe<NotificationDelegate> { |
| 25 public: | 25 public: |
| 26 // To be called when the desktop notification is actually shown. | 26 // To be called when the desktop notification is actually shown. |
| 27 virtual void Display(); | 27 virtual void Display(); |
| 28 | 28 |
| 29 // To be called when the desktop notification cannot be shown due to an | |
| 30 // error. | |
| 31 virtual void Error(); | |
| 32 | |
| 33 // To be called when the desktop notification is closed. If closed by a | 29 // To be called when the desktop notification is closed. If closed by a |
| 34 // user explicitly (as opposed to timeout/script), |by_user| should be true. | 30 // user explicitly (as opposed to timeout/script), |by_user| should be true. |
| 35 virtual void Close(bool by_user); | 31 virtual void Close(bool by_user); |
| 36 | 32 |
| 37 // Returns true if the delegate can handle click event. | 33 // Returns true if the delegate can handle click event. |
| 38 virtual bool HasClickedListener(); | 34 virtual bool HasClickedListener(); |
| 39 | 35 |
| 40 // To be called when a desktop notification is clicked. | 36 // To be called when a desktop notification is clicked. |
| 41 virtual void Click(); | 37 virtual void Click(); |
| 42 | 38 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 84 |
| 89 private: | 85 private: |
| 90 ButtonClickCallback button_callback_; | 86 ButtonClickCallback button_callback_; |
| 91 | 87 |
| 92 DISALLOW_COPY_AND_ASSIGN(HandleNotificationButtonClickDelegate); | 88 DISALLOW_COPY_AND_ASSIGN(HandleNotificationButtonClickDelegate); |
| 93 }; | 89 }; |
| 94 | 90 |
| 95 } // namespace message_center | 91 } // namespace message_center |
| 96 | 92 |
| 97 #endif // UI_MESSAGE_CENTER_NOTIFICATION_DELEGATE_H_ | 93 #endif // UI_MESSAGE_CENTER_NOTIFICATION_DELEGATE_H_ |
| OLD | NEW |