Chromium Code Reviews| 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..95e6619882bcfe23920b0ee6f96e35fa1c1bde49 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,12 @@ |
| #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.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 +23,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 AppListService { |
| 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 +57,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 +65,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 +79,11 @@ void AppListController::DismissAppList() { |
| } // namespace |
| - |
| namespace chrome { |
| -void InitAppList(Profile* profile) { |
| - // TODO(tapted): AppList warmup code coes here. |
| +// static |
|
tapted
2013/02/20 12:03:43
hey tapted: remove this line. Thanks. - tapted.
tapted
2013/02/25 07:09:21
Done. Thanks, tapted.
|
| +AppListService* GetAppListServiceCocoa() { |
| + return AppListControllerCocoa::GetInstance(); |
| } |
| -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) { |
| -} |
| - |
| -} // namespace chrome |