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 |
30 // Get the AppListService for the current platform and specified | 44 // Get the AppListService for the current platform and specified |
31 // |desktop_type|. | 45 // |desktop_type|. |
32 static AppListService* Get(chrome::HostDesktopType desktop_type); | 46 static AppListService* Get(chrome::HostDesktopType desktop_type); |
33 | 47 |
34 // Call Init for all AppListService instances on this platform. | 48 // Call Init for all AppListService instances on this platform. |
35 static void InitAll(Profile* initial_profile); | 49 static void InitAll(Profile* initial_profile); |
36 | 50 |
37 static void RegisterPrefs(PrefRegistrySimple* registry); | 51 static void RegisterPrefs(PrefRegistrySimple* registry); |
38 | 52 |
39 static void RecordShowTimings(const CommandLine& command_line); | 53 static void RecordShowTimings(const CommandLine& command_line); |
(...skipping 15 matching lines...) Expand all Loading... |
55 virtual void Show() = 0; | 69 virtual void Show() = 0; |
56 | 70 |
57 // Create the app list UI, and maintain its state, but do not show it. | 71 // Create the app list UI, and maintain its state, but do not show it. |
58 virtual void CreateForProfile(Profile* requested_profile) = 0; | 72 virtual void CreateForProfile(Profile* requested_profile) = 0; |
59 | 73 |
60 // Show the app list for the given profile. If it differs from the profile the | 74 // Show the app list for the given profile. If it differs from the profile the |
61 // app list is currently showing, repopulate the app list and save the new | 75 // app list is currently showing, repopulate the app list and save the new |
62 // profile to local prefs as the default app list profile. | 76 // profile to local prefs as the default app list profile. |
63 virtual void ShowForProfile(Profile* requested_profile) = 0; | 77 virtual void ShowForProfile(Profile* requested_profile) = 0; |
64 | 78 |
| 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 |
65 // Dismiss the app list. | 85 // Dismiss the app list. |
66 virtual void DismissAppList() = 0; | 86 virtual void DismissAppList() = 0; |
67 | 87 |
68 // Get the profile the app list is currently showing. | 88 // Get the profile the app list is currently showing. |
69 virtual Profile* GetCurrentAppListProfile() = 0; | 89 virtual Profile* GetCurrentAppListProfile() = 0; |
70 | 90 |
71 // Returns true if the app list is visible. | 91 // Returns true if the app list is visible. |
72 virtual bool IsAppListVisible() const = 0; | 92 virtual bool IsAppListVisible() const = 0; |
73 | 93 |
74 // Enable the app list. What this does specifically will depend on the host | 94 // Enable the app list. What this does specifically will depend on the host |
75 // operating system and shell. | 95 // operating system and shell. |
76 virtual void EnableAppList(Profile* initial_profile) = 0; | 96 virtual void EnableAppList(Profile* initial_profile, |
| 97 AppListEnableSource enable_source) = 0; |
77 | 98 |
78 // Get the window the app list is in, or NULL if the app list isn't visible. | 99 // Get the window the app list is in, or NULL if the app list isn't visible. |
79 virtual gfx::NativeWindow GetAppListWindow() = 0; | 100 virtual gfx::NativeWindow GetAppListWindow() = 0; |
80 | 101 |
81 // Returns a pointer to the platform specific AppListControllerDelegate. | 102 // Returns a pointer to the platform specific AppListControllerDelegate. |
82 virtual AppListControllerDelegate* GetControllerDelegate() = 0; | 103 virtual AppListControllerDelegate* GetControllerDelegate() = 0; |
83 | 104 |
84 protected: | 105 protected: |
85 AppListService() {} | 106 AppListService() {} |
86 virtual ~AppListService() {} | 107 virtual ~AppListService() {} |
87 | 108 |
88 // Do any once off initialization needed for the app list. | 109 // Do any once off initialization needed for the app list. |
89 virtual void Init(Profile* initial_profile) = 0; | 110 virtual void Init(Profile* initial_profile) = 0; |
90 | 111 |
91 private: | 112 private: |
92 DISALLOW_COPY_AND_ASSIGN(AppListService); | 113 DISALLOW_COPY_AND_ASSIGN(AppListService); |
93 }; | 114 }; |
94 | 115 |
95 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_H_ | 116 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_H_ |
OLD | NEW |