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 class ArcNotificationContentView |
43 class ArcCustomNotificationView | |
44 : public views::NativeViewHost, | 43 : public views::NativeViewHost, |
45 public views::ButtonListener, | 44 public views::ButtonListener, |
46 public aura::WindowObserver, | 45 public aura::WindowObserver, |
47 public ArcNotificationItem::Observer, | 46 public ArcNotificationItem::Observer, |
48 public ArcNotificationSurfaceManager::Observer, | 47 public ArcNotificationSurfaceManager::Observer, |
49 public gfx::AnimationDelegate { | 48 public gfx::AnimationDelegate { |
50 public: | 49 public: |
51 explicit ArcCustomNotificationView(ArcNotificationItem* item); | 50 explicit ArcNotificationContentView(ArcNotificationItem* item); |
52 ~ArcCustomNotificationView() override; | 51 ~ArcNotificationContentView() override; |
53 | 52 |
54 std::unique_ptr<ArcNotificationContentViewDelegate> | 53 std::unique_ptr<ArcNotificationContentViewDelegate> |
55 CreateContentViewDelegate(); | 54 CreateContentViewDelegate(); |
56 | 55 |
57 private: | 56 private: |
58 class ContentViewDelegate; | 57 class ContentViewDelegate; |
59 class EventForwarder; | 58 class EventForwarder; |
60 class SettingsButton; | 59 class SettingsButton; |
61 class SlideHelper; | 60 class SlideHelper; |
62 | 61 |
63 // A image button class used for the settings button and the close button. | 62 // 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<> | 63 // We can't use forward declaration for this class due to std::unique_ptr<> |
65 // requires size of this class. | 64 // requires size of this class. |
66 class ControlButton : public message_center::PaddedButton { | 65 class ControlButton : public message_center::PaddedButton { |
67 public: | 66 public: |
68 explicit ControlButton(ArcCustomNotificationView* owner); | 67 explicit ControlButton(ArcNotificationContentView* owner); |
69 void OnFocus() override; | 68 void OnFocus() override; |
70 void OnBlur() override; | 69 void OnBlur() override; |
71 | 70 |
72 private: | 71 private: |
73 ArcCustomNotificationView* const owner_; | 72 ArcNotificationContentView* const owner_; |
74 | 73 |
75 DISALLOW_COPY_AND_ASSIGN(ControlButton); | 74 DISALLOW_COPY_AND_ASSIGN(ControlButton); |
76 }; | 75 }; |
77 | 76 |
78 void CreateCloseButton(); | 77 void CreateCloseButton(); |
79 void CreateSettingsButton(); | 78 void CreateSettingsButton(); |
80 void MaybeCreateFloatingControlButtons(); | 79 void MaybeCreateFloatingControlButtons(); |
81 void SetSurface(exo::NotificationSurface* surface); | 80 void SetSurface(exo::NotificationSurface* surface); |
82 void UpdatePreferredSize(); | 81 void UpdatePreferredSize(); |
83 void UpdateControlButtonsVisibility(); | 82 void UpdateControlButtonsVisibility(); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 std::unique_ptr<ControlButton> close_button_; | 150 std::unique_ptr<ControlButton> close_button_; |
152 ControlButton* settings_button_ = nullptr; | 151 ControlButton* settings_button_ = nullptr; |
153 | 152 |
154 // Protects from call loops between Layout and OnWindowBoundsChanged. | 153 // Protects from call loops between Layout and OnWindowBoundsChanged. |
155 bool in_layout_ = false; | 154 bool in_layout_ = false; |
156 | 155 |
157 std::unique_ptr<gfx::LinearAnimation> control_button_color_animation_; | 156 std::unique_ptr<gfx::LinearAnimation> control_button_color_animation_; |
158 | 157 |
159 base::string16 accessible_name_; | 158 base::string16 accessible_name_; |
160 | 159 |
161 DISALLOW_COPY_AND_ASSIGN(ArcCustomNotificationView); | 160 DISALLOW_COPY_AND_ASSIGN(ArcNotificationContentView); |
162 }; | 161 }; |
163 | 162 |
164 } // namespace arc | 163 } // namespace arc |
165 | 164 |
166 #endif // UI_ARC_NOTIFICATION_ARC_CUSTOM_NOTIFICATION_VIEW_H_ | 165 #endif // UI_ARC_NOTIFICATION_ARC_NOTIFICATION_CONTENT_VIEW_H_ |
OLD | NEW |