| 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 "base/metrics/user_metrics.h" | 7 #include "base/metrics/user_metrics.h" |
| 8 #include "ui/app_list/app_list_constants.h" | 8 #include "ui/app_list/app_list_constants.h" |
| 9 #include "ui/app_list/app_list_switches.h" | 9 #include "ui/app_list/app_list_switches.h" |
| 10 #include "ui/app_list/pagination_model.h" | 10 #include "ui/app_list/pagination_model.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 presenter_delegate_ = factory_->GetDelegate(this); | 68 presenter_delegate_ = factory_->GetDelegate(this); |
| 69 AppListViewDelegate* view_delegate = presenter_delegate_->GetViewDelegate(); | 69 AppListViewDelegate* view_delegate = presenter_delegate_->GetViewDelegate(); |
| 70 DCHECK(view_delegate); | 70 DCHECK(view_delegate); |
| 71 // Note the AppListViewDelegate outlives the AppListView. For Ash, the view | 71 // Note the AppListViewDelegate outlives the AppListView. For Ash, the view |
| 72 // is destroyed when dismissed. | 72 // is destroyed when dismissed. |
| 73 AppListView* view = new AppListView(view_delegate); | 73 AppListView* view = new AppListView(view_delegate); |
| 74 presenter_delegate_->Init(view, display_id, current_apps_page_); | 74 presenter_delegate_->Init(view, display_id, current_apps_page_); |
| 75 SetView(view); | 75 SetView(view); |
| 76 } | 76 } |
| 77 presenter_delegate_->OnShown(display_id); | 77 presenter_delegate_->OnShown(display_id); |
| 78 base::RecordAction(base::UserMetricsAction("Launcher_Show")); |
| 78 } | 79 } |
| 79 | 80 |
| 80 void AppListPresenterImpl::Dismiss() { | 81 void AppListPresenterImpl::Dismiss() { |
| 81 if (!is_visible_) | 82 if (!is_visible_) |
| 82 return; | 83 return; |
| 83 | 84 |
| 84 // If the app list is currently visible, there should be an existing view. | 85 // If the app list is currently visible, there should be an existing view. |
| 85 DCHECK(view_); | 86 DCHECK(view_); |
| 86 | 87 |
| 87 is_visible_ = false; | 88 is_visible_ = false; |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 } else if (should_snap_back_) { | 296 } else if (should_snap_back_) { |
| 296 should_snap_back_ = false; | 297 should_snap_back_ = false; |
| 297 ui::ScopedLayerAnimationSettings animation(widget_animator); | 298 ui::ScopedLayerAnimationSettings animation(widget_animator); |
| 298 animation.SetTransitionDuration( | 299 animation.SetTransitionDuration( |
| 299 base::TimeDelta::FromMilliseconds(kOverscrollPageTransitionDurationMs)); | 300 base::TimeDelta::FromMilliseconds(kOverscrollPageTransitionDurationMs)); |
| 300 widget->SetBounds(view_bounds_); | 301 widget->SetBounds(view_bounds_); |
| 301 } | 302 } |
| 302 } | 303 } |
| 303 | 304 |
| 304 } // namespace app_list | 305 } // namespace app_list |
| OLD | NEW |