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

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

Issue 2093563007: Add a floating close button for arc custom notification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typo Created 4 years, 5 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 <string> 9 #include <string>
9 10
10 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "ui/arc/notification/arc_custom_notification_item.h"
13 #include "ui/views/controls/button/button.h"
11 #include "ui/views/controls/native/native_view_host.h" 14 #include "ui/views/controls/native/native_view_host.h"
12 15
13 namespace exo { 16 namespace exo {
14 class NotificationSurface; 17 class NotificationSurface;
15 } 18 }
16 19
20 namespace views {
21 class ImageButton;
22 class Widget;
23 }
24
17 namespace arc { 25 namespace arc {
18 26
19 class ArcCustomNotificationView : public views::NativeViewHost { 27 class ArcCustomNotificationView : public views::NativeViewHost,
28 public views::ButtonListener,
29 public ArcCustomNotificationItem::Observer {
20 public: 30 public:
21 explicit ArcCustomNotificationView(exo::NotificationSurface* surface); 31 ArcCustomNotificationView(ArcCustomNotificationItem* item,
32 exo::NotificationSurface* surface);
22 ~ArcCustomNotificationView() override; 33 ~ArcCustomNotificationView() override;
23 34
24 private: 35 private:
36 void CreateFloatingCloseButton();
37
25 // views::NativeViewHost 38 // views::NativeViewHost
26 void ViewHierarchyChanged( 39 void ViewHierarchyChanged(
27 const ViewHierarchyChangedDetails& details) override; 40 const ViewHierarchyChangedDetails& details) override;
41 void Layout() override;
28 42
43 // views::ButtonListener
44 void ButtonPressed(views::Button* sender, const ui::Event& event) override;
45
46 // ArcCustomNotificationItem::Observer
47 void OnItemDestroying() override;
48 void OnItemPinnedChanged() override;
49
50 ArcCustomNotificationItem* item_;
29 exo::NotificationSurface* const surface_; 51 exo::NotificationSurface* const surface_;
30 52
53 // A close button on top of NotificationSurface. Needed because the
54 // aura::Window of NotificationSurface is added after hosting widget's
55 // RootView thus standard notification close button is always below
56 // it.
57 std::unique_ptr<views::Widget> floating_close_button_widget_;
58
59 views::ImageButton* floating_close_button_ = nullptr;
60
31 DISALLOW_COPY_AND_ASSIGN(ArcCustomNotificationView); 61 DISALLOW_COPY_AND_ASSIGN(ArcCustomNotificationView);
32 }; 62 };
33 63
34 } // namespace arc 64 } // namespace arc
35 65
36 #endif // UI_ARC_NOTIFICATION_ARC_CUSTOM_NOTIFICATION_VIEW_H_ 66 #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