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 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "ui/arc/notification/arc_custom_notification_item.h" | 12 #include "ui/arc/notification/arc_notification_item.h" |
13 #include "ui/arc/notification/arc_notification_surface_manager.h" | 13 #include "ui/arc/notification/arc_notification_surface_manager.h" |
14 #include "ui/aura/window_observer.h" | 14 #include "ui/aura/window_observer.h" |
15 #include "ui/gfx/animation/animation_delegate.h" | 15 #include "ui/gfx/animation/animation_delegate.h" |
16 #include "ui/message_center/views/custom_notification_content_view_delegate.h" | 16 #include "ui/message_center/views/custom_notification_content_view_delegate.h" |
17 #include "ui/message_center/views/padded_button.h" | 17 #include "ui/message_center/views/padded_button.h" |
18 #include "ui/views/controls/button/button.h" | 18 #include "ui/views/controls/button/button.h" |
19 #include "ui/views/controls/native/native_view_host.h" | 19 #include "ui/views/controls/native/native_view_host.h" |
20 | 20 |
21 namespace exo { | 21 namespace exo { |
22 class NotificationSurface; | 22 class NotificationSurface; |
23 } | 23 } |
24 | 24 |
25 namespace gfx { | 25 namespace gfx { |
26 class LinearAnimation; | 26 class LinearAnimation; |
27 } | 27 } |
28 | 28 |
29 namespace views { | 29 namespace views { |
30 class FocusTraversable; | 30 class FocusTraversable; |
31 class Widget; | 31 class Widget; |
32 } | 32 } |
33 | 33 |
34 namespace arc { | 34 namespace arc { |
35 | 35 |
36 class ArcCustomNotificationView | 36 class ArcCustomNotificationView |
hidehiko
2017/05/01 12:29:17
(slightly off-topic): Do we want to rename this to
yoshiki
2017/05/08 06:24:52
Yes, I have a plan to refactor view things after t
| |
37 : public views::NativeViewHost, | 37 : public views::NativeViewHost, |
38 public views::ButtonListener, | 38 public views::ButtonListener, |
39 public aura::WindowObserver, | 39 public aura::WindowObserver, |
40 public ArcCustomNotificationItem::Observer, | 40 public ArcNotificationItem::Observer, |
41 public ArcNotificationSurfaceManager::Observer, | 41 public ArcNotificationSurfaceManager::Observer, |
42 public gfx::AnimationDelegate { | 42 public gfx::AnimationDelegate { |
43 public: | 43 public: |
44 explicit ArcCustomNotificationView(ArcCustomNotificationItem* item); | 44 explicit ArcCustomNotificationView(ArcNotificationItem* item); |
45 ~ArcCustomNotificationView() override; | 45 ~ArcCustomNotificationView() override; |
46 | 46 |
47 std::unique_ptr<message_center::CustomNotificationContentViewDelegate> | 47 std::unique_ptr<message_center::CustomNotificationContentViewDelegate> |
48 CreateContentViewDelegate(); | 48 CreateContentViewDelegate(); |
49 | 49 |
50 private: | 50 private: |
51 class ContentViewDelegate; | 51 class ContentViewDelegate; |
52 class EventForwarder; | 52 class EventForwarder; |
53 class SettingsButton; | 53 class SettingsButton; |
54 class SlideHelper; | 54 class SlideHelper; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
97 | 97 |
98 // views::ButtonListener | 98 // views::ButtonListener |
99 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 99 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
100 | 100 |
101 // aura::WindowObserver | 101 // aura::WindowObserver |
102 void OnWindowBoundsChanged(aura::Window* window, | 102 void OnWindowBoundsChanged(aura::Window* window, |
103 const gfx::Rect& old_bounds, | 103 const gfx::Rect& old_bounds, |
104 const gfx::Rect& new_bounds) override; | 104 const gfx::Rect& new_bounds) override; |
105 void OnWindowDestroying(aura::Window* window) override; | 105 void OnWindowDestroying(aura::Window* window) override; |
106 | 106 |
107 // ArcCustomNotificationItem::Observer | 107 // ArcNotificationItem::Observer |
108 void OnItemDestroying() override; | 108 void OnItemDestroying() override; |
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, | 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. | 120 // we have to be careful about what we do. |
121 ArcCustomNotificationItem* item_ = nullptr; | 121 ArcNotificationItem* item_ = nullptr; |
122 exo::NotificationSurface* surface_ = nullptr; | 122 exo::NotificationSurface* surface_ = nullptr; |
123 | 123 |
124 const std::string notification_key_; | 124 const std::string notification_key_; |
125 | 125 |
126 // 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. |
127 // 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 |
128 // 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 |
129 // to be handled as well. | 129 // to be handled as well. |
130 // 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. |
131 std::unique_ptr<EventForwarder> event_forwarder_; | 131 std::unique_ptr<EventForwarder> event_forwarder_; |
(...skipping 16 matching lines...) Expand all Loading... | |
148 bool in_layout_ = false; | 148 bool in_layout_ = false; |
149 | 149 |
150 std::unique_ptr<gfx::LinearAnimation> control_button_color_animation_; | 150 std::unique_ptr<gfx::LinearAnimation> control_button_color_animation_; |
151 | 151 |
152 DISALLOW_COPY_AND_ASSIGN(ArcCustomNotificationView); | 152 DISALLOW_COPY_AND_ASSIGN(ArcCustomNotificationView); |
153 }; | 153 }; |
154 | 154 |
155 } // namespace arc | 155 } // namespace arc |
156 | 156 |
157 #endif // UI_ARC_NOTIFICATION_ARC_CUSTOM_NOTIFICATION_VIEW_H_ | 157 #endif // UI_ARC_NOTIFICATION_ARC_CUSTOM_NOTIFICATION_VIEW_H_ |
OLD | NEW |