Chromium Code Reviews| 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 { |
| 16 | |
| 17 class ArcNotificationContentViewDelegate; | |
| 21 | 18 |
| 22 // View for notification with NOTIFICATION_TYPE_CUSTOM that hosts the custom | 19 // View for notification with NOTIFICATION_TYPE_CUSTOM that hosts the custom |
| 23 // content of the notification. | 20 // content of the notification. |
| 24 class MESSAGE_CENTER_EXPORT CustomNotificationView : public MessageView { | 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 ArcNotificationView( |
|
hidehiko
2017/05/11 14:22:47
Could you document the args? Specifically, |view|
yoshiki
2017/05/12 08:42:37
Done.
| |
| 29 const Notification& notification); | 26 std::unique_ptr<views::View> view, |
| 30 ~CustomNotificationView() override; | 27 std::unique_ptr<ArcNotificationContentViewDelegate> delegate, |
| 28 message_center::MessageCenterController* controller, | |
| 29 const message_center::Notification& notification); | |
| 30 ~ArcNotificationView() override; | |
| 31 | 31 |
| 32 // These method are called by the content view when focus handling is defered | 32 // These method are called by the content view when focus handling is defered |
| 33 // to the content. | 33 // to the content. |
| 34 void OnContentFocused(); | 34 void OnContentFocused(); |
| 35 void OnContentBlured(); | 35 void OnContentBlured(); |
| 36 | 36 |
| 37 // Overidden from MessageView: | 37 // Overidden from MessageView: |
| 38 void SetDrawBackgroundAsActive(bool active) override; | 38 void SetDrawBackgroundAsActive(bool active) override; |
| 39 bool IsCloseButtonFocused() const override; | 39 bool IsCloseButtonFocused() const override; |
| 40 void RequestFocusOnCloseButton() override; | 40 void RequestFocusOnCloseButton() override; |
| 41 void UpdateControlButtonsVisibility() override; | 41 void UpdateControlButtonsVisibility() override; |
| 42 | 42 |
| 43 // Overridden from views::View: | 43 // Overridden from views::View: |
| 44 const char* GetClassName() const override; | 44 const char* GetClassName() const override; |
| 45 gfx::Size GetPreferredSize() const override; | 45 gfx::Size GetPreferredSize() const override; |
| 46 void Layout() override; | 46 void Layout() override; |
| 47 bool HasFocus() const override; | 47 bool HasFocus() const override; |
| 48 void RequestFocus() override; | 48 void RequestFocus() override; |
| 49 void OnPaint(gfx::Canvas* canvas) override; | 49 void OnPaint(gfx::Canvas* canvas) override; |
| 50 bool OnKeyPressed(const ui::KeyEvent& event) override; | 50 bool OnKeyPressed(const ui::KeyEvent& event) override; |
| 51 void ChildPreferredSizeChanged(View* child) override; | 51 void ChildPreferredSizeChanged(View* child) override; |
| 52 bool HandleAccessibleAction(const ui::AXActionData& action) override; | 52 bool HandleAccessibleAction(const ui::AXActionData& action) override; |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 friend class CustomNotificationViewTest; | 55 friend class ArcNotificationViewTest; |
| 56 | 56 |
| 57 // The view for the custom content. Owned by view hierarchy. | 57 // The view for the custom content. Owned by view hierarchy. |
| 58 views::View* contents_view_ = nullptr; | 58 views::View* contents_view_ = nullptr; |
| 59 std::unique_ptr<CustomNotificationContentViewDelegate> | 59 std::unique_ptr<ArcNotificationContentViewDelegate> contents_view_delegate_; |
| 60 contents_view_delegate_; | |
| 61 | 60 |
| 62 std::unique_ptr<views::Painter> focus_painter_; | 61 std::unique_ptr<views::Painter> focus_painter_; |
| 63 | 62 |
| 64 DISALLOW_COPY_AND_ASSIGN(CustomNotificationView); | 63 DISALLOW_COPY_AND_ASSIGN(ArcNotificationView); |
| 65 }; | 64 }; |
| 66 | 65 |
| 67 } // namespace message_center | 66 } // namespace arc |
| 68 | 67 |
| 69 #endif // UI_MESSAGE_CENTER_VIEWS_CUSTOM_NOTIFICATION_VIEW_H_ | 68 #endif // UI_ARC_NOTIFICATION_ARC_NOTIFICATION_VIEW_H_ |
| OLD | NEW |