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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 void OnBlur() override; | 63 void OnBlur() override; |
64 | 64 |
65 private: | 65 private: |
66 ArcCustomNotificationView* const owner_; | 66 ArcCustomNotificationView* const owner_; |
67 | 67 |
68 DISALLOW_COPY_AND_ASSIGN(ControlButton); | 68 DISALLOW_COPY_AND_ASSIGN(ControlButton); |
69 }; | 69 }; |
70 | 70 |
71 void CreateCloseButton(); | 71 void CreateCloseButton(); |
72 void CreateSettingsButton(); | 72 void CreateSettingsButton(); |
73 void CreateFloatingControlButtons(); | 73 void MaybeCreateFloatingControlButtons(); |
74 void SetSurface(exo::NotificationSurface* surface); | 74 void SetSurface(exo::NotificationSurface* surface); |
75 void UpdatePreferredSize(); | 75 void UpdatePreferredSize(); |
76 void UpdateControlButtonsVisibility(); | 76 void UpdateControlButtonsVisibility(); |
77 void UpdatePinnedState(); | 77 void UpdatePinnedState(); |
78 void UpdateSnapshot(); | 78 void UpdateSnapshot(); |
79 void AttachSurface(); | 79 void AttachSurface(); |
80 void ActivateToast(); | 80 void ActivateToast(); |
81 void StartControlButtonsColorAnimation(); | 81 void StartControlButtonsColorAnimation(); |
82 bool ShouldUpdateControlButtonsColor() const; | 82 bool ShouldUpdateControlButtonsColor() const; |
83 | 83 |
(...skipping 25 matching lines...) Expand all Loading... |
109 void OnItemUpdated() override; | 109 void OnItemUpdated() override; |
110 | 110 |
111 // ArcNotificationSurfaceManager::Observer: | 111 // ArcNotificationSurfaceManager::Observer: |
112 void OnNotificationSurfaceAdded(exo::NotificationSurface* surface) override; | 112 void OnNotificationSurfaceAdded(exo::NotificationSurface* surface) override; |
113 void OnNotificationSurfaceRemoved(exo::NotificationSurface* surface) override; | 113 void OnNotificationSurfaceRemoved(exo::NotificationSurface* surface) override; |
114 | 114 |
115 // AnimationDelegate | 115 // AnimationDelegate |
116 void AnimationEnded(const gfx::Animation* animation) override; | 116 void AnimationEnded(const gfx::Animation* animation) override; |
117 void AnimationProgressed(const gfx::Animation* animation) override; | 117 void AnimationProgressed(const gfx::Animation* animation) override; |
118 | 118 |
| 119 // If |item_| is null, we may be about to be destroyed. In this case, |
| 120 // we have to be careful about what we do. |
119 ArcCustomNotificationItem* item_ = nullptr; | 121 ArcCustomNotificationItem* item_ = nullptr; |
120 exo::NotificationSurface* surface_ = nullptr; | 122 exo::NotificationSurface* surface_ = nullptr; |
121 | 123 |
122 const std::string notification_key_; | 124 const std::string notification_key_; |
123 | 125 |
124 // A pre-target event handler to forward events on the surface to this view. | 126 // A pre-target event handler to forward events on the surface to this view. |
125 // Using a pre-target event handler instead of a target handler on the surface | 127 // Using a pre-target event handler instead of a target handler on the surface |
126 // window because it has descendant aura::Window and the events on them need | 128 // window because it has descendant aura::Window and the events on them need |
127 // to be handled as well. | 129 // to be handled as well. |
128 // TODO(xiyuan): Revisit after exo::Surface no longer has an aura::Window. | 130 // TODO(xiyuan): Revisit after exo::Surface no longer has an aura::Window. |
(...skipping 17 matching lines...) Expand all Loading... |
146 bool in_layout_ = false; | 148 bool in_layout_ = false; |
147 | 149 |
148 std::unique_ptr<gfx::LinearAnimation> control_button_color_animation_; | 150 std::unique_ptr<gfx::LinearAnimation> control_button_color_animation_; |
149 | 151 |
150 DISALLOW_COPY_AND_ASSIGN(ArcCustomNotificationView); | 152 DISALLOW_COPY_AND_ASSIGN(ArcCustomNotificationView); |
151 }; | 153 }; |
152 | 154 |
153 } // namespace arc | 155 } // namespace arc |
154 | 156 |
155 #endif // UI_ARC_NOTIFICATION_ARC_CUSTOM_NOTIFICATION_VIEW_H_ | 157 #endif // UI_ARC_NOTIFICATION_ARC_CUSTOM_NOTIFICATION_VIEW_H_ |
OLD | NEW |