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