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

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

Issue 2734933006: Show the settings button on a pinned notification. (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
« no previous file with comments | « no previous file | ui/arc/notification/arc_custom_notification_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/message_center/views/custom_notification_content_view_delegate.h" 15 #include "ui/message_center/views/custom_notification_content_view_delegate.h"
16 #include "ui/message_center/views/padded_button.h"
16 #include "ui/views/controls/button/button.h" 17 #include "ui/views/controls/button/button.h"
17 #include "ui/views/controls/native/native_view_host.h" 18 #include "ui/views/controls/native/native_view_host.h"
18 19
19 namespace exo { 20 namespace exo {
20 class NotificationSurface; 21 class NotificationSurface;
21 } 22 }
22 23
23 namespace views { 24 namespace views {
24 class FocusTraversable; 25 class FocusTraversable;
25 class Widget; 26 class Widget;
26 } 27 }
27 28
28 namespace arc { 29 namespace arc {
29 30
30 class ArcCustomNotificationView 31 class ArcCustomNotificationView
31 : public views::NativeViewHost, 32 : public views::NativeViewHost,
32 public views::ButtonListener, 33 public views::ButtonListener,
33 public aura::WindowObserver, 34 public aura::WindowObserver,
34 public ArcCustomNotificationItem::Observer, 35 public ArcCustomNotificationItem::Observer,
35 public ArcNotificationSurfaceManager::Observer { 36 public ArcNotificationSurfaceManager::Observer {
36 public: 37 public:
37 explicit ArcCustomNotificationView(ArcCustomNotificationItem* item); 38 explicit ArcCustomNotificationView(ArcCustomNotificationItem* item);
38 ~ArcCustomNotificationView() override; 39 ~ArcCustomNotificationView() override;
39 40
40 std::unique_ptr<message_center::CustomNotificationContentViewDelegate> 41 std::unique_ptr<message_center::CustomNotificationContentViewDelegate>
41 CreateContentViewDelegate(); 42 CreateContentViewDelegate();
42 43
43 private: 44 private:
44 class ContentViewDelegate; 45 class ContentViewDelegate;
45 class ControlButton;
46 class EventForwarder; 46 class EventForwarder;
47 class SettingsButton; 47 class SettingsButton;
48 class SlideHelper; 48 class SlideHelper;
49 49
50 // A image button class used for the settings button and the close button.
51 // We can't use forward declaration for thsi class due to std::unique_ptr<>
52 // requires size of this class.
53 class ControlButton : public message_center::PaddedButton {
54 public:
55 explicit ControlButton(ArcCustomNotificationView* owner);
56 void OnFocus() override;
57 void OnBlur() override;
58
59 private:
60 ArcCustomNotificationView* const owner_;
61
62 DISALLOW_COPY_AND_ASSIGN(ControlButton);
63 };
64
65 void CreateCloseButton();
50 void CreateFloatingControlButtons(); 66 void CreateFloatingControlButtons();
51 void SetSurface(exo::NotificationSurface* surface); 67 void SetSurface(exo::NotificationSurface* surface);
52 void UpdatePreferredSize(); 68 void UpdatePreferredSize();
53 void UpdateControlButtonsVisibility(); 69 void UpdateControlButtonsVisibility();
54 void UpdatePinnedState(); 70 void UpdatePinnedState();
55 void UpdateSnapshot(); 71 void UpdateSnapshot();
56 void AttachSurface(); 72 void AttachSurface();
57 void ActivateToast(); 73 void ActivateToast();
58 74
59 // views::NativeViewHost 75 // views::NativeViewHost
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // when a slide is in progress and restore the surface when it finishes. 118 // when a slide is in progress and restore the surface when it finishes.
103 std::unique_ptr<SlideHelper> slide_helper_; 119 std::unique_ptr<SlideHelper> slide_helper_;
104 120
105 // A control buttons on top of NotificationSurface. Needed because the 121 // A control buttons on top of NotificationSurface. Needed because the
106 // aura::Window of NotificationSurface is added after hosting widget's 122 // aura::Window of NotificationSurface is added after hosting widget's
107 // RootView thus standard notification control buttons are always below 123 // RootView thus standard notification control buttons are always below
108 // it. 124 // it.
109 std::unique_ptr<views::Widget> floating_control_buttons_widget_; 125 std::unique_ptr<views::Widget> floating_control_buttons_widget_;
110 126
111 views::View* control_buttons_view_ = nullptr; 127 views::View* control_buttons_view_ = nullptr;
112 ControlButton* close_button_ = nullptr; 128 std::unique_ptr<ControlButton> close_button_ = nullptr;
yoshiki 2017/03/10 05:27:12 nit : "= nullptr" is not necessary.
yhanada 2017/03/10 05:44:12 Done.
113 ControlButton* settings_button_ = nullptr; 129 ControlButton* settings_button_ = nullptr;
114 130
115 // Protects from call loops between Layout and OnWindowBoundsChanged. 131 // Protects from call loops between Layout and OnWindowBoundsChanged.
116 bool in_layout_ = false; 132 bool in_layout_ = false;
117 133
118 DISALLOW_COPY_AND_ASSIGN(ArcCustomNotificationView); 134 DISALLOW_COPY_AND_ASSIGN(ArcCustomNotificationView);
119 }; 135 };
120 136
121 } // namespace arc 137 } // namespace arc
122 138
123 #endif // UI_ARC_NOTIFICATION_ARC_CUSTOM_NOTIFICATION_VIEW_H_ 139 #endif // UI_ARC_NOTIFICATION_ARC_CUSTOM_NOTIFICATION_VIEW_H_
OLDNEW
« no previous file with comments | « no previous file | ui/arc/notification/arc_custom_notification_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698