| 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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 | 489 |
| 490 void ArcCustomNotificationView::OnMouseEntered(const ui::MouseEvent&) { | 490 void ArcCustomNotificationView::OnMouseEntered(const ui::MouseEvent&) { |
| 491 UpdateControlButtonsVisibility(); | 491 UpdateControlButtonsVisibility(); |
| 492 } | 492 } |
| 493 | 493 |
| 494 void ArcCustomNotificationView::OnMouseExited(const ui::MouseEvent&) { | 494 void ArcCustomNotificationView::OnMouseExited(const ui::MouseEvent&) { |
| 495 UpdateControlButtonsVisibility(); | 495 UpdateControlButtonsVisibility(); |
| 496 } | 496 } |
| 497 | 497 |
| 498 void ArcCustomNotificationView::OnFocus() { | 498 void ArcCustomNotificationView::OnFocus() { |
| 499 CHECK_EQ(message_center::CustomNotificationView::kViewClassName, |
| 500 parent()->GetClassName()); |
| 501 |
| 499 NativeViewHost::OnFocus(); | 502 NativeViewHost::OnFocus(); |
| 500 static_cast<message_center::CustomNotificationView*>(parent()) | 503 static_cast<message_center::CustomNotificationView*>(parent()) |
| 501 ->OnContentFocused(); | 504 ->OnContentFocused(); |
| 502 } | 505 } |
| 503 | 506 |
| 504 void ArcCustomNotificationView::OnBlur() { | 507 void ArcCustomNotificationView::OnBlur() { |
| 508 CHECK_EQ(message_center::CustomNotificationView::kViewClassName, |
| 509 parent()->GetClassName()); |
| 510 |
| 505 NativeViewHost::OnBlur(); | 511 NativeViewHost::OnBlur(); |
| 506 static_cast<message_center::CustomNotificationView*>(parent()) | 512 static_cast<message_center::CustomNotificationView*>(parent()) |
| 507 ->OnContentBlured(); | 513 ->OnContentBlured(); |
| 508 } | 514 } |
| 509 | 515 |
| 510 void ArcCustomNotificationView::ActivateToast() { | 516 void ArcCustomNotificationView::ActivateToast() { |
| 511 if (message_center::ToastContentsView::kViewClassName == | 517 if (message_center::ToastContentsView::kViewClassName == |
| 512 parent()->parent()->GetClassName()) { | 518 parent()->parent()->GetClassName()) { |
| 513 static_cast<message_center::ToastContentsView*>(parent()->parent()) | 519 static_cast<message_center::ToastContentsView*>(parent()->parent()) |
| 514 ->ActivateToast(); | 520 ->ActivateToast(); |
| 515 } | 521 } |
| 516 } | 522 } |
| 517 | 523 |
| 518 views::FocusTraversable* ArcCustomNotificationView::GetFocusTraversable() { | 524 views::FocusTraversable* ArcCustomNotificationView::GetFocusTraversable() { |
| 519 if (floating_control_buttons_widget_) | 525 if (floating_control_buttons_widget_) |
| 520 return static_cast<views::internal::RootView*>( | 526 return static_cast<views::internal::RootView*>( |
| 521 floating_control_buttons_widget_->GetRootView()); | 527 floating_control_buttons_widget_->GetRootView()); |
| 522 return nullptr; | 528 return nullptr; |
| 523 } | 529 } |
| 524 | 530 |
| 525 void ArcCustomNotificationView::ButtonPressed(views::Button* sender, | 531 void ArcCustomNotificationView::ButtonPressed(views::Button* sender, |
| 526 const ui::Event& event) { | 532 const ui::Event& event) { |
| 527 if (item_ && !item_->pinned() && sender == close_button_) { | 533 if (item_ && !item_->pinned() && sender == close_button_) { |
| 528 item_->CloseFromCloseButton(); | 534 CHECK_EQ(message_center::CustomNotificationView::kViewClassName, |
| 535 parent()->GetClassName()); |
| 536 static_cast<message_center::CustomNotificationView*>(parent()) |
| 537 ->OnCloseButtonPressed(); |
| 529 } | 538 } |
| 530 if (item_ && settings_button_ && sender == settings_button_) { | 539 if (item_ && settings_button_ && sender == settings_button_) { |
| 531 item_->OpenSettings(); | 540 item_->OpenSettings(); |
| 532 } | 541 } |
| 533 } | 542 } |
| 534 | 543 |
| 535 void ArcCustomNotificationView::OnWindowBoundsChanged( | 544 void ArcCustomNotificationView::OnWindowBoundsChanged( |
| 536 aura::Window* window, | 545 aura::Window* window, |
| 537 const gfx::Rect& old_bounds, | 546 const gfx::Rect& old_bounds, |
| 538 const gfx::Rect& new_bounds) { | 547 const gfx::Rect& new_bounds) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 | 580 |
| 572 void ArcCustomNotificationView::OnNotificationSurfaceRemoved( | 581 void ArcCustomNotificationView::OnNotificationSurfaceRemoved( |
| 573 exo::NotificationSurface* surface) { | 582 exo::NotificationSurface* surface) { |
| 574 if (surface->notification_id() != notification_key_) | 583 if (surface->notification_id() != notification_key_) |
| 575 return; | 584 return; |
| 576 | 585 |
| 577 SetSurface(nullptr); | 586 SetSurface(nullptr); |
| 578 } | 587 } |
| 579 | 588 |
| 580 } // namespace arc | 589 } // namespace arc |
| OLD | NEW |