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