1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef ASH_SHELL_DELEGATE_H_
6 #define ASH_SHELL_DELEGATE_H_
10 #include "ash/ash_export.h"
11 #include "ash/shell.h"
12 #include "base/callback.h"
13 #include "base/strings/string16.h"
16 class AppListViewDelegate;
23 class UserActionClient;
36 class KeyboardControllerProxy;
41 class CapsLockDelegate;
42 class LauncherDelegate;
46 class NewWindowDelegate;
47 class RootWindowHostFactory;
48 class AccessibilityDelegate;
49 class SessionStateDelegate;
50 class SystemTrayDelegate;
51 class UserWallpaperDelegate;
53 enum UserMetricsAction {
54 UMA_ACCEL_KEYBOARD_BRIGHTNESS_DOWN_F6,
55 UMA_ACCEL_KEYBOARD_BRIGHTNESS_UP_F7,
56 UMA_ACCEL_LOCK_SCREEN_L,
57 UMA_ACCEL_LOCK_SCREEN_LOCK_BUTTON,
58 UMA_ACCEL_LOCK_SCREEN_POWER_BUTTON,
59 UMA_ACCEL_FULLSCREEN_F4,
60 UMA_ACCEL_MAXIMIZE_RESTORE_F4,
62 UMA_ACCEL_NEXTWINDOW_F5,
63 UMA_ACCEL_NEXTWINDOW_TAB,
64 UMA_ACCEL_OVERVIEW_F5,
65 UMA_ACCEL_PREVWINDOW_F5,
66 UMA_ACCEL_PREVWINDOW_TAB,
67 UMA_ACCEL_EXIT_FIRST_Q,
68 UMA_ACCEL_EXIT_SECOND_Q,
69 UMA_ACCEL_SEARCH_LWIN,
70 UMA_ACCEL_SHUT_DOWN_POWER_BUTTON,
71 UMA_CLOSE_THROUGH_CONTEXT_MENU,
73 UMA_LAUNCHER_CLICK_ON_APP,
74 UMA_LAUNCHER_CLICK_ON_APPLIST_BUTTON,
77 UMA_TOGGLE_MAXIMIZE_CAPTION_CLICK,
78 UMA_TOGGLE_MAXIMIZE_CAPTION_GESTURE,
79 UMA_TOUCHPAD_GESTURE_OVERVIEW,
80 UMA_TOUCHSCREEN_TAP_DOWN,
84 UMA_WINDOW_APP_CLOSE_BUTTON_CLICK,
85 UMA_WINDOW_CLOSE_BUTTON_CLICK,
86 UMA_WINDOW_MAXIMIZE_BUTTON_CLICK_EXIT_FULLSCREEN,
87 UMA_WINDOW_MAXIMIZE_BUTTON_CLICK_MAXIMIZE,
88 UMA_WINDOW_MAXIMIZE_BUTTON_CLICK_MINIMIZE,
89 UMA_WINDOW_MAXIMIZE_BUTTON_CLICK_RESTORE,
90 UMA_WINDOW_MAXIMIZE_BUTTON_MAXIMIZE,
91 UMA_WINDOW_MAXIMIZE_BUTTON_MAXIMIZE_LEFT,
92 UMA_WINDOW_MAXIMIZE_BUTTON_MAXIMIZE_RIGHT,
93 UMA_WINDOW_MAXIMIZE_BUTTON_MINIMIZE,
94 UMA_WINDOW_MAXIMIZE_BUTTON_RESTORE,
95 UMA_WINDOW_MAXIMIZE_BUTTON_SHOW_BUBBLE,
97 // Thumbnail sized overview of windows triggered. This is a subset of
98 // UMA_WINDOW_SELECTION triggered by lingering during alt+tab cycles or
99 // pressing the overview key.
102 // Window selection started by beginning an alt+tab cycle or pressing the
103 // overview key. This does not count each step through an alt+tab cycle.
104 UMA_WINDOW_SELECTION,
107 // Delegate of the Shell.
108 class ASH_EXPORT ShellDelegate {
110 // The Shell owns the delegate.
111 virtual ~ShellDelegate() {}
113 // Returns true if this is the first time that the shell has been run after
114 // the system has booted. false is returned after the shell has been
115 // restarted, typically due to logging in as a guest or logging out.
116 virtual bool IsFirstRunAfterBoot() const = 0;
118 // Returns true if multi-profiles feature is enabled.
119 virtual bool IsMultiProfilesEnabled() const = 0;
121 // Returns true if incognito mode is allowed for the user.
122 // Incognito windows are restricted for supervised users.
123 virtual bool IsIncognitoAllowed() const = 0;
125 // Returns true if we're running in forced app mode.
126 virtual bool IsRunningInForcedAppMode() const = 0;
128 // Called before processing |Shell::Init()| so that the delegate
129 // can perform tasks necessary before the shell is initialized.
130 virtual void PreInit() = 0;
132 // Shuts down the environment.
133 virtual void Shutdown() = 0;
135 // Invoked when the user uses Ctrl-Shift-Q to close chrome.
136 virtual void Exit() = 0;
138 // Create a shell-specific keyboard::KeyboardControllerProxy
139 virtual keyboard::KeyboardControllerProxy*
140 CreateKeyboardControllerProxy() = 0;
142 // Get the current browser context. This will get us the current profile.
143 virtual content::BrowserContext* GetCurrentBrowserContext() = 0;
145 // Invoked to create an AppListViewDelegate. Shell takes the ownership of
146 // the created delegate.
147 virtual app_list::AppListViewDelegate* CreateAppListViewDelegate() = 0;
149 // Creates a new LauncherDelegate. Shell takes ownership of the returned
151 virtual LauncherDelegate* CreateLauncherDelegate(
152 ash::LauncherModel* model) = 0;
154 // Creates a system-tray delegate. Shell takes ownership of the delegate.
155 virtual SystemTrayDelegate* CreateSystemTrayDelegate() = 0;
157 // Creates a user wallpaper delegate. Shell takes ownership of the delegate.
158 virtual UserWallpaperDelegate* CreateUserWallpaperDelegate() = 0;
160 // Creates a caps lock delegate. Shell takes ownership of the delegate.
161 virtual CapsLockDelegate* CreateCapsLockDelegate() = 0;
163 // Creates a session state delegate. Shell takes ownership of the delegate.
164 virtual SessionStateDelegate* CreateSessionStateDelegate() = 0;
166 // Creates a accessibility delegate. Shell takes ownership of the delegate.
167 virtual AccessibilityDelegate* CreateAccessibilityDelegate() = 0;
169 // Creates an application delegate. Shell takes ownership of the delegate.
170 virtual NewWindowDelegate* CreateNewWindowDelegate() = 0;
172 // Creates a media delegate. Shell takes ownership of the delegate.
173 virtual MediaDelegate* CreateMediaDelegate() = 0;
175 // Creates a user action client. Shell takes ownership of the object.
176 virtual aura::client::UserActionClient* CreateUserActionClient() = 0;
178 // Records that the user performed an action.
179 virtual void RecordUserMetricsAction(UserMetricsAction action) = 0;
181 // Creates a menu model of the context for the |root_window|.
182 virtual ui::MenuModel* CreateContextMenu(aura::Window* root_window) = 0;
184 // Creates a root window host factory. Shell takes ownership of the returned
186 virtual RootWindowHostFactory* CreateRootWindowHostFactory() = 0;
188 // Get the product name.
189 virtual base::string16 GetProductName() const = 0;
194 #endif // ASH_SHELL_DELEGATE_H_