Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(92)

Side by Side Diff: ui/arc/notification/arc_custom_notification_view.h

Issue 2820073002: Update the background color of ARC notifications when notification settings is opened. (Closed)
Patch Set: add comments Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_custom_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/message_center/views/custom_notification_content_view_delegate.h" 16 #include "ui/message_center/views/custom_notification_content_view_delegate.h"
16 #include "ui/message_center/views/padded_button.h" 17 #include "ui/message_center/views/padded_button.h"
17 #include "ui/views/controls/button/button.h" 18 #include "ui/views/controls/button/button.h"
18 #include "ui/views/controls/native/native_view_host.h" 19 #include "ui/views/controls/native/native_view_host.h"
19 20
20 namespace exo { 21 namespace exo {
21 class NotificationSurface; 22 class NotificationSurface;
22 } 23 }
23 24
25 namespace gfx {
26 class LinearAnimation;
27 }
28
24 namespace views { 29 namespace views {
25 class FocusTraversable; 30 class FocusTraversable;
26 class Widget; 31 class Widget;
27 } 32 }
28 33
29 namespace arc { 34 namespace arc {
30 35
31 class ArcCustomNotificationView 36 class ArcCustomNotificationView
32 : public views::NativeViewHost, 37 : public views::NativeViewHost,
33 public views::ButtonListener, 38 public views::ButtonListener,
34 public aura::WindowObserver, 39 public aura::WindowObserver,
35 public ArcCustomNotificationItem::Observer, 40 public ArcCustomNotificationItem::Observer,
36 public ArcNotificationSurfaceManager::Observer { 41 public ArcNotificationSurfaceManager::Observer,
42 public gfx::AnimationDelegate {
37 public: 43 public:
38 explicit ArcCustomNotificationView(ArcCustomNotificationItem* item); 44 explicit ArcCustomNotificationView(ArcCustomNotificationItem* item);
39 ~ArcCustomNotificationView() override; 45 ~ArcCustomNotificationView() override;
40 46
41 std::unique_ptr<message_center::CustomNotificationContentViewDelegate> 47 std::unique_ptr<message_center::CustomNotificationContentViewDelegate>
42 CreateContentViewDelegate(); 48 CreateContentViewDelegate();
43 49
44 private: 50 private:
45 class ContentViewDelegate; 51 class ContentViewDelegate;
46 class EventForwarder; 52 class EventForwarder;
(...skipping 18 matching lines...) Expand all
65 void CreateCloseButton(); 71 void CreateCloseButton();
66 void CreateSettingsButton(); 72 void CreateSettingsButton();
67 void CreateFloatingControlButtons(); 73 void CreateFloatingControlButtons();
68 void SetSurface(exo::NotificationSurface* surface); 74 void SetSurface(exo::NotificationSurface* surface);
69 void UpdatePreferredSize(); 75 void UpdatePreferredSize();
70 void UpdateControlButtonsVisibility(); 76 void UpdateControlButtonsVisibility();
71 void UpdatePinnedState(); 77 void UpdatePinnedState();
72 void UpdateSnapshot(); 78 void UpdateSnapshot();
73 void AttachSurface(); 79 void AttachSurface();
74 void ActivateToast(); 80 void ActivateToast();
81 void StartControlButtonsColorAnimation();
82 bool ShouldUpdateControlButtonsColor() const;
75 83
76 // views::NativeViewHost 84 // views::NativeViewHost
77 void ViewHierarchyChanged( 85 void ViewHierarchyChanged(
78 const ViewHierarchyChangedDetails& details) override; 86 const ViewHierarchyChangedDetails& details) override;
79 void Layout() override; 87 void Layout() override;
80 void OnPaint(gfx::Canvas* canvas) override; 88 void OnPaint(gfx::Canvas* canvas) override;
81 void OnKeyEvent(ui::KeyEvent* event) override; 89 void OnKeyEvent(ui::KeyEvent* event) override;
82 void OnGestureEvent(ui::GestureEvent* event) override; 90 void OnGestureEvent(ui::GestureEvent* event) override;
83 void OnMouseEntered(const ui::MouseEvent& event) override; 91 void OnMouseEntered(const ui::MouseEvent& event) override;
84 void OnMouseExited(const ui::MouseEvent& event) override; 92 void OnMouseExited(const ui::MouseEvent& event) override;
(...skipping 12 matching lines...) Expand all
97 void OnWindowDestroying(aura::Window* window) override; 105 void OnWindowDestroying(aura::Window* window) override;
98 106
99 // ArcCustomNotificationItem::Observer 107 // ArcCustomNotificationItem::Observer
100 void OnItemDestroying() override; 108 void OnItemDestroying() override;
101 void OnItemUpdated() override; 109 void OnItemUpdated() override;
102 110
103 // ArcNotificationSurfaceManager::Observer: 111 // ArcNotificationSurfaceManager::Observer:
104 void OnNotificationSurfaceAdded(exo::NotificationSurface* surface) override; 112 void OnNotificationSurfaceAdded(exo::NotificationSurface* surface) override;
105 void OnNotificationSurfaceRemoved(exo::NotificationSurface* surface) override; 113 void OnNotificationSurfaceRemoved(exo::NotificationSurface* surface) override;
106 114
115 // AnimationDelegate
116 void AnimationEnded(const gfx::Animation* animation) override;
117 void AnimationProgressed(const gfx::Animation* animation) override;
118
107 ArcCustomNotificationItem* item_ = nullptr; 119 ArcCustomNotificationItem* item_ = nullptr;
108 exo::NotificationSurface* surface_ = nullptr; 120 exo::NotificationSurface* surface_ = nullptr;
109 121
110 const std::string notification_key_; 122 const std::string notification_key_;
111 123
112 // A pre-target event handler to forward events on the surface to this view. 124 // A pre-target event handler to forward events on the surface to this view.
113 // Using a pre-target event handler instead of a target handler on the surface 125 // Using a pre-target event handler instead of a target handler on the surface
114 // window because it has descendant aura::Window and the events on them need 126 // window because it has descendant aura::Window and the events on them need
115 // to be handled as well. 127 // to be handled as well.
116 // TODO(xiyuan): Revisit after exo::Surface no longer has an aura::Window. 128 // TODO(xiyuan): Revisit after exo::Surface no longer has an aura::Window.
117 std::unique_ptr<EventForwarder> event_forwarder_; 129 std::unique_ptr<EventForwarder> event_forwarder_;
118 130
119 // A helper to observe slide transform/animation and use surface layer copy 131 // A helper to observe slide transform/animation and use surface layer copy
120 // when a slide is in progress and restore the surface when it finishes. 132 // when a slide is in progress and restore the surface when it finishes.
121 std::unique_ptr<SlideHelper> slide_helper_; 133 std::unique_ptr<SlideHelper> slide_helper_;
122 134
123 // A control buttons on top of NotificationSurface. Needed because the 135 // A control buttons on top of NotificationSurface. Needed because the
124 // aura::Window of NotificationSurface is added after hosting widget's 136 // aura::Window of NotificationSurface is added after hosting widget's
125 // RootView thus standard notification control buttons are always below 137 // RootView thus standard notification control buttons are always below
126 // it. 138 // it.
127 std::unique_ptr<views::Widget> floating_control_buttons_widget_; 139 std::unique_ptr<views::Widget> floating_control_buttons_widget_;
128 140
129 views::View* control_buttons_view_ = nullptr; 141 views::View* control_buttons_view_ = nullptr;
130 std::unique_ptr<ControlButton> close_button_; 142 std::unique_ptr<ControlButton> close_button_;
131 ControlButton* settings_button_ = nullptr; 143 ControlButton* settings_button_ = nullptr;
132 144
133 // Protects from call loops between Layout and OnWindowBoundsChanged. 145 // Protects from call loops between Layout and OnWindowBoundsChanged.
134 bool in_layout_ = false; 146 bool in_layout_ = false;
135 147
148 std::unique_ptr<gfx::LinearAnimation> control_button_color_animation_;
149
136 DISALLOW_COPY_AND_ASSIGN(ArcCustomNotificationView); 150 DISALLOW_COPY_AND_ASSIGN(ArcCustomNotificationView);
137 }; 151 };
138 152
139 } // namespace arc 153 } // namespace arc
140 154
141 #endif // UI_ARC_NOTIFICATION_ARC_CUSTOM_NOTIFICATION_VIEW_H_ 155 #endif // UI_ARC_NOTIFICATION_ARC_CUSTOM_NOTIFICATION_VIEW_H_
OLDNEW
« no previous file with comments | « ui/arc/notification/arc_custom_notification_item.cc ('k') | ui/arc/notification/arc_custom_notification_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698