| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_ARC_NOTIFICATION_ARC_CUSTOM_DELEGATE_H_ | 5 #ifndef UI_ARC_NOTIFICATION_ARC_CUSTOM_DELEGATE_H_ |
| 6 #define UI_ARC_NOTIFICATION_ARC_CUSTOM_DELEGATE_H_ | 6 #define UI_ARC_NOTIFICATION_ARC_CUSTOM_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "ui/message_center/notification_delegate.h" | 10 #include "ui/message_center/notification_delegate.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 class ArcNotificationDelegate : public message_center::NotificationDelegate { | 25 class ArcNotificationDelegate : public message_center::NotificationDelegate { |
| 26 public: | 26 public: |
| 27 explicit ArcNotificationDelegate(base::WeakPtr<ArcNotificationItem> item); | 27 explicit ArcNotificationDelegate(base::WeakPtr<ArcNotificationItem> item); |
| 28 | 28 |
| 29 // message_center::NotificationDelegate overrides: | 29 // message_center::NotificationDelegate overrides: |
| 30 std::unique_ptr<message_center::MessageView> CreateCustomMessageView( | 30 std::unique_ptr<message_center::MessageView> CreateCustomMessageView( |
| 31 message_center::MessageCenterController* controller, | 31 message_center::MessageCenterController* controller, |
| 32 const message_center::Notification& notification) override; | 32 const message_center::Notification& notification) override; |
| 33 void Close(bool by_user) override; | 33 void Close(bool by_user) override; |
| 34 void Click() override; | 34 void Click() override; |
| 35 bool SettingsClick() override; |
| 35 | 36 |
| 36 private: | 37 private: |
| 37 // The destructor is private since this class is ref-counted. | 38 // The destructor is private since this class is ref-counted. |
| 38 ~ArcNotificationDelegate() override; | 39 ~ArcNotificationDelegate() override; |
| 39 | 40 |
| 40 // We use weak ptr to detect potential use-after-free. The lives of objects | 41 // We use weak ptr to detect potential use-after-free. The lives of objects |
| 41 // around ARC notification is somewhat complex so we want to use it until | 42 // around ARC notification is somewhat complex so we want to use it until |
| 42 // it gets stable. | 43 // it gets stable. |
| 43 base::WeakPtr<ArcNotificationItem> item_; | 44 base::WeakPtr<ArcNotificationItem> item_; |
| 44 | 45 |
| 45 DISALLOW_COPY_AND_ASSIGN(ArcNotificationDelegate); | 46 DISALLOW_COPY_AND_ASSIGN(ArcNotificationDelegate); |
| 46 }; | 47 }; |
| 47 | 48 |
| 48 } // namespace arc | 49 } // namespace arc |
| 49 | 50 |
| 50 #endif // UI_ARC_NOTIFICATION_ARC_CUSTOM_DELEGATE_H_ | 51 #endif // UI_ARC_NOTIFICATION_ARC_CUSTOM_DELEGATE_H_ |
| OLD | NEW |