Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(415)

Side by Side Diff: ui/arc/notification/arc_custom_notification_view.cc

Issue 2809133002: Create the control buttons on a notification when showing the buttons if needed. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 const float scale = static_cast<float>(message_center::kNotificationWidth) / 335 const float scale = static_cast<float>(message_center::kNotificationWidth) /
336 preferred_size.width(); 336 preferred_size.width();
337 preferred_size.SetSize(message_center::kNotificationWidth, 337 preferred_size.SetSize(message_center::kNotificationWidth,
338 preferred_size.height() * scale); 338 preferred_size.height() * scale);
339 } 339 }
340 340
341 SetPreferredSize(preferred_size); 341 SetPreferredSize(preferred_size);
342 } 342 }
343 343
344 void ArcCustomNotificationView::UpdateControlButtonsVisibility() { 344 void ArcCustomNotificationView::UpdateControlButtonsVisibility() {
345 if (!surface_ || !floating_control_buttons_widget_) 345 if (!surface_)
346 return; 346 return;
347 347
348 if (!floating_control_buttons_widget_) {
349 if (GetWidget())
350 CreateFloatingControlButtons();
351 else
352 return;
353 }
354
348 const bool target_visiblity = 355 const bool target_visiblity =
349 IsMouseHovered() || (close_button_ && close_button_->HasFocus()) || 356 IsMouseHovered() || (close_button_ && close_button_->HasFocus()) ||
350 (settings_button_ && settings_button_->HasFocus()); 357 (settings_button_ && settings_button_->HasFocus());
351 if (target_visiblity == floating_control_buttons_widget_->IsVisible()) 358 if (target_visiblity == floating_control_buttons_widget_->IsVisible())
352 return; 359 return;
353 360
354 if (target_visiblity) 361 if (target_visiblity)
355 floating_control_buttons_widget_->Show(); 362 floating_control_buttons_widget_->Show();
356 else 363 else
357 floating_control_buttons_widget_->Hide(); 364 floating_control_buttons_widget_->Hide();
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 624
618 void ArcCustomNotificationView::OnNotificationSurfaceRemoved( 625 void ArcCustomNotificationView::OnNotificationSurfaceRemoved(
619 exo::NotificationSurface* surface) { 626 exo::NotificationSurface* surface) {
620 if (surface->notification_id() != notification_key_) 627 if (surface->notification_id() != notification_key_)
621 return; 628 return;
622 629
623 SetSurface(nullptr); 630 SetSurface(nullptr);
624 } 631 }
625 632
626 } // namespace arc 633 } // namespace arc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698