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 "ash/wm/window_util.h" | 7 #include "ash/wm/window_util.h" |
8 #include "base/auto_reset.h" | 8 #include "base/auto_reset.h" |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "components/exo/notification_surface.h" | 10 #include "components/exo/notification_surface.h" |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 void ArcCustomNotificationView::OnFocus() { | 527 void ArcCustomNotificationView::OnFocus() { |
528 CHECK_EQ(message_center::CustomNotificationView::kViewClassName, | 528 CHECK_EQ(message_center::CustomNotificationView::kViewClassName, |
529 parent()->GetClassName()); | 529 parent()->GetClassName()); |
530 | 530 |
531 NativeViewHost::OnFocus(); | 531 NativeViewHost::OnFocus(); |
532 static_cast<message_center::CustomNotificationView*>(parent()) | 532 static_cast<message_center::CustomNotificationView*>(parent()) |
533 ->OnContentFocused(); | 533 ->OnContentFocused(); |
534 } | 534 } |
535 | 535 |
536 void ArcCustomNotificationView::OnBlur() { | 536 void ArcCustomNotificationView::OnBlur() { |
| 537 if (!parent()) { |
| 538 // OnBlur may be called when this view is being removed. |
| 539 return; |
| 540 } |
| 541 |
537 CHECK_EQ(message_center::CustomNotificationView::kViewClassName, | 542 CHECK_EQ(message_center::CustomNotificationView::kViewClassName, |
538 parent()->GetClassName()); | 543 parent()->GetClassName()); |
539 | 544 |
540 NativeViewHost::OnBlur(); | 545 NativeViewHost::OnBlur(); |
541 static_cast<message_center::CustomNotificationView*>(parent()) | 546 static_cast<message_center::CustomNotificationView*>(parent()) |
542 ->OnContentBlured(); | 547 ->OnContentBlured(); |
543 } | 548 } |
544 | 549 |
545 void ArcCustomNotificationView::ActivateToast() { | 550 void ArcCustomNotificationView::ActivateToast() { |
546 if (message_center::ToastContentsView::kViewClassName == | 551 if (message_center::ToastContentsView::kViewClassName == |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 | 632 |
628 void ArcCustomNotificationView::OnNotificationSurfaceRemoved( | 633 void ArcCustomNotificationView::OnNotificationSurfaceRemoved( |
629 exo::NotificationSurface* surface) { | 634 exo::NotificationSurface* surface) { |
630 if (surface->notification_id() != notification_key_) | 635 if (surface->notification_id() != notification_key_) |
631 return; | 636 return; |
632 | 637 |
633 SetSurface(nullptr); | 638 SetSurface(nullptr); |
634 } | 639 } |
635 | 640 |
636 } // namespace arc | 641 } // namespace arc |
OLD | NEW |