This source file includes following definitions.
- GetInstance
- GetProfilePath
- CreateForProfile
- ShowForProfile
- IsAppListVisible
- DismissAppList
- EnableAppList
- GetAppListWindow
- GetCurrentAppListProfile
- GetControllerDelegate
- GetAppListServiceAsh
- Get
- InitAll
#include "chrome/browser/ui/app_list/app_list_service_ash.h"
#include "ash/shell.h"
#include "base/files/file_path.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/singleton.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/app_list/app_list_service_impl.h"
#include "chrome/browser/ui/ash/app_list/app_list_controller_ash.h"
#include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
namespace {
class AppListServiceAsh : public AppListServiceImpl {
public:
static AppListServiceAsh* GetInstance() {
return Singleton<AppListServiceAsh,
LeakySingletonTraits<AppListServiceAsh> >::get();
}
private:
friend struct DefaultSingletonTraits<AppListServiceAsh>;
AppListServiceAsh();
virtual ~AppListServiceAsh();
virtual base::FilePath GetProfilePath(
const base::FilePath& user_data_dir) OVERRIDE;
virtual void CreateForProfile(Profile* default_profile) OVERRIDE;
virtual void ShowForProfile(Profile* default_profile) OVERRIDE;
virtual bool IsAppListVisible() const OVERRIDE;
virtual void DismissAppList() OVERRIDE;
virtual void EnableAppList(Profile* initial_profile,
AppListEnableSource enable_source) OVERRIDE;
virtual gfx::NativeWindow GetAppListWindow() OVERRIDE;
virtual Profile* GetCurrentAppListProfile() OVERRIDE;
virtual AppListControllerDelegate* GetControllerDelegate() OVERRIDE;
scoped_ptr<AppListControllerDelegateAsh> controller_delegate_;
DISALLOW_COPY_AND_ASSIGN(AppListServiceAsh);
};
AppListServiceAsh::AppListServiceAsh()
: controller_delegate_(new AppListControllerDelegateAsh()) {
}
AppListServiceAsh::~AppListServiceAsh() {
}
base::FilePath AppListServiceAsh::GetProfilePath(
const base::FilePath& user_data_dir) {
return ChromeLauncherController::instance()->profile()->GetPath();
}
void AppListServiceAsh::CreateForProfile(Profile* default_profile) {}
void AppListServiceAsh::ShowForProfile(Profile* default_profile) {
if (!ash::Shell::GetInstance()->GetAppListTargetVisibility())
ash::Shell::GetInstance()->ToggleAppList(NULL);
}
bool AppListServiceAsh::IsAppListVisible() const {
return ash::Shell::GetInstance()->GetAppListTargetVisibility();
}
void AppListServiceAsh::DismissAppList() {
if (IsAppListVisible())
ash::Shell::GetInstance()->ToggleAppList(NULL);
}
void AppListServiceAsh::EnableAppList(Profile* initial_profile,
AppListEnableSource enable_source) {}
gfx::NativeWindow AppListServiceAsh::GetAppListWindow() {
if (ash::Shell::HasInstance())
return ash::Shell::GetInstance()->GetAppListWindow();
return NULL;
}
Profile* AppListServiceAsh::GetCurrentAppListProfile() {
return ChromeLauncherController::instance()->profile();
}
AppListControllerDelegate* AppListServiceAsh::GetControllerDelegate() {
return controller_delegate_.get();
}
}
namespace chrome {
AppListService* GetAppListServiceAsh() {
return AppListServiceAsh::GetInstance();
}
}
#if !defined(OS_WIN)
AppListService* AppListService::Get(chrome::HostDesktopType desktop_type) {
return chrome::GetAppListServiceAsh();
}
void AppListService::InitAll(Profile* initial_profile) {
AppListServiceAsh::GetInstance()->Init(initial_profile);
}
#endif