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