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_ARC_NOTIFICATION_ARC_CUSTOM_NOTIFICATION_VIEW_H_ | 5 #ifndef UI_ARC_NOTIFICATION_ARC_CUSTOM_NOTIFICATION_VIEW_H_ |
6 #define UI_ARC_NOTIFICATION_ARC_CUSTOM_NOTIFICATION_VIEW_H_ | 6 #define UI_ARC_NOTIFICATION_ARC_CUSTOM_NOTIFICATION_VIEW_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 public ArcNotificationSurfaceManager::Observer { | 36 public ArcNotificationSurfaceManager::Observer { |
37 public: | 37 public: |
38 explicit ArcCustomNotificationView(ArcCustomNotificationItem* item); | 38 explicit ArcCustomNotificationView(ArcCustomNotificationItem* item); |
39 ~ArcCustomNotificationView() override; | 39 ~ArcCustomNotificationView() override; |
40 | 40 |
41 std::unique_ptr<message_center::CustomNotificationContentViewDelegate> | 41 std::unique_ptr<message_center::CustomNotificationContentViewDelegate> |
42 CreateContentViewDelegate(); | 42 CreateContentViewDelegate(); |
43 | 43 |
44 private: | 44 private: |
45 class ContentViewDelegate; | 45 class ContentViewDelegate; |
46 class CloseButton; | 46 class ControlButton; |
47 class EventForwarder; | 47 class EventForwarder; |
| 48 class SettingsButton; |
48 class SlideHelper; | 49 class SlideHelper; |
49 | 50 |
50 void CreateFloatingCloseButton(); | 51 void CreateFloatingControlButtons(); |
51 void SetSurface(exo::NotificationSurface* surface); | 52 void SetSurface(exo::NotificationSurface* surface); |
52 void UpdatePreferredSize(); | 53 void UpdatePreferredSize(); |
53 void UpdateCloseButtonVisiblity(); | 54 void UpdateControlButtonsVisiblity(); |
54 void UpdatePinnedState(); | 55 void UpdatePinnedState(); |
55 void UpdateSnapshot(); | 56 void UpdateSnapshot(); |
56 void AttachSurface(); | 57 void AttachSurface(); |
57 | 58 |
58 // views::NativeViewHost | 59 // views::NativeViewHost |
59 void ViewHierarchyChanged( | 60 void ViewHierarchyChanged( |
60 const ViewHierarchyChangedDetails& details) override; | 61 const ViewHierarchyChangedDetails& details) override; |
61 void Layout() override; | 62 void Layout() override; |
62 void OnPaint(gfx::Canvas* canvas) override; | 63 void OnPaint(gfx::Canvas* canvas) override; |
63 void OnKeyEvent(ui::KeyEvent* event) override; | 64 void OnKeyEvent(ui::KeyEvent* event) override; |
(...skipping 30 matching lines...) Expand all Loading... |
94 // Using a pre-target event handler instead of a target handler on the surface | 95 // Using a pre-target event handler instead of a target handler on the surface |
95 // window because it has descendant aura::Window and the events on them need | 96 // window because it has descendant aura::Window and the events on them need |
96 // to be handled as well. | 97 // to be handled as well. |
97 // TODO(xiyuan): Revisit after exo::Surface no longer has an aura::Window. | 98 // TODO(xiyuan): Revisit after exo::Surface no longer has an aura::Window. |
98 std::unique_ptr<EventForwarder> event_forwarder_; | 99 std::unique_ptr<EventForwarder> event_forwarder_; |
99 | 100 |
100 // A helper to observe slide transform/animation and use surface layer copy | 101 // A helper to observe slide transform/animation and use surface layer copy |
101 // when a slide is in progress and restore the surface when it finishes. | 102 // when a slide is in progress and restore the surface when it finishes. |
102 std::unique_ptr<SlideHelper> slide_helper_; | 103 std::unique_ptr<SlideHelper> slide_helper_; |
103 | 104 |
104 // A close button on top of NotificationSurface. Needed because the | 105 // A control buttons on top of NotificationSurface. Needed because the |
105 // aura::Window of NotificationSurface is added after hosting widget's | 106 // aura::Window of NotificationSurface is added after hosting widget's |
106 // RootView thus standard notification close button is always below | 107 // RootView thus standard notification control buttons are always below |
107 // it. | 108 // it. |
108 std::unique_ptr<views::Widget> floating_close_button_widget_; | 109 std::unique_ptr<views::Widget> floating_control_buttons_widget_; |
109 | 110 |
110 views::ImageButton* floating_close_button_ = nullptr; | 111 views::View* control_buttons_view_ = nullptr; |
| 112 views::ImageButton* close_button_ = nullptr; |
| 113 views::ImageButton* settings_button_ = nullptr; |
111 | 114 |
112 // Protects from call loops between Layout and OnWindowBoundsChanged. | 115 // Protects from call loops between Layout and OnWindowBoundsChanged. |
113 bool in_layout_ = false; | 116 bool in_layout_ = false; |
114 | 117 |
115 DISALLOW_COPY_AND_ASSIGN(ArcCustomNotificationView); | 118 DISALLOW_COPY_AND_ASSIGN(ArcCustomNotificationView); |
116 }; | 119 }; |
117 | 120 |
118 } // namespace arc | 121 } // namespace arc |
119 | 122 |
120 #endif // UI_ARC_NOTIFICATION_ARC_CUSTOM_NOTIFICATION_VIEW_H_ | 123 #endif // UI_ARC_NOTIFICATION_ARC_CUSTOM_NOTIFICATION_VIEW_H_ |
OLD | NEW |