Chromium Code Reviews| Index: chrome/browser/ui/ash/app_list/app_list_service_ash.cc |
| diff --git a/chrome/browser/ui/ash/app_list/app_list_service_ash.cc b/chrome/browser/ui/ash/app_list/app_list_service_ash.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ef449341854a720b9ec9f3a7fbfb0cb006c30aad |
| --- /dev/null |
| +++ b/chrome/browser/ui/ash/app_list/app_list_service_ash.cc |
| @@ -0,0 +1,68 @@ |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/ui/app_list/app_list_service_ash.h" |
| + |
| +#include "ash/shell.h" |
| +#include "base/files/file_path.h" |
| +#include "base/memory/singleton.h" |
| +#include "chrome/browser/profiles/profile.h" |
| +#include "chrome/browser/ui/app_list/app_list_service.h" |
| +#include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" |
| + |
| +namespace { |
| + |
| +class AppListServiceAsh : public AppListService { |
| + public: |
| + static AppListServiceAsh* GetInstance() { |
| + return Singleton<AppListServiceAsh, |
| + LeakySingletonTraits<AppListServiceAsh> >::get(); |
| + } |
| + |
| + private: |
| + friend struct DefaultSingletonTraits<AppListServiceAsh>; |
| + |
| + AppListServiceAsh() {} |
| + |
| + // AppListService overrides: |
| + virtual base::FilePath GetAppListProfilePath( |
| + const base::FilePath& user_data_dir) OVERRIDE; |
| + virtual void ShowAppList(Profile* default_profile) OVERRIDE; |
| + virtual bool IsAppListVisible() const OVERRIDE; |
| + virtual void DismissAppList() OVERRIDE; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(AppListServiceAsh); |
| +}; |
| + |
| +base::FilePath AppListServiceAsh::GetAppListProfilePath( |
| + const base::FilePath& user_data_dir) { |
| + return ChromeLauncherController::instance()->profile()->GetPath(); |
|
tapted
2013/02/25 07:18:05
this is new! I think it's right. It's used, e.g.,
|
| +} |
| + |
| +void AppListServiceAsh::ShowAppList(Profile* default_profile) { |
| + // This may not work correctly if the profile passed in is different from the |
| + // one the ash Shell is currently using. |
| + // TODO(ananta): Handle profile changes correctly when !defined(OS_CHROMEOS). |
|
tapted
2013/02/25 07:18:05
After encountering chrome_launcher_controller.h, I
|
| + if (!IsAppListVisible()) |
| + ash::Shell::GetInstance()->ToggleAppList(NULL); |
| +} |
| + |
| +bool AppListServiceAsh::IsAppListVisible() const { |
| + return ash::Shell::GetInstance()->GetAppListTargetVisibility(); |
| +} |
| + |
| +void AppListServiceAsh::DismissAppList() { |
| + if (IsAppListVisible()) |
| + ash::Shell::GetInstance()->ToggleAppList(NULL); |
| +} |
| + |
| +} // namespace |
| + |
| +namespace chrome { |
| + |
| +AppListService* GetAppListServiceAsh() { |
| + return AppListServiceAsh::GetInstance(); |
| +} |
| + |
| +} // namespace chrome |