| 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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 const float scale = static_cast<float>(message_center::kNotificationWidth) / | 338 const float scale = static_cast<float>(message_center::kNotificationWidth) / |
| 339 preferred_size.width(); | 339 preferred_size.width(); |
| 340 preferred_size.SetSize(message_center::kNotificationWidth, | 340 preferred_size.SetSize(message_center::kNotificationWidth, |
| 341 preferred_size.height() * scale); | 341 preferred_size.height() * scale); |
| 342 } | 342 } |
| 343 | 343 |
| 344 SetPreferredSize(preferred_size); | 344 SetPreferredSize(preferred_size); |
| 345 } | 345 } |
| 346 | 346 |
| 347 void ArcCustomNotificationView::UpdateControlButtonsVisibility() { | 347 void ArcCustomNotificationView::UpdateControlButtonsVisibility() { |
| 348 if (!surface_ || !floating_control_buttons_widget_) | 348 if (!surface_) |
| 349 return; | 349 return; |
| 350 | 350 |
| 351 if (!floating_control_buttons_widget_) { |
| 352 if (GetWidget()) |
| 353 CreateFloatingControlButtons(); |
| 354 else |
| 355 return; |
| 356 } |
| 357 |
| 351 const bool target_visiblity = | 358 const bool target_visiblity = |
| 352 IsMouseHovered() || (close_button_ && close_button_->HasFocus()) || | 359 IsMouseHovered() || (close_button_ && close_button_->HasFocus()) || |
| 353 (settings_button_ && settings_button_->HasFocus()); | 360 (settings_button_ && settings_button_->HasFocus()); |
| 354 if (target_visiblity == floating_control_buttons_widget_->IsVisible()) | 361 if (target_visiblity == floating_control_buttons_widget_->IsVisible()) |
| 355 return; | 362 return; |
| 356 | 363 |
| 357 if (target_visiblity) | 364 if (target_visiblity) |
| 358 floating_control_buttons_widget_->Show(); | 365 floating_control_buttons_widget_->Show(); |
| 359 else | 366 else |
| 360 floating_control_buttons_widget_->Hide(); | 367 floating_control_buttons_widget_->Hide(); |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 | 627 |
| 621 void ArcCustomNotificationView::OnNotificationSurfaceRemoved( | 628 void ArcCustomNotificationView::OnNotificationSurfaceRemoved( |
| 622 exo::NotificationSurface* surface) { | 629 exo::NotificationSurface* surface) { |
| 623 if (surface->notification_id() != notification_key_) | 630 if (surface->notification_id() != notification_key_) |
| 624 return; | 631 return; |
| 625 | 632 |
| 626 SetSurface(nullptr); | 633 SetSurface(nullptr); |
| 627 } | 634 } |
| 628 | 635 |
| 629 } // namespace arc | 636 } // namespace arc |
| OLD | NEW |