| 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 <memory> |
| 8 #include <string> | 9 #include <string> |
| 9 | 10 |
| 10 #include "base/callback.h" | 11 #include "base/callback.h" |
| 11 #include "base/macros.h" | 12 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 13 #include "ui/message_center/message_center_export.h" | 14 #include "ui/message_center/message_center_export.h" |
| 14 | 15 |
| 15 namespace content { | 16 namespace content { |
| 16 class RenderViewHost; | 17 class RenderViewHost; |
| 17 } | 18 } |
| 18 | 19 |
| 20 namespace views { |
| 21 class View; |
| 22 } |
| 23 |
| 19 namespace message_center { | 24 namespace message_center { |
| 20 | 25 |
| 21 // Delegate for a notification. This class has two roles: to implement callback | 26 // Delegate for a notification. This class has two roles: to implement callback |
| 22 // methods for notification, and to provide an identity of the associated | 27 // methods for notification, and to provide an identity of the associated |
| 23 // notification. | 28 // notification. |
| 24 class MESSAGE_CENTER_EXPORT NotificationDelegate | 29 class MESSAGE_CENTER_EXPORT NotificationDelegate |
| 25 : public base::RefCountedThreadSafe<NotificationDelegate> { | 30 : public base::RefCountedThreadSafe<NotificationDelegate> { |
| 26 public: | 31 public: |
| 27 // To be called when the desktop notification is actually shown. | 32 // To be called when the desktop notification is actually shown. |
| 28 virtual void Display(); | 33 virtual void Display(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 39 | 44 |
| 40 // To be called when the user clicks a button in a notification. | 45 // To be called when the user clicks a button in a notification. |
| 41 virtual void ButtonClick(int button_index); | 46 virtual void ButtonClick(int button_index); |
| 42 | 47 |
| 43 // To be called when the user clicks the settings button in a notification. | 48 // To be called when the user clicks the settings button in a notification. |
| 44 virtual void SettingsClick(); | 49 virtual void SettingsClick(); |
| 45 | 50 |
| 46 // To be called in order to detect if a settings button should be displayed. | 51 // To be called in order to detect if a settings button should be displayed. |
| 47 virtual bool ShouldDisplaySettingsButton(); | 52 virtual bool ShouldDisplaySettingsButton(); |
| 48 | 53 |
| 54 // To be called to construct the contents view of a popup for notifications |
| 55 // whose type is NOTIFICATION_TYPE_CUSTOM. |
| 56 virtual std::unique_ptr<views::View> CreateCustomContent(); |
| 57 |
| 49 protected: | 58 protected: |
| 50 virtual ~NotificationDelegate() {} | 59 virtual ~NotificationDelegate() {} |
| 51 | 60 |
| 52 private: | 61 private: |
| 53 friend class base::RefCountedThreadSafe<NotificationDelegate>; | 62 friend class base::RefCountedThreadSafe<NotificationDelegate>; |
| 54 }; | 63 }; |
| 55 | 64 |
| 56 // A simple notification delegate which invokes the passed closure when clicked. | 65 // A simple notification delegate which invokes the passed closure when clicked. |
| 57 class MESSAGE_CENTER_EXPORT HandleNotificationClickedDelegate | 66 class MESSAGE_CENTER_EXPORT HandleNotificationClickedDelegate |
| 58 : public NotificationDelegate { | 67 : public NotificationDelegate { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 100 |
| 92 private: | 101 private: |
| 93 ButtonClickCallback button_callback_; | 102 ButtonClickCallback button_callback_; |
| 94 | 103 |
| 95 DISALLOW_COPY_AND_ASSIGN(HandleNotificationButtonClickDelegate); | 104 DISALLOW_COPY_AND_ASSIGN(HandleNotificationButtonClickDelegate); |
| 96 }; | 105 }; |
| 97 | 106 |
| 98 } // namespace message_center | 107 } // namespace message_center |
| 99 | 108 |
| 100 #endif // UI_MESSAGE_CENTER_NOTIFICATION_DELEGATE_H_ | 109 #endif // UI_MESSAGE_CENTER_NOTIFICATION_DELEGATE_H_ |
| OLD | NEW |