OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_APP_LIST_APP_LIST_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_H_ |
6 #define CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_H_ | 6 #define CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "chrome/browser/ui/host_desktop.h" | 12 #include "chrome/browser/ui/host_desktop.h" |
13 #include "ui/gfx/native_widget_types.h" | 13 #include "ui/gfx/native_widget_types.h" |
14 | 14 |
15 class AppListControllerDelegate; | 15 class AppListControllerDelegate; |
16 class CommandLine; | 16 class CommandLine; |
17 class PrefRegistrySimple; | 17 class PrefRegistrySimple; |
18 class Profile; | 18 class Profile; |
19 | 19 |
20 namespace base { | 20 namespace base { |
21 class FilePath; | 21 class FilePath; |
22 } | 22 } |
23 | 23 |
24 namespace gfx { | 24 namespace gfx { |
25 class ImageSkia; | 25 class ImageSkia; |
26 } | 26 } |
27 | 27 |
28 class AppListService { | 28 class AppListService { |
29 public: | 29 public: |
30 // Source that triggers the app launcher being enabled. This is used for UMA | |
31 // to track discoverability of the app lancher shortcut after install. | |
32 enum AppListEnableSource { | |
33 ENABLE_NOT_RECORDED, // Indicates app launcher not recently enabled. | |
34 ENABLE_FOR_APP_INSTALL, // Triggered by a webstore packaged app install. | |
35 ENABLE_VIA_WEBSTORE_LINK, // Triggered by webstore explicitly via API. | |
36 ENABLE_VIA_COMMAND_LINE, // Triggered by --enable-app-list. | |
37 ENABLE_ON_REINSTALL, // Triggered by Chrome reinstall finding pref. | |
38 ENABLE_SHOWN_UNDISCOVERED, // This overrides a prior ENABLE_FOR_APP_INSTALL | |
39 // when the launcher is auto-shown without | |
40 // being "discovered" beforehand. | |
41 ENABLE_NUM_ENABLE_SOURCES | |
42 }; | |
43 | |
44 // Get the AppListService for the current platform and specified | 30 // Get the AppListService for the current platform and specified |
45 // |desktop_type|. | 31 // |desktop_type|. |
46 static AppListService* Get(chrome::HostDesktopType desktop_type); | 32 static AppListService* Get(chrome::HostDesktopType desktop_type); |
47 | 33 |
48 // Call Init for all AppListService instances on this platform. | 34 // Call Init for all AppListService instances on this platform. |
49 static void InitAll(Profile* initial_profile); | 35 static void InitAll(Profile* initial_profile); |
50 | 36 |
51 static void RegisterPrefs(PrefRegistrySimple* registry); | 37 static void RegisterPrefs(PrefRegistrySimple* registry); |
52 | 38 |
53 static void RecordShowTimings(const CommandLine& command_line); | 39 static void RecordShowTimings(const CommandLine& command_line); |
(...skipping 15 matching lines...) Expand all Loading... |
69 virtual void Show() = 0; | 55 virtual void Show() = 0; |
70 | 56 |
71 // Create the app list UI, and maintain its state, but do not show it. | 57 // Create the app list UI, and maintain its state, but do not show it. |
72 virtual void CreateForProfile(Profile* requested_profile) = 0; | 58 virtual void CreateForProfile(Profile* requested_profile) = 0; |
73 | 59 |
74 // Show the app list for the given profile. If it differs from the profile the | 60 // Show the app list for the given profile. If it differs from the profile the |
75 // app list is currently showing, repopulate the app list and save the new | 61 // app list is currently showing, repopulate the app list and save the new |
76 // profile to local prefs as the default app list profile. | 62 // profile to local prefs as the default app list profile. |
77 virtual void ShowForProfile(Profile* requested_profile) = 0; | 63 virtual void ShowForProfile(Profile* requested_profile) = 0; |
78 | 64 |
79 // Show the app list due to a trigger which was not an explicit user action | |
80 // to show the app list. E.g. the auto-show when installing an app. This | |
81 // permits UMA to distinguish between a user discovering the app list shortcut | |
82 // themselves versus having it shown for them automatically. | |
83 virtual void AutoShowForProfile(Profile* requested_profile) = 0; | |
84 | |
85 // Dismiss the app list. | 65 // Dismiss the app list. |
86 virtual void DismissAppList() = 0; | 66 virtual void DismissAppList() = 0; |
87 | 67 |
88 // Get the profile the app list is currently showing. | 68 // Get the profile the app list is currently showing. |
89 virtual Profile* GetCurrentAppListProfile() = 0; | 69 virtual Profile* GetCurrentAppListProfile() = 0; |
90 | 70 |
91 // Returns true if the app list is visible. | 71 // Returns true if the app list is visible. |
92 virtual bool IsAppListVisible() const = 0; | 72 virtual bool IsAppListVisible() const = 0; |
93 | 73 |
94 // Enable the app list. What this does specifically will depend on the host | 74 // Enable the app list. What this does specifically will depend on the host |
95 // operating system and shell. | 75 // operating system and shell. |
96 virtual void EnableAppList(Profile* initial_profile, | 76 virtual void EnableAppList(Profile* initial_profile) = 0; |
97 AppListEnableSource enable_source) = 0; | |
98 | 77 |
99 // Get the window the app list is in, or NULL if the app list isn't visible. | 78 // Get the window the app list is in, or NULL if the app list isn't visible. |
100 virtual gfx::NativeWindow GetAppListWindow() = 0; | 79 virtual gfx::NativeWindow GetAppListWindow() = 0; |
101 | 80 |
102 // Returns a pointer to the platform specific AppListControllerDelegate. | 81 // Returns a pointer to the platform specific AppListControllerDelegate. |
103 virtual AppListControllerDelegate* GetControllerDelegate() = 0; | 82 virtual AppListControllerDelegate* GetControllerDelegate() = 0; |
104 | 83 |
105 protected: | 84 protected: |
106 AppListService() {} | 85 AppListService() {} |
107 virtual ~AppListService() {} | 86 virtual ~AppListService() {} |
108 | 87 |
109 // Do any once off initialization needed for the app list. | 88 // Do any once off initialization needed for the app list. |
110 virtual void Init(Profile* initial_profile) = 0; | 89 virtual void Init(Profile* initial_profile) = 0; |
111 | 90 |
112 private: | 91 private: |
113 DISALLOW_COPY_AND_ASSIGN(AppListService); | 92 DISALLOW_COPY_AND_ASSIGN(AppListService); |
114 }; | 93 }; |
115 | 94 |
116 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_H_ | 95 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_H_ |
OLD | NEW |