| 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 <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/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 message_center { |
| 24 class MessageView; |
| 25 } |
| 26 |
| 23 namespace views { | 27 namespace views { |
| 24 class FocusTraversable; | 28 class FocusTraversable; |
| 25 class ImageButton; | 29 class ImageButton; |
| 26 class Widget; | 30 class Widget; |
| 27 } | 31 } |
| 28 | 32 |
| 29 namespace arc { | 33 namespace arc { |
| 30 | 34 |
| 31 class ArcCustomNotificationView | 35 class ArcCustomNotificationView |
| 32 : public views::NativeViewHost, | 36 : public views::NativeViewHost, |
| 33 public views::ButtonListener, | 37 public views::ButtonListener, |
| 34 public aura::WindowObserver, | 38 public aura::WindowObserver, |
| 35 public ArcCustomNotificationItem::Observer, | 39 public ArcCustomNotificationItem::Observer, |
| 36 public ArcNotificationSurfaceManager::Observer { | 40 public ArcNotificationSurfaceManager::Observer { |
| 37 public: | 41 public: |
| 38 explicit ArcCustomNotificationView(ArcCustomNotificationItem* item); | 42 ArcCustomNotificationView(ArcCustomNotificationItem* item, |
| 43 message_center::MessageView* parent); |
| 39 ~ArcCustomNotificationView() override; | 44 ~ArcCustomNotificationView() override; |
| 40 | 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: |
| 45 class ContentViewDelegate; | 50 class ContentViewDelegate; |
| 46 class CloseButton; | 51 class CloseButton; |
| 47 class EventForwarder; | 52 class EventForwarder; |
| 48 class SlideHelper; | 53 class SlideHelper; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 78 void OnWindowDestroying(aura::Window* window) override; | 83 void OnWindowDestroying(aura::Window* window) override; |
| 79 | 84 |
| 80 // ArcCustomNotificationItem::Observer | 85 // ArcCustomNotificationItem::Observer |
| 81 void OnItemDestroying() override; | 86 void OnItemDestroying() override; |
| 82 void OnItemUpdated() override; | 87 void OnItemUpdated() override; |
| 83 | 88 |
| 84 // ArcNotificationSurfaceManager::Observer: | 89 // ArcNotificationSurfaceManager::Observer: |
| 85 void OnNotificationSurfaceAdded(exo::NotificationSurface* surface) override; | 90 void OnNotificationSurfaceAdded(exo::NotificationSurface* surface) override; |
| 86 void OnNotificationSurfaceRemoved(exo::NotificationSurface* surface) override; | 91 void OnNotificationSurfaceRemoved(exo::NotificationSurface* surface) override; |
| 87 | 92 |
| 88 ArcCustomNotificationItem* item_ = nullptr; | 93 ArcCustomNotificationItem* item_; |
| 94 message_center::MessageView* const parent_; |
| 89 exo::NotificationSurface* surface_ = nullptr; | 95 exo::NotificationSurface* surface_ = nullptr; |
| 90 | 96 |
| 91 const std::string notification_key_; | 97 const std::string notification_key_; |
| 92 | 98 |
| 93 // A pre-target event handler to forward events on the surface to this view. | 99 // A pre-target event handler to forward events on the surface to this view. |
| 94 // Using a pre-target event handler instead of a target handler on the surface | 100 // Using a pre-target event handler instead of a target handler on the surface |
| 95 // window because it has descendant aura::Window and the events on them need | 101 // window because it has descendant aura::Window and the events on them need |
| 96 // to be handled as well. | 102 // to be handled as well. |
| 97 // TODO(xiyuan): Revisit after exo::Surface no longer has an aura::Window. | 103 // TODO(xiyuan): Revisit after exo::Surface no longer has an aura::Window. |
| 98 std::unique_ptr<EventForwarder> event_forwarder_; | 104 std::unique_ptr<EventForwarder> event_forwarder_; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 111 | 117 |
| 112 // Protects from call loops between Layout and OnWindowBoundsChanged. | 118 // Protects from call loops between Layout and OnWindowBoundsChanged. |
| 113 bool in_layout_ = false; | 119 bool in_layout_ = false; |
| 114 | 120 |
| 115 DISALLOW_COPY_AND_ASSIGN(ArcCustomNotificationView); | 121 DISALLOW_COPY_AND_ASSIGN(ArcCustomNotificationView); |
| 116 }; | 122 }; |
| 117 | 123 |
| 118 } // namespace arc | 124 } // namespace arc |
| 119 | 125 |
| 120 #endif // UI_ARC_NOTIFICATION_ARC_CUSTOM_NOTIFICATION_VIEW_H_ | 126 #endif // UI_ARC_NOTIFICATION_ARC_CUSTOM_NOTIFICATION_VIEW_H_ |
| OLD | NEW |