| Index: chrome/browser/ui/cocoa/app_list/app_list_controller_cocoa.mm
|
| diff --git a/chrome/browser/ui/cocoa/app_list/app_list_controller_cocoa.mm b/chrome/browser/ui/cocoa/app_list/app_list_controller_cocoa.mm
|
| index d568b502f7339226ba9e61a663884a3c5b48646a..80d33f546bf6f6cec03fe52a0d15ecf025f32807 100644
|
| --- a/chrome/browser/ui/cocoa/app_list/app_list_controller_cocoa.mm
|
| +++ b/chrome/browser/ui/cocoa/app_list/app_list_controller_cocoa.mm
|
| @@ -5,10 +5,11 @@
|
| #include "base/bind.h"
|
| #include "base/lazy_instance.h"
|
| #include "base/memory/scoped_nsobject.h"
|
| +#include "base/memory/singleton.h"
|
| #include "base/message_loop.h"
|
| #include "base/time.h"
|
| #include "base/timer.h"
|
| -#include "chrome/browser/ui/app_list/app_list_util.h"
|
| +#include "chrome/browser/ui/app_list/app_list_service_cocoa.h"
|
| #include "ui/app_list/app_list_view_delegate.h"
|
| #import "ui/app_list/cocoa/apps_grid_controller.h"
|
| #import "ui/app_list/cocoa/app_list_window_controller.h"
|
| @@ -21,26 +22,32 @@ namespace {
|
|
|
| // The AppListController class manages global resources needed for the app
|
| // list to operate, and controls when the app list is opened and closed.
|
| -class AppListController {
|
| +class AppListControllerCocoa : public AppListServiceCocoa {
|
| public:
|
| - AppListController() {}
|
| - ~AppListController() {}
|
| + virtual ~AppListControllerCocoa() {}
|
| +
|
| + static AppListControllerCocoa* GetInstance() {
|
| + return Singleton<AppListControllerCocoa>::get();
|
| + }
|
|
|
| void CreateAppList();
|
| - void ShowAppList();
|
| - void DismissAppList();
|
| +
|
| + // AppListService overrides:
|
| + virtual void ShowAppList(Profile* profile) OVERRIDE;
|
| + virtual void DismissAppList() OVERRIDE;
|
|
|
| private:
|
| + AppListControllerCocoa() {}
|
| +
|
| scoped_nsobject<AppListWindowController> window_controller_;
|
| - base::OneShotTimer<AppListController> timer_;
|
| + base::OneShotTimer<AppListControllerCocoa> timer_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(AppListController);
|
| -};
|
| + friend struct DefaultSingletonTraits<AppListControllerCocoa>;
|
|
|
| -base::LazyInstance<AppListController>::Leaky g_app_list_controller =
|
| - LAZY_INSTANCE_INITIALIZER;
|
| + DISALLOW_COPY_AND_ASSIGN(AppListControllerCocoa);
|
| +};
|
|
|
| -void AppListController::CreateAppList() {
|
| +void AppListControllerCocoa::CreateAppList() {
|
| // TODO(tapted): Create our own AppListViewDelegate subtype, and use it here.
|
| scoped_ptr<app_list::AppListViewDelegate> delegate;
|
| scoped_nsobject<AppsGridController> content(
|
| @@ -49,7 +56,7 @@ void AppListController::CreateAppList() {
|
| [[AppListWindowController alloc] initWithGridController:content]);
|
| }
|
|
|
| -void AppListController::ShowAppList() {
|
| +void AppListControllerCocoa::ShowAppList(Profile* profile) {
|
| const int kLifetimeIntervalMS = 1000;
|
|
|
| if (!window_controller_)
|
| @@ -57,11 +64,11 @@ void AppListController::ShowAppList() {
|
|
|
| timer_.Start(FROM_HERE,
|
| base::TimeDelta::FromMilliseconds(kLifetimeIntervalMS), this,
|
| - &AppListController::DismissAppList);
|
| + &AppListControllerCocoa::DismissAppList);
|
| [[window_controller_ window] makeKeyAndOrderFront:nil];
|
| }
|
|
|
| -void AppListController::DismissAppList() {
|
| +void AppListControllerCocoa::DismissAppList() {
|
| if (!window_controller_)
|
| return;
|
|
|
| @@ -71,33 +78,7 @@ void AppListController::DismissAppList() {
|
|
|
| } // namespace
|
|
|
| -
|
| -namespace chrome {
|
| -
|
| -void InitAppList(Profile* profile) {
|
| - // TODO(tapted): AppList warmup code coes here.
|
| -}
|
| -
|
| -void ShowAppList(Profile* profile) {
|
| - g_app_list_controller.Get().ShowAppList();
|
| -}
|
| -
|
| -void NotifyAppListOfBeginExtensionInstall(
|
| - Profile* profile,
|
| - const std::string& extension_id,
|
| - const std::string& extension_name,
|
| - const gfx::ImageSkia& installing_icon) {
|
| -}
|
| -
|
| -void NotifyAppListOfDownloadProgress(
|
| - Profile* profile,
|
| - const std::string& extension_id,
|
| - int percent_downloaded) {
|
| -}
|
| -
|
| -void NotifyAppListOfExtensionInstallFailure(
|
| - Profile* profile,
|
| - const std::string& extension_id) {
|
| +// static
|
| +AppListServiceCocoa* AppListServiceCocoa::GetInstance() {
|
| + return AppListControllerCocoa::GetInstance();
|
| }
|
| -
|
| -} // namespace chrome
|
|
|