Chromium Code Reviews| 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_ALREADY_ENABLED, // Enabled a second time. This overrides a prior | |
| 39 // ENABLE_FOR_APP_INSTALL since it will auto-show | |
| 40 // the app launcher. | |
| 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. For UMA. | |
|
benwells
2014/02/09 21:08:07
Nit: I think I know what the 'for uma' sentence me
tapted
2014/02/10 02:54:29
Done. (Expanded - I thought it could still be hard
| |
| 81 virtual void AutoShowForProfile(Profile* requested_profile) = 0; | |
| 82 | |
| 65 // Dismiss the app list. | 83 // Dismiss the app list. |
| 66 virtual void DismissAppList() = 0; | 84 virtual void DismissAppList() = 0; |
| 67 | 85 |
| 68 // Get the profile the app list is currently showing. | 86 // Get the profile the app list is currently showing. |
| 69 virtual Profile* GetCurrentAppListProfile() = 0; | 87 virtual Profile* GetCurrentAppListProfile() = 0; |
| 70 | 88 |
| 71 // Returns true if the app list is visible. | 89 // Returns true if the app list is visible. |
| 72 virtual bool IsAppListVisible() const = 0; | 90 virtual bool IsAppListVisible() const = 0; |
| 73 | 91 |
| 74 // Enable the app list. What this does specifically will depend on the host | 92 // Enable the app list. What this does specifically will depend on the host |
| 75 // operating system and shell. | 93 // operating system and shell. |
| 76 virtual void EnableAppList(Profile* initial_profile) = 0; | 94 virtual void EnableAppList(Profile* initial_profile, |
| 95 AppListEnableSource enable_source) = 0; | |
| 77 | 96 |
| 78 // Get the window the app list is in, or NULL if the app list isn't visible. | 97 // Get the window the app list is in, or NULL if the app list isn't visible. |
| 79 virtual gfx::NativeWindow GetAppListWindow() = 0; | 98 virtual gfx::NativeWindow GetAppListWindow() = 0; |
| 80 | 99 |
| 81 // Returns a pointer to the platform specific AppListControllerDelegate. | 100 // Returns a pointer to the platform specific AppListControllerDelegate. |
| 82 virtual AppListControllerDelegate* GetControllerDelegate() = 0; | 101 virtual AppListControllerDelegate* GetControllerDelegate() = 0; |
| 83 | 102 |
| 84 protected: | 103 protected: |
| 85 AppListService() {} | 104 AppListService() {} |
| 86 virtual ~AppListService() {} | 105 virtual ~AppListService() {} |
| 87 | 106 |
| 88 // Do any once off initialization needed for the app list. | 107 // Do any once off initialization needed for the app list. |
| 89 virtual void Init(Profile* initial_profile) = 0; | 108 virtual void Init(Profile* initial_profile) = 0; |
| 90 | 109 |
| 91 private: | 110 private: |
| 92 DISALLOW_COPY_AND_ASSIGN(AppListService); | 111 DISALLOW_COPY_AND_ASSIGN(AppListService); |
| 93 }; | 112 }; |
| 94 | 113 |
| 95 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_H_ | 114 #endif // CHROME_BROWSER_UI_APP_LIST_APP_LIST_SERVICE_H_ |
| OLD | NEW |