1 // Copyright 2013 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/ash/app_list/app_list_service_ash.h"
8 #include "base/files/file_path.h"
9 #include "base/memory/singleton.h"
10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/ui/ash/app_list/app_list_controller_ash.h"
12 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
15 AppListServiceAsh* AppListServiceAsh::GetInstance() {
16 return Singleton<AppListServiceAsh,
17 LeakySingletonTraits<AppListServiceAsh> >::get();
20 AppListServiceAsh::AppListServiceAsh()
21 : controller_delegate_(new AppListControllerDelegateAsh()) {
24 AppListServiceAsh::~AppListServiceAsh() {
27 base::FilePath AppListServiceAsh::GetProfilePath(
28 const base::FilePath& user_data_dir) {
29 return ChromeLauncherController::instance()->profile()->GetPath();
32 void AppListServiceAsh::ShowForProfile(Profile* default_profile) {
33 // This may not work correctly if the profile passed in is different from the
34 // one the ash Shell is currently using.
35 // TODO(ananta): Handle profile changes correctly when !defined(OS_CHROMEOS).
36 ash::Shell::GetInstance()->ShowAppList(NULL);
39 bool AppListServiceAsh::IsAppListVisible() const {
40 return ash::Shell::GetInstance()->GetAppListTargetVisibility();
43 void AppListServiceAsh::DismissAppList() {
44 ash::Shell::GetInstance()->DismissAppList();
47 void AppListServiceAsh::EnableAppList(Profile* initial_profile,
48 AppListEnableSource enable_source) {}
50 gfx::NativeWindow AppListServiceAsh::GetAppListWindow() {
51 if (ash::Shell::HasInstance())
52 return ash::Shell::GetInstance()->GetAppListWindow();
56 Profile* AppListServiceAsh::GetCurrentAppListProfile() {
57 return ChromeLauncherController::instance()->profile();
60 AppListControllerDelegate* AppListServiceAsh::GetControllerDelegate() {
61 return controller_delegate_.get();
64 void AppListServiceAsh::CreateForProfile(Profile* default_profile) {
67 void AppListServiceAsh::DestroyAppList() {
68 // On Ash, the app list is torn down whenever it is dismissed, so just ensure
69 // that it is dismissed.
73 // Windows and Linux Ash additionally supports a native UI. See
74 // app_list_service_{win,linux}.cc.
75 #if defined(OS_CHROMEOS)
78 AppListService* AppListService::Get(chrome::HostDesktopType desktop_type) {
79 return AppListServiceAsh::GetInstance();
83 void AppListService::InitAll(Profile* initial_profile) {
84 AppListServiceAsh::GetInstance()->Init(initial_profile);
87 #endif // !defined(OS_WIN)