OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_ASH_APP_LIST_APP_LIST_SERVICE_ASH_H_ | 5 #ifndef CHROME_BROWSER_UI_ASH_APP_LIST_APP_LIST_SERVICE_ASH_H_ |
6 #define CHROME_BROWSER_UI_ASH_APP_LIST_APP_LIST_SERVICE_ASH_H_ | 6 #define CHROME_BROWSER_UI_ASH_APP_LIST_APP_LIST_SERVICE_ASH_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "chrome/browser/ui/app_list/app_list_service_impl.h" | 10 #include "chrome/browser/ui/app_list/app_list_service_impl.h" |
11 #include "ui/app_list/app_list_model.h" | 11 #include "ui/app_list/app_list_model.h" |
12 | 12 |
13 class AppListControllerDelegateAsh; | 13 namespace app_list { |
| 14 class AppListShower; |
| 15 class AppListShowerImpl; |
| 16 class AppListShowerDelegateFactory; |
| 17 } |
14 | 18 |
15 namespace base { | 19 namespace base { |
16 template <typename T> struct DefaultSingletonTraits; | 20 template <typename T> struct DefaultSingletonTraits; |
17 } | 21 } |
18 | 22 |
| 23 class AppListControllerDelegateAsh; |
| 24 |
19 // AppListServiceAsh wraps functionality in ChromeLauncherController and the Ash | 25 // AppListServiceAsh wraps functionality in ChromeLauncherController and the Ash |
20 // Shell for showing and hiding the app list on the Ash desktop. | 26 // Shell for showing and hiding the app list on the Ash desktop. |
21 class AppListServiceAsh : public AppListServiceImpl { | 27 class AppListServiceAsh : public AppListServiceImpl { |
22 public: | 28 public: |
23 static AppListServiceAsh* GetInstance(); | 29 static AppListServiceAsh* GetInstance(); |
24 | 30 |
| 31 app_list::AppListShower* GetAppListShower(); |
| 32 |
25 // AppListService overrides: | 33 // AppListService overrides: |
26 void Init(Profile* initial_profile) override; | 34 void Init(Profile* initial_profile) override; |
27 | 35 |
28 // ProfileAttributesStorage::Observer overrides: | 36 // ProfileAttributesStorage::Observer overrides: |
29 // On ChromeOS this should never happen. On other platforms, there is always a | 37 // On ChromeOS this should never happen. On other platforms, there is always a |
30 // Non-ash AppListService that is responsible for handling this. | 38 // Non-ash AppListService that is responsible for handling this. |
31 // TODO(calamity): Ash shouldn't observe the ProfileAttributesStorage at all. | 39 // TODO(calamity): Ash shouldn't observe the ProfileAttributesStorage at all. |
32 void OnProfileWillBeRemoved(const base::FilePath& profile_path) override; | 40 void OnProfileWillBeRemoved(const base::FilePath& profile_path) override; |
33 | 41 |
34 private: | 42 private: |
35 friend struct base::DefaultSingletonTraits<AppListServiceAsh>; | 43 friend struct base::DefaultSingletonTraits<AppListServiceAsh>; |
| 44 friend class AppListServiceAshTestApi; |
36 | 45 |
37 AppListServiceAsh(); | 46 AppListServiceAsh(); |
38 ~AppListServiceAsh() override; | 47 ~AppListServiceAsh() override; |
39 | 48 |
40 // Shows the app list if it isn't already showing and Switches to |state|, | 49 // Shows the app list if it isn't already showing and Switches to |state|, |
41 // unless it is |INVALID_STATE| (in which case, opens on the default state). | 50 // unless it is |INVALID_STATE| (in which case, opens on the default state). |
42 void ShowAndSwitchToState(app_list::AppListModel::State state); | 51 void ShowAndSwitchToState(app_list::AppListModel::State state); |
43 | 52 |
44 // AppListService overrides: | 53 // AppListService overrides: |
45 base::FilePath GetProfilePath(const base::FilePath& user_data_dir) override; | 54 base::FilePath GetProfilePath(const base::FilePath& user_data_dir) override; |
46 void ShowForProfile(Profile* default_profile) override; | 55 void ShowForProfile(Profile* default_profile) override; |
47 void ShowForAppInstall(Profile* profile, | 56 void ShowForAppInstall(Profile* profile, |
48 const std::string& extension_id, | 57 const std::string& extension_id, |
49 bool start_discovery_tracking) override; | 58 bool start_discovery_tracking) override; |
50 void ShowForCustomLauncherPage(Profile* profile) override; | 59 void ShowForCustomLauncherPage(Profile* profile) override; |
51 void HideCustomLauncherPage() override; | 60 void HideCustomLauncherPage() override; |
52 bool IsAppListVisible() const override; | 61 bool IsAppListVisible() const override; |
53 void DismissAppList() override; | 62 void DismissAppList() override; |
54 void EnableAppList(Profile* initial_profile, | 63 void EnableAppList(Profile* initial_profile, |
55 AppListEnableSource enable_source) override; | 64 AppListEnableSource enable_source) override; |
56 gfx::NativeWindow GetAppListWindow() override; | 65 gfx::NativeWindow GetAppListWindow() override; |
57 Profile* GetCurrentAppListProfile() override; | 66 Profile* GetCurrentAppListProfile() override; |
58 AppListControllerDelegate* GetControllerDelegate() override; | 67 AppListControllerDelegate* GetControllerDelegate() override; |
59 | 68 |
60 // ApplistServiceImpl overrides: | 69 // ApplistServiceImpl overrides: |
61 void CreateForProfile(Profile* default_profile) override; | 70 void CreateForProfile(Profile* default_profile) override; |
62 void DestroyAppList() override; | 71 void DestroyAppList() override; |
63 | 72 |
| 73 scoped_ptr<app_list::AppListShowerDelegateFactory> shower_delegate_factory_; |
| 74 scoped_ptr<app_list::AppListShowerImpl> app_list_shower_; |
64 scoped_ptr<AppListControllerDelegateAsh> controller_delegate_; | 75 scoped_ptr<AppListControllerDelegateAsh> controller_delegate_; |
65 | 76 |
66 DISALLOW_COPY_AND_ASSIGN(AppListServiceAsh); | 77 DISALLOW_COPY_AND_ASSIGN(AppListServiceAsh); |
67 }; | 78 }; |
68 | 79 |
69 #endif // CHROME_BROWSER_UI_ASH_APP_LIST_APP_LIST_SERVICE_ASH_H_ | 80 #endif // CHROME_BROWSER_UI_ASH_APP_LIST_APP_LIST_SERVICE_ASH_H_ |
OLD | NEW |