OLD | NEW |
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_ |
OLD | NEW |