Chromium Code Reviews| 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..c387c386470056e654dd59250bfbb90aca4f2d59 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_) { |
|
Eliot Courtney
2017/06/01 07:37:39
I think removing this code will cause a regression
yoshiki
2017/06/05 04:59:31
As I checked, the regression is not happened. (alt
|
| - // 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()); |
| @@ -417,7 +402,8 @@ void ArcNotificationContentView::UpdateControlButtonsVisibility() { |
| } |
| void ArcNotificationContentView::UpdatePinnedState() { |
| - if (!item_) |
| + // Surface is not attached yet. |
| + if (!control_buttons_view_) |
|
Eliot Courtney
2017/06/01 07:37:39
After removing the call to UpdatePinnedState from
yoshiki
2017/06/05 04:59:31
Done.
|
| return; |
| if (item_->GetPinned() && close_button_) { |
| @@ -457,10 +443,9 @@ 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. |
| + // (Re-)create the floating buttons after |surface_| is attached to a widget. |
| if (item_) |
|
Eliot Courtney
2017/06/01 07:37:39
I think item_ is checked inside MaybeCreateFloatin
yoshiki
2017/06/05 04:59:31
Done.
|
| - UpdatePinnedState(); |
| + MaybeCreateFloatingControlButtons(); |
|
Eliot Courtney
2017/06/01 07:37:39
Doesn't this mean the pinned state potentially isn
yoshiki
2017/06/05 04:59:31
The pinned state is updated by this method because
|
| } |
| void ArcNotificationContentView::StartControlButtonsColorAnimation() { |