| 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/app_list/presenter/app_list_presenter_impl.h" | 5 #include "ui/app_list/presenter/app_list_presenter_impl.h" |
| 6 | 6 |
| 7 #include "ui/app_list/app_list_constants.h" | 7 #include "ui/app_list/app_list_constants.h" |
| 8 #include "ui/app_list/app_list_switches.h" | 8 #include "ui/app_list/app_list_switches.h" |
| 9 #include "ui/app_list/pagination_model.h" | 9 #include "ui/app_list/pagination_model.h" |
| 10 #include "ui/app_list/presenter/app_list_presenter_delegate_factory.h" | 10 #include "ui/app_list/presenter/app_list_presenter_delegate_factory.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 | 73 |
| 74 void AppListPresenterImpl::Dismiss() { | 74 void AppListPresenterImpl::Dismiss() { |
| 75 if (!is_visible_) | 75 if (!is_visible_) |
| 76 return; | 76 return; |
| 77 | 77 |
| 78 // If the app list is currently visible, there should be an existing view. | 78 // If the app list is currently visible, there should be an existing view. |
| 79 DCHECK(view_); | 79 DCHECK(view_); |
| 80 | 80 |
| 81 is_visible_ = false; | 81 is_visible_ = false; |
| 82 | 82 |
| 83 // Our widget is currently active. When the animation completes we'll hide | 83 // The dismissal may have occurred in response to the app list losing |
| 84 // the widget, changing activation. If a menu is shown before the animation | 84 // activation. Otherwise, our widget is currently active. When the animation |
| 85 // completes then the activation change triggers the menu to close. By | 85 // completes we'll hide the widget, changing activation. If a menu is shown |
| 86 // deactivating now we ensure there is no activation change when the | 86 // before the animation completes then the activation change triggers the menu |
| 87 // animation completes and any menus stay open. | 87 // to close. By deactivating now we ensure there is no activation change when |
| 88 view_->GetWidget()->Deactivate(); | 88 // the animation completes and any menus stay open. |
| 89 if (view_->GetWidget()->IsActive()) |
| 90 view_->GetWidget()->Deactivate(); |
| 89 | 91 |
| 90 presenter_delegate_->OnDismissed(); | 92 presenter_delegate_->OnDismissed(); |
| 91 ScheduleAnimation(); | 93 ScheduleAnimation(); |
| 92 } | 94 } |
| 93 | 95 |
| 94 void AppListPresenterImpl::ToggleAppList(int64_t display_id) { | 96 void AppListPresenterImpl::ToggleAppList(int64_t display_id) { |
| 95 if (IsVisible()) { | 97 if (IsVisible()) { |
| 96 Dismiss(); | 98 Dismiss(); |
| 97 return; | 99 return; |
| 98 } | 100 } |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 } else if (should_snap_back_) { | 264 } else if (should_snap_back_) { |
| 263 should_snap_back_ = false; | 265 should_snap_back_ = false; |
| 264 ui::ScopedLayerAnimationSettings animation(widget_animator); | 266 ui::ScopedLayerAnimationSettings animation(widget_animator); |
| 265 animation.SetTransitionDuration( | 267 animation.SetTransitionDuration( |
| 266 base::TimeDelta::FromMilliseconds(kOverscrollPageTransitionDurationMs)); | 268 base::TimeDelta::FromMilliseconds(kOverscrollPageTransitionDurationMs)); |
| 267 widget->SetBounds(view_bounds_); | 269 widget->SetBounds(view_bounds_); |
| 268 } | 270 } |
| 269 } | 271 } |
| 270 | 272 |
| 271 } // namespace app_list | 273 } // namespace app_list |
| OLD | NEW |