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

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

Issue 2845003002: Merge ArcNotificationItem and ArcCustomNotificationItem (Closed)
Patch Set: Addressed comments (#56) Created 3 years, 7 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_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;
(...skipping 11 matching lines...) Expand all
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 class ArcCustomNotificationView 40 class ArcCustomNotificationView
41 : public views::NativeViewHost, 41 : public views::NativeViewHost,
42 public views::ButtonListener, 42 public views::ButtonListener,
43 public aura::WindowObserver, 43 public aura::WindowObserver,
44 public ArcCustomNotificationItem::Observer, 44 public ArcNotificationItem::Observer,
45 public ArcNotificationSurfaceManager::Observer, 45 public ArcNotificationSurfaceManager::Observer,
46 public gfx::AnimationDelegate { 46 public gfx::AnimationDelegate {
47 public: 47 public:
48 explicit ArcCustomNotificationView(ArcCustomNotificationItem* item); 48 explicit ArcCustomNotificationView(ArcNotificationItem* item);
49 ~ArcCustomNotificationView() override; 49 ~ArcCustomNotificationView() override;
50 50
51 std::unique_ptr<message_center::CustomNotificationContentViewDelegate> 51 std::unique_ptr<message_center::CustomNotificationContentViewDelegate>
52 CreateContentViewDelegate(); 52 CreateContentViewDelegate();
53 53
54 private: 54 private:
55 class ContentViewDelegate; 55 class ContentViewDelegate;
56 class EventForwarder; 56 class EventForwarder;
57 class SettingsButton; 57 class SettingsButton;
58 class SlideHelper; 58 class SlideHelper;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 101
102 // views::ButtonListener 102 // views::ButtonListener
103 void ButtonPressed(views::Button* sender, const ui::Event& event) override; 103 void ButtonPressed(views::Button* sender, const ui::Event& event) override;
104 104
105 // aura::WindowObserver 105 // aura::WindowObserver
106 void OnWindowBoundsChanged(aura::Window* window, 106 void OnWindowBoundsChanged(aura::Window* window,
107 const gfx::Rect& old_bounds, 107 const gfx::Rect& old_bounds,
108 const gfx::Rect& new_bounds) override; 108 const gfx::Rect& new_bounds) override;
109 void OnWindowDestroying(aura::Window* window) override; 109 void OnWindowDestroying(aura::Window* window) override;
110 110
111 // ArcCustomNotificationItem::Observer 111 // ArcNotificationItem::Observer
112 void OnItemDestroying() override; 112 void OnItemDestroying() override;
113 void OnItemUpdated() override; 113 void OnItemUpdated() override;
114 114
115 // ArcNotificationSurfaceManager::Observer: 115 // ArcNotificationSurfaceManager::Observer:
116 void OnNotificationSurfaceAdded(exo::NotificationSurface* surface) override; 116 void OnNotificationSurfaceAdded(exo::NotificationSurface* surface) override;
117 void OnNotificationSurfaceRemoved(exo::NotificationSurface* surface) override; 117 void OnNotificationSurfaceRemoved(exo::NotificationSurface* surface) override;
118 118
119 // AnimationDelegate 119 // AnimationDelegate
120 void AnimationEnded(const gfx::Animation* animation) override; 120 void AnimationEnded(const gfx::Animation* animation) override;
121 void AnimationProgressed(const gfx::Animation* animation) override; 121 void AnimationProgressed(const gfx::Animation* animation) override;
122 122
123 // If |item_| is null, we may be about to be destroyed. In this case, 123 // If |item_| is null, we may be about to be destroyed. In this case,
124 // we have to be careful about what we do. 124 // we have to be careful about what we do.
125 ArcCustomNotificationItem* item_ = nullptr; 125 ArcNotificationItem* item_ = nullptr;
126 exo::NotificationSurface* surface_ = nullptr; 126 exo::NotificationSurface* surface_ = nullptr;
127 127
128 const std::string notification_key_; 128 const std::string notification_key_;
129 129
130 // A pre-target event handler to forward events on the surface to this view. 130 // A pre-target event handler to forward events on the surface to this view.
131 // Using a pre-target event handler instead of a target handler on the surface 131 // Using a pre-target event handler instead of a target handler on the surface
132 // window because it has descendant aura::Window and the events on them need 132 // window because it has descendant aura::Window and the events on them need
133 // to be handled as well. 133 // to be handled as well.
134 // TODO(xiyuan): Revisit after exo::Surface no longer has an aura::Window. 134 // TODO(xiyuan): Revisit after exo::Surface no longer has an aura::Window.
135 std::unique_ptr<EventForwarder> event_forwarder_; 135 std::unique_ptr<EventForwarder> event_forwarder_;
(...skipping 16 matching lines...) Expand all
152 bool in_layout_ = false; 152 bool in_layout_ = false;
153 153
154 std::unique_ptr<gfx::LinearAnimation> control_button_color_animation_; 154 std::unique_ptr<gfx::LinearAnimation> control_button_color_animation_;
155 155
156 DISALLOW_COPY_AND_ASSIGN(ArcCustomNotificationView); 156 DISALLOW_COPY_AND_ASSIGN(ArcCustomNotificationView);
157 }; 157 };
158 158
159 } // namespace arc 159 } // namespace arc
160 160
161 #endif // UI_ARC_NOTIFICATION_ARC_CUSTOM_NOTIFICATION_VIEW_H_ 161 #endif // UI_ARC_NOTIFICATION_ARC_CUSTOM_NOTIFICATION_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698