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