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_NOTIFICATION_CONTENT_VIEW_H_ |
6 #define UI_ARC_NOTIFICATION_ARC_CUSTOM_NOTIFICATION_VIEW_H_ | 6 #define UI_ARC_NOTIFICATION_ARC_NOTIFICATION_CONTENT_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_notification_content_view_delegate.h" | 12 #include "ui/arc/notification/arc_notification_content_view_delegate.h" |
13 #include "ui/arc/notification/arc_notification_item.h" | 13 #include "ui/arc/notification/arc_notification_item.h" |
14 #include "ui/arc/notification/arc_notification_surface_manager.h" | 14 #include "ui/arc/notification/arc_notification_surface_manager.h" |
15 #include "ui/aura/window_observer.h" | 15 #include "ui/aura/window_observer.h" |
16 #include "ui/gfx/animation/animation_delegate.h" | 16 #include "ui/gfx/animation/animation_delegate.h" |
(...skipping 13 matching lines...) Expand all Loading... | |
30 struct AXActionData; | 30 struct AXActionData; |
31 } | 31 } |
32 | 32 |
33 namespace views { | 33 namespace views { |
34 class FocusTraversable; | 34 class FocusTraversable; |
35 class Widget; | 35 class Widget; |
36 } | 36 } |
37 | 37 |
38 namespace arc { | 38 namespace arc { |
39 | 39 |
40 // ArcCustomNotificationView is a view to host NotificationSurface and show the | 40 // ArcNotificationContentView is a view to host NotificationSurface and show the |
41 // content in itself. This is implemented as a child of ArcNotificationView. | 41 // content in itself. This is implemented as a child of ArcNotificationView. |
42 // TODO(yoshiki): Rename this class to ArcNotificationContentsView. | 42 // TODO(yoshiki): Rename this class to ArcNotificationContentsView. |
hidehiko
2017/05/31 03:48:38
nit: please remove TODO.
yoshiki
2017/05/31 09:18:29
Good catch. Done.
| |
43 class ArcCustomNotificationView | 43 class ArcNotificationContentView |
44 : public views::NativeViewHost, | 44 : public views::NativeViewHost, |
45 public views::ButtonListener, | 45 public views::ButtonListener, |
46 public aura::WindowObserver, | 46 public aura::WindowObserver, |
47 public ArcNotificationItem::Observer, | 47 public ArcNotificationItem::Observer, |
48 public ArcNotificationSurfaceManager::Observer, | 48 public ArcNotificationSurfaceManager::Observer, |
49 public gfx::AnimationDelegate { | 49 public gfx::AnimationDelegate { |
50 public: | 50 public: |
51 explicit ArcCustomNotificationView(ArcNotificationItem* item); | 51 explicit ArcNotificationContentView(ArcNotificationItem* item); |
52 ~ArcCustomNotificationView() override; | 52 ~ArcNotificationContentView() override; |
53 | 53 |
54 std::unique_ptr<ArcNotificationContentViewDelegate> | 54 std::unique_ptr<ArcNotificationContentViewDelegate> |
55 CreateContentViewDelegate(); | 55 CreateContentViewDelegate(); |
56 | 56 |
57 private: | 57 private: |
58 class ContentViewDelegate; | 58 class ContentViewDelegate; |
59 class EventForwarder; | 59 class EventForwarder; |
60 class SettingsButton; | 60 class SettingsButton; |
61 class SlideHelper; | 61 class SlideHelper; |
62 | 62 |
63 // A image button class used for the settings button and the close button. | 63 // A image button class used for the settings button and the close button. |
64 // We can't use forward declaration for this class due to std::unique_ptr<> | 64 // We can't use forward declaration for this class due to std::unique_ptr<> |
65 // requires size of this class. | 65 // requires size of this class. |
66 class ControlButton : public message_center::PaddedButton { | 66 class ControlButton : public message_center::PaddedButton { |
67 public: | 67 public: |
68 explicit ControlButton(ArcCustomNotificationView* owner); | 68 explicit ControlButton(ArcNotificationContentView* owner); |
69 void OnFocus() override; | 69 void OnFocus() override; |
70 void OnBlur() override; | 70 void OnBlur() override; |
71 | 71 |
72 private: | 72 private: |
73 ArcCustomNotificationView* const owner_; | 73 ArcNotificationContentView* const owner_; |
74 | 74 |
75 DISALLOW_COPY_AND_ASSIGN(ControlButton); | 75 DISALLOW_COPY_AND_ASSIGN(ControlButton); |
76 }; | 76 }; |
77 | 77 |
78 void CreateCloseButton(); | 78 void CreateCloseButton(); |
79 void CreateSettingsButton(); | 79 void CreateSettingsButton(); |
80 void MaybeCreateFloatingControlButtons(); | 80 void MaybeCreateFloatingControlButtons(); |
81 void SetSurface(exo::NotificationSurface* surface); | 81 void SetSurface(exo::NotificationSurface* surface); |
82 void UpdatePreferredSize(); | 82 void UpdatePreferredSize(); |
83 void UpdateControlButtonsVisibility(); | 83 void UpdateControlButtonsVisibility(); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
147 | 147 |
148 views::View* control_buttons_view_ = nullptr; | 148 views::View* control_buttons_view_ = nullptr; |
149 std::unique_ptr<ControlButton> close_button_; | 149 std::unique_ptr<ControlButton> close_button_; |
150 ControlButton* settings_button_ = nullptr; | 150 ControlButton* settings_button_ = nullptr; |
151 | 151 |
152 // Protects from call loops between Layout and OnWindowBoundsChanged. | 152 // Protects from call loops between Layout and OnWindowBoundsChanged. |
153 bool in_layout_ = false; | 153 bool in_layout_ = false; |
154 | 154 |
155 std::unique_ptr<gfx::LinearAnimation> control_button_color_animation_; | 155 std::unique_ptr<gfx::LinearAnimation> control_button_color_animation_; |
156 | 156 |
157 DISALLOW_COPY_AND_ASSIGN(ArcCustomNotificationView); | 157 DISALLOW_COPY_AND_ASSIGN(ArcNotificationContentView); |
158 }; | 158 }; |
159 | 159 |
160 } // namespace arc | 160 } // namespace arc |
161 | 161 |
162 #endif // UI_ARC_NOTIFICATION_ARC_CUSTOM_NOTIFICATION_VIEW_H_ | 162 #endif // UI_ARC_NOTIFICATION_ARC_NOTIFICATION_CONTENT_VIEW_H_ |
OLD | NEW |