| 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 #include "ui/arc/notification/arc_custom_notification_view.h" | 5 #include "ui/arc/notification/arc_custom_notification_view.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "components/exo/notification_surface.h" | 8 #include "components/exo/notification_surface.h" |
| 9 #include "components/exo/surface.h" | 9 #include "components/exo/surface.h" |
| 10 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 slide_helper_->Update(); | 303 slide_helper_->Update(); |
| 304 } | 304 } |
| 305 | 305 |
| 306 void ArcCustomNotificationView::ViewHierarchyChanged( | 306 void ArcCustomNotificationView::ViewHierarchyChanged( |
| 307 const views::View::ViewHierarchyChangedDetails& details) { | 307 const views::View::ViewHierarchyChangedDetails& details) { |
| 308 views::Widget* widget = GetWidget(); | 308 views::Widget* widget = GetWidget(); |
| 309 | 309 |
| 310 if (!details.is_add) { | 310 if (!details.is_add) { |
| 311 // Resets slide helper when this view is removed from its parent. | 311 // Resets slide helper when this view is removed from its parent. |
| 312 slide_helper_.reset(); | 312 slide_helper_.reset(); |
| 313 } | |
| 314 | 313 |
| 315 // Bail if native_view() has attached to a different widget. | 314 // Bail if this view is no longer attached to a widget or native_view() has |
| 316 if (widget && native_view() && | 315 // attached to a different widget. |
| 317 views::Widget::GetTopLevelWidgetForNativeView(native_view()) != widget) { | 316 if (!widget || (native_view() && |
| 318 return; | 317 views::Widget::GetTopLevelWidgetForNativeView( |
| 318 native_view()) != widget)) { |
| 319 return; |
| 320 } |
| 319 } | 321 } |
| 320 | 322 |
| 321 views::NativeViewHost::ViewHierarchyChanged(details); | 323 views::NativeViewHost::ViewHierarchyChanged(details); |
| 322 | 324 |
| 323 if (!widget || !surface_ || !details.is_add) | 325 if (!widget || !surface_ || !details.is_add) |
| 324 return; | 326 return; |
| 325 | 327 |
| 326 AttachSurface(); | 328 AttachSurface(); |
| 327 } | 329 } |
| 328 | 330 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 | 445 |
| 444 void ArcCustomNotificationView::OnNotificationSurfaceRemoved( | 446 void ArcCustomNotificationView::OnNotificationSurfaceRemoved( |
| 445 exo::NotificationSurface* surface) { | 447 exo::NotificationSurface* surface) { |
| 446 if (surface->notification_id() != notification_key_) | 448 if (surface->notification_id() != notification_key_) |
| 447 return; | 449 return; |
| 448 | 450 |
| 449 SetSurface(nullptr); | 451 SetSurface(nullptr); |
| 450 } | 452 } |
| 451 | 453 |
| 452 } // namespace arc | 454 } // namespace arc |
| OLD | NEW |