OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ui/arc/notification/arc_custom_notification_view.h" |
| 6 |
| 7 #include "components/exo/notification_surface.h" |
| 8 #include "components/exo/surface.h" |
| 9 #include "ui/views/widget/widget.h" |
| 10 |
| 11 namespace arc { |
| 12 |
| 13 ArcCustomNotificationView::ArcCustomNotificationView( |
| 14 exo::NotificationSurface* surface) |
| 15 : surface_(surface) {} |
| 16 |
| 17 ArcCustomNotificationView::~ArcCustomNotificationView() {} |
| 18 |
| 19 void ArcCustomNotificationView::ViewHierarchyChanged( |
| 20 const views::View::ViewHierarchyChangedDetails& details) { |
| 21 views::Widget* widget = GetWidget(); |
| 22 |
| 23 // Bail if native_view() has attached to a different widget. |
| 24 if (widget && native_view() && |
| 25 views::Widget::GetTopLevelWidgetForNativeView(native_view()) != widget) { |
| 26 return; |
| 27 } |
| 28 |
| 29 views::NativeViewHost::ViewHierarchyChanged(details); |
| 30 |
| 31 if (!widget || !details.is_add) |
| 32 return; |
| 33 |
| 34 SetPreferredSize(surface_->GetSize()); |
| 35 Attach(surface_->window()); |
| 36 } |
| 37 |
| 38 } // namespace arc |
OLD | NEW |