Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/ui/app_list/app_list_service_views.h" | 5 #include "chrome/browser/ui/app_list/app_list_service_views.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "chrome/browser/apps/scoped_keep_alive.h" | 9 #include "chrome/browser/lifetime/keep_alive_options.h" |
| 10 #include "chrome/browser/lifetime/scoped_keep_alive.h" | |
| 10 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" | 11 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" |
| 11 #include "ui/app_list/app_list_switches.h" | 12 #include "ui/app_list/app_list_switches.h" |
| 12 #include "ui/app_list/views/app_list_main_view.h" | 13 #include "ui/app_list/views/app_list_main_view.h" |
| 13 #include "ui/app_list/views/app_list_view.h" | 14 #include "ui/app_list/views/app_list_view.h" |
| 14 #include "ui/app_list/views/contents_view.h" | 15 #include "ui/app_list/views/contents_view.h" |
| 15 | 16 |
| 17 namespace { | |
| 18 | |
| 19 static const KeepAliveOptions g_keep_alive_options = {"AppListServiceViews"}; | |
|
Bernhard Bauer
2016/02/22 18:19:38
Same as above. Also (as mentioned above), the anon
dgn
2016/02/22 19:07:19
Thanks. Removed since there's nothing else in the
| |
| 20 | |
| 21 } // namespace | |
| 22 | |
| 16 AppListServiceViews::AppListServiceViews( | 23 AppListServiceViews::AppListServiceViews( |
| 17 scoped_ptr<AppListControllerDelegate> controller_delegate) | 24 scoped_ptr<AppListControllerDelegate> controller_delegate) |
| 18 : shower_(this), | 25 : shower_(this), |
| 19 can_dismiss_(true), | 26 can_dismiss_(true), |
| 20 controller_delegate_(std::move(controller_delegate)) {} | 27 controller_delegate_(std::move(controller_delegate)) {} |
| 21 | 28 |
| 22 AppListServiceViews::~AppListServiceViews() {} | 29 AppListServiceViews::~AppListServiceViews() {} |
| 23 | 30 |
| 24 void AppListServiceViews::OnViewBeingDestroyed() { | 31 void AppListServiceViews::OnViewBeingDestroyed() { |
| 25 can_dismiss_ = true; | 32 can_dismiss_ = true; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 109 | 116 |
| 110 AppListViewDelegate* AppListServiceViews::GetViewDelegateForCreate() { | 117 AppListViewDelegate* AppListServiceViews::GetViewDelegateForCreate() { |
| 111 return GetViewDelegate(shower_.profile()); | 118 return GetViewDelegate(shower_.profile()); |
| 112 } | 119 } |
| 113 | 120 |
| 114 void AppListServiceViews::ShowForProfileInternal( | 121 void AppListServiceViews::ShowForProfileInternal( |
| 115 Profile* profile, | 122 Profile* profile, |
| 116 app_list::AppListModel::State state) { | 123 app_list::AppListModel::State state) { |
| 117 DCHECK(profile); | 124 DCHECK(profile); |
| 118 | 125 |
| 119 ScopedKeepAlive keep_alive; | 126 ScopedKeepAlive keep_alive(&g_keep_alive_options); |
| 120 | 127 |
| 121 CreateForProfile(profile); | 128 CreateForProfile(profile); |
| 122 | 129 |
| 123 if (state != app_list::AppListModel::INVALID_STATE) { | 130 if (state != app_list::AppListModel::INVALID_STATE) { |
| 124 app_list::ContentsView* contents_view = | 131 app_list::ContentsView* contents_view = |
| 125 shower_.app_list()->app_list_main_view()->contents_view(); | 132 shower_.app_list()->app_list_main_view()->contents_view(); |
| 126 contents_view->SetActiveState(state, | 133 contents_view->SetActiveState(state, |
| 127 shower_.IsAppListVisible() /* animate */); | 134 shower_.IsAppListVisible() /* animate */); |
| 128 } | 135 } |
| 129 | 136 |
| 130 shower_.ShowForCurrentProfile(); | 137 shower_.ShowForCurrentProfile(); |
| 131 RecordAppListLaunch(); | 138 RecordAppListLaunch(); |
| 132 } | 139 } |
| OLD | NEW |