| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_VIEWS_CUSTOM_NOTIFICATION_VIEW_H_ | 5 #ifndef UI_MESSAGE_CENTER_VIEWS_CUSTOM_NOTIFICATION_VIEW_H_ |
| 6 #define UI_MESSAGE_CENTER_VIEWS_CUSTOM_NOTIFICATION_VIEW_H_ | 6 #define UI_MESSAGE_CENTER_VIEWS_CUSTOM_NOTIFICATION_VIEW_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "ui/message_center/message_center_export.h" | 9 #include "ui/message_center/message_center_export.h" |
| 10 #include "ui/message_center/views/message_view.h" | 10 #include "ui/message_center/views/message_view.h" |
| 11 | 11 |
| 12 namespace views { | 12 namespace views { |
| 13 class Painter; | 13 class Painter; |
| 14 } | 14 } |
| 15 | 15 |
| 16 namespace message_center { | 16 namespace message_center { |
| 17 | 17 |
| 18 // View for notification with NOTIFICATION_TYPE_CUSTOM that hosts the custom | 18 // View for notification with NOTIFICATION_TYPE_CUSTOM that hosts the custom |
| 19 // content of the notification. | 19 // content of the notification. |
| 20 class MESSAGE_CENTER_EXPORT CustomNotificationView : public MessageView { | 20 class MESSAGE_CENTER_EXPORT CustomNotificationView : public MessageView { |
| 21 public: | 21 public: |
| 22 static const char kViewClassName[]; |
| 23 |
| 22 CustomNotificationView(MessageCenterController* controller, | 24 CustomNotificationView(MessageCenterController* controller, |
| 23 const Notification& notification); | 25 const Notification& notification); |
| 24 ~CustomNotificationView() override; | 26 ~CustomNotificationView() override; |
| 25 | 27 |
| 26 // These method are called by the content view when focus handling is defered | 28 // These method are called by the content view when focus handling is defered |
| 27 // to the content. | 29 // to the content. |
| 28 void OnContentFocused(); | 30 void OnContentFocused(); |
| 29 void OnContentBlured(); | 31 void OnContentBlured(); |
| 30 | 32 |
| 31 // Overidden from MessageView: | 33 // Overidden from MessageView: |
| 32 void SetDrawBackgroundAsActive(bool active) override; | 34 void SetDrawBackgroundAsActive(bool active) override; |
| 33 bool IsCloseButtonFocused() const override; | 35 bool IsCloseButtonFocused() const override; |
| 34 void RequestFocusOnCloseButton() override; | 36 void RequestFocusOnCloseButton() override; |
| 35 bool IsPinned() const override; | 37 bool IsPinned() const override; |
| 36 | 38 |
| 37 // Overridden from views::View: | 39 // Overridden from views::View: |
| 40 const char* GetClassName() const override; |
| 38 gfx::Size GetPreferredSize() const override; | 41 gfx::Size GetPreferredSize() const override; |
| 39 void Layout() override; | 42 void Layout() override; |
| 40 bool HasFocus() const override; | 43 bool HasFocus() const override; |
| 41 void RequestFocus() override; | 44 void RequestFocus() override; |
| 42 void OnPaint(gfx::Canvas* canvas) override; | 45 void OnPaint(gfx::Canvas* canvas) override; |
| 43 bool OnKeyPressed(const ui::KeyEvent& event) override; | 46 bool OnKeyPressed(const ui::KeyEvent& event) override; |
| 44 void ChildPreferredSizeChanged(View* child) override; | 47 void ChildPreferredSizeChanged(View* child) override; |
| 45 | 48 |
| 46 private: | 49 private: |
| 47 friend class CustomNotificationViewTest; | 50 friend class CustomNotificationViewTest; |
| 48 | 51 |
| 49 // The view for the custom content. Owned by view hierarchy. | 52 // The view for the custom content. Owned by view hierarchy. |
| 50 views::View* contents_view_ = nullptr; | 53 views::View* contents_view_ = nullptr; |
| 51 std::unique_ptr<CustomNotificationContentViewDelegate> | 54 std::unique_ptr<CustomNotificationContentViewDelegate> |
| 52 contents_view_delegate_; | 55 contents_view_delegate_; |
| 53 | 56 |
| 54 std::unique_ptr<views::Painter> focus_painter_; | 57 std::unique_ptr<views::Painter> focus_painter_; |
| 55 | 58 |
| 56 DISALLOW_COPY_AND_ASSIGN(CustomNotificationView); | 59 DISALLOW_COPY_AND_ASSIGN(CustomNotificationView); |
| 57 }; | 60 }; |
| 58 | 61 |
| 59 } // namespace message_center | 62 } // namespace message_center |
| 60 | 63 |
| 61 #endif // UI_MESSAGE_CENTER_VIEWS_CUSTOM_NOTIFICATION_VIEW_H_ | 64 #endif // UI_MESSAGE_CENTER_VIEWS_CUSTOM_NOTIFICATION_VIEW_H_ |
| OLD | NEW |