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