| 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 void UpdateControlButtonsVisibility() override; | 38 void UpdateControlButtonsVisibility() override; |
| 37 | 39 |
| 38 // Overridden from views::View: | 40 // Overridden from views::View: |
| 41 const char* GetClassName() const override; |
| 39 gfx::Size GetPreferredSize() const override; | 42 gfx::Size GetPreferredSize() const override; |
| 40 void Layout() override; | 43 void Layout() override; |
| 41 bool HasFocus() const override; | 44 bool HasFocus() const override; |
| 42 void RequestFocus() override; | 45 void RequestFocus() override; |
| 43 void OnPaint(gfx::Canvas* canvas) override; | 46 void OnPaint(gfx::Canvas* canvas) override; |
| 44 bool OnKeyPressed(const ui::KeyEvent& event) override; | 47 bool OnKeyPressed(const ui::KeyEvent& event) override; |
| 45 void ChildPreferredSizeChanged(View* child) override; | 48 void ChildPreferredSizeChanged(View* child) override; |
| 46 | 49 |
| 47 private: | 50 private: |
| 48 friend class CustomNotificationViewTest; | 51 friend class CustomNotificationViewTest; |
| 49 | 52 |
| 50 // The view for the custom content. Owned by view hierarchy. | 53 // The view for the custom content. Owned by view hierarchy. |
| 51 views::View* contents_view_ = nullptr; | 54 views::View* contents_view_ = nullptr; |
| 52 std::unique_ptr<CustomNotificationContentViewDelegate> | 55 std::unique_ptr<CustomNotificationContentViewDelegate> |
| 53 contents_view_delegate_; | 56 contents_view_delegate_; |
| 54 | 57 |
| 55 std::unique_ptr<views::Painter> focus_painter_; | 58 std::unique_ptr<views::Painter> focus_painter_; |
| 56 | 59 |
| 57 DISALLOW_COPY_AND_ASSIGN(CustomNotificationView); | 60 DISALLOW_COPY_AND_ASSIGN(CustomNotificationView); |
| 58 }; | 61 }; |
| 59 | 62 |
| 60 } // namespace message_center | 63 } // namespace message_center |
| 61 | 64 |
| 62 #endif // UI_MESSAGE_CENTER_VIEWS_CUSTOM_NOTIFICATION_VIEW_H_ | 65 #endif // UI_MESSAGE_CENTER_VIEWS_CUSTOM_NOTIFICATION_VIEW_H_ |
| OLD | NEW |