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

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

Issue 2723143002: Add unittests of ArcCustomNotificationView (Closed)
Patch Set: Created 3 years, 9 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/message_center/views/custom_notification_content_view_delegate.h" 15 #include "ui/message_center/views/custom_notification_content_view_delegate.h"
16 #include "ui/views/controls/button/button.h" 16 #include "ui/views/controls/button/button.h"
17 #include "ui/views/controls/native/native_view_host.h" 17 #include "ui/views/controls/native/native_view_host.h"
18 18
19 namespace exo { 19 namespace exo {
20 class NotificationSurface; 20 class NotificationSurface;
21 } 21 }
22 22
23 namespace views { 23 namespace views {
24 class FocusTraversable; 24 class FocusTraversable;
25 class ImageButton; 25 class ImageButton;
26 class Widget; 26 class Widget;
27 } 27 }
28 28
29 namespace arc { 29 namespace arc {
30 30
31 class ArcCustomNotificationView 31 class ArcCustomNotificationView
32 : public views::NativeViewHost, 32 : public views::NativeViewHost,
33 public views::ButtonListener, 33 public views::ButtonListener,
34 public aura::WindowObserver, 34 public aura::WindowObserver,
35 public ArcCustomNotificationItem::Observer, 35 public ArcNotificationItem::Observer,
36 public ArcNotificationSurfaceManager::Observer { 36 public ArcNotificationSurfaceManager::Observer {
37 public: 37 public:
38 explicit ArcCustomNotificationView(ArcCustomNotificationItem* item); 38 static const char kViewClassName[];
hidehiko 2017/03/02 15:38:16 Could you add brief comment what this is for?
39
40 explicit ArcCustomNotificationView(ArcNotificationItem* item);
39 ~ArcCustomNotificationView() override; 41 ~ArcCustomNotificationView() override;
40 42
43 // views::View overrides:
44 const char* GetClassName() const override;
45
41 std::unique_ptr<message_center::CustomNotificationContentViewDelegate> 46 std::unique_ptr<message_center::CustomNotificationContentViewDelegate>
42 CreateContentViewDelegate(); 47 CreateContentViewDelegate();
43 48
44 private: 49 private:
50 friend class ArcCustomNotificationViewTest;
51
45 class ContentViewDelegate; 52 class ContentViewDelegate;
46 class ControlButton; 53 class ControlButton;
47 class EventForwarder; 54 class EventForwarder;
48 class SettingsButton; 55 class SettingsButton;
49 class SlideHelper; 56 class SlideHelper;
50 57
51 void CreateFloatingControlButtons(); 58 void CreateFloatingControlButtons();
52 void SetSurface(exo::NotificationSurface* surface); 59 void SetSurface(exo::NotificationSurface* surface);
53 void UpdatePreferredSize(); 60 void UpdatePreferredSize();
54 void UpdateControlButtonsVisiblity(); 61 void UpdateControlButtonsVisiblity();
(...skipping 24 matching lines...) Expand all
79 void OnWindowDestroying(aura::Window* window) override; 86 void OnWindowDestroying(aura::Window* window) override;
80 87
81 // ArcCustomNotificationItem::Observer 88 // ArcCustomNotificationItem::Observer
82 void OnItemDestroying() override; 89 void OnItemDestroying() override;
83 void OnItemUpdated() override; 90 void OnItemUpdated() override;
84 91
85 // ArcNotificationSurfaceManager::Observer: 92 // ArcNotificationSurfaceManager::Observer:
86 void OnNotificationSurfaceAdded(exo::NotificationSurface* surface) override; 93 void OnNotificationSurfaceAdded(exo::NotificationSurface* surface) override;
87 void OnNotificationSurfaceRemoved(exo::NotificationSurface* surface) override; 94 void OnNotificationSurfaceRemoved(exo::NotificationSurface* surface) override;
88 95
89 ArcCustomNotificationItem* item_ = nullptr; 96 ArcNotificationItem* item_ = nullptr;
90 exo::NotificationSurface* surface_ = nullptr; 97 exo::NotificationSurface* surface_ = nullptr;
91 98
92 const std::string notification_key_; 99 const std::string notification_key_;
93 100
94 // A pre-target event handler to forward events on the surface to this view. 101 // A pre-target event handler to forward events on the surface to this view.
95 // Using a pre-target event handler instead of a target handler on the surface 102 // Using a pre-target event handler instead of a target handler on the surface
96 // window because it has descendant aura::Window and the events on them need 103 // window because it has descendant aura::Window and the events on them need
97 // to be handled as well. 104 // to be handled as well.
98 // TODO(xiyuan): Revisit after exo::Surface no longer has an aura::Window. 105 // TODO(xiyuan): Revisit after exo::Surface no longer has an aura::Window.
99 std::unique_ptr<EventForwarder> event_forwarder_; 106 std::unique_ptr<EventForwarder> event_forwarder_;
(...skipping 14 matching lines...) Expand all
114 121
115 // Protects from call loops between Layout and OnWindowBoundsChanged. 122 // Protects from call loops between Layout and OnWindowBoundsChanged.
116 bool in_layout_ = false; 123 bool in_layout_ = false;
117 124
118 DISALLOW_COPY_AND_ASSIGN(ArcCustomNotificationView); 125 DISALLOW_COPY_AND_ASSIGN(ArcCustomNotificationView);
119 }; 126 };
120 127
121 } // namespace arc 128 } // namespace arc
122 129
123 #endif // UI_ARC_NOTIFICATION_ARC_CUSTOM_NOTIFICATION_VIEW_H_ 130 #endif // UI_ARC_NOTIFICATION_ARC_CUSTOM_NOTIFICATION_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698