| Index: ui/arc/notification/arc_notification_content_view.cc
|
| diff --git a/ui/arc/notification/arc_notification_content_view.cc b/ui/arc/notification/arc_notification_content_view.cc
|
| index 312dcb97f903e63d66ce622d45743429f8169721..3f99033c95edca5245a674300edab2df34067175 100644
|
| --- a/ui/arc/notification/arc_notification_content_view.cc
|
| +++ b/ui/arc/notification/arc_notification_content_view.cc
|
| @@ -360,8 +360,6 @@ void ArcNotificationContentView::SetSurface(exo::NotificationSurface* surface) {
|
| surface_->window()->AddObserver(this);
|
| surface_->window()->AddPreTargetHandler(event_forwarder_.get());
|
|
|
| - MaybeCreateFloatingControlButtons();
|
| -
|
| if (GetWidget())
|
| AttachSurface();
|
| }
|
| @@ -388,22 +386,9 @@ void ArcNotificationContentView::UpdatePreferredSize() {
|
| }
|
|
|
| void ArcNotificationContentView::UpdateControlButtonsVisibility() {
|
| - if (!surface_)
|
| + if (!floating_control_buttons_widget_)
|
| return;
|
|
|
| - // TODO(edcourtney, yhanada): Creating the floating control widget here is not
|
| - // correct. This function may be called during the destruction of
|
| - // |floating_control_buttons_widget_|. This can lead to memory corruption.
|
| - // Rather than creating it here, we should fix the behaviour of OnMouseExited
|
| - // and OnMouseEntered for ARC notifications in MessageCenterView. See
|
| - // crbug.com/714587 and crbug.com/709862.
|
| - if (!floating_control_buttons_widget_) {
|
| - // This may update |floating_control_buttons_widget_|.
|
| - MaybeCreateFloatingControlButtons();
|
| - if (!floating_control_buttons_widget_)
|
| - return;
|
| - }
|
| -
|
| const bool target_visiblity =
|
| IsMouseHovered() || (close_button_ && close_button_->HasFocus()) ||
|
| (settings_button_ && settings_button_->HasFocus());
|
| @@ -420,6 +405,10 @@ void ArcNotificationContentView::UpdatePinnedState() {
|
| if (!item_)
|
| return;
|
|
|
| + // Surface is not attached yet.
|
| + if (!control_buttons_view_)
|
| + return;
|
| +
|
| if (item_->GetPinned() && close_button_) {
|
| control_buttons_view_->RemoveChildView(close_button_.get());
|
| close_button_.reset();
|
| @@ -457,10 +446,8 @@ void ArcNotificationContentView::AttachSurface() {
|
| // Invokes Update() in case surface is attached during a slide.
|
| slide_helper_->Update();
|
|
|
| - // Updates pinned state to create or destroy the floating close button
|
| - // after |surface_| is attached to a widget.
|
| - if (item_)
|
| - UpdatePinnedState();
|
| + // (Re-)create the floating buttons after |surface_| is attached to a widget.
|
| + MaybeCreateFloatingControlButtons();
|
| }
|
|
|
| void ArcNotificationContentView::StartControlButtonsColorAnimation() {
|
|
|