Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: chrome/browser/ui/app_list/app_list_service_views.cc

Issue 1708343002: Add ScopedKeepAlive to c/b/lifetime (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 const KeepAliveOptions kKeepAliveOptions = {"AppListServiceViews"};
18
16 AppListServiceViews::AppListServiceViews( 19 AppListServiceViews::AppListServiceViews(
17 scoped_ptr<AppListControllerDelegate> controller_delegate) 20 scoped_ptr<AppListControllerDelegate> controller_delegate)
18 : shower_(this), 21 : shower_(this),
19 can_dismiss_(true), 22 can_dismiss_(true),
20 controller_delegate_(std::move(controller_delegate)) {} 23 controller_delegate_(std::move(controller_delegate)) {}
21 24
22 AppListServiceViews::~AppListServiceViews() {} 25 AppListServiceViews::~AppListServiceViews() {}
23 26
24 void AppListServiceViews::OnViewBeingDestroyed() { 27 void AppListServiceViews::OnViewBeingDestroyed() {
25 can_dismiss_ = true; 28 can_dismiss_ = true;
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 112
110 AppListViewDelegate* AppListServiceViews::GetViewDelegateForCreate() { 113 AppListViewDelegate* AppListServiceViews::GetViewDelegateForCreate() {
111 return GetViewDelegate(shower_.profile()); 114 return GetViewDelegate(shower_.profile());
112 } 115 }
113 116
114 void AppListServiceViews::ShowForProfileInternal( 117 void AppListServiceViews::ShowForProfileInternal(
115 Profile* profile, 118 Profile* profile,
116 app_list::AppListModel::State state) { 119 app_list::AppListModel::State state) {
117 DCHECK(profile); 120 DCHECK(profile);
118 121
119 ScopedKeepAlive keep_alive; 122 ScopedKeepAlive keep_alive(&kKeepAliveOptions);
120 123
121 CreateForProfile(profile); 124 CreateForProfile(profile);
122 125
123 if (state != app_list::AppListModel::INVALID_STATE) { 126 if (state != app_list::AppListModel::INVALID_STATE) {
124 app_list::ContentsView* contents_view = 127 app_list::ContentsView* contents_view =
125 shower_.app_list()->app_list_main_view()->contents_view(); 128 shower_.app_list()->app_list_main_view()->contents_view();
126 contents_view->SetActiveState(state, 129 contents_view->SetActiveState(state,
127 shower_.IsAppListVisible() /* animate */); 130 shower_.IsAppListVisible() /* animate */);
128 } 131 }
129 132
130 shower_.ShowForCurrentProfile(); 133 shower_.ShowForCurrentProfile();
131 RecordAppListLaunch(); 134 RecordAppListLaunch();
132 } 135 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698