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
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/app_list/app_list_service_views.h"
7 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h"
8 #include "chrome/browser/ui/app_list/scoped_keep_alive.h"
10 AppListServiceViews::AppListServiceViews(
11 scoped_ptr
<AppListControllerDelegate
> controller_delegate
)
14 controller_delegate_(controller_delegate
.Pass()) {
17 AppListServiceViews::~AppListServiceViews() {}
19 void AppListServiceViews::OnViewBeingDestroyed() {
21 shower_
.HandleViewBeingDestroyed();
24 void AppListServiceViews::Init(Profile
* initial_profile
) {
25 PerformStartupChecks(initial_profile
);
28 void AppListServiceViews::CreateForProfile(Profile
* requested_profile
) {
29 shower_
.CreateViewForProfile(requested_profile
);
32 void AppListServiceViews::ShowForProfile(Profile
* requested_profile
) {
33 DCHECK(requested_profile
);
34 if (requested_profile
->IsManaged())
37 ScopedKeepAlive keep_alive
;
39 InvalidatePendingProfileLoads();
40 SetProfilePath(requested_profile
->GetPath());
41 shower_
.ShowForProfile(requested_profile
);
42 RecordAppListLaunch();
45 void AppListServiceViews::DismissAppList() {
49 shower_
.DismissAppList();
52 bool AppListServiceViews::IsAppListVisible() const {
53 return shower_
.IsAppListVisible();
56 gfx::NativeWindow
AppListServiceViews::GetAppListWindow() {
57 return shower_
.GetWindow();
60 Profile
* AppListServiceViews::GetCurrentAppListProfile() {
61 return shower_
.profile();
64 AppListControllerDelegate
* AppListServiceViews::GetControllerDelegate() {
65 return controller_delegate_
.get();
68 AppListControllerDelegate
*
69 AppListServiceViews::GetControllerDelegateForCreate() {
70 return controller_delegate_
.get();