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/magnifier/magnifier_constants.h"
12 #include "ash/shell.h"
13 #include "base/callback.h"
14 #include "base/strings/string16.h"
17 class AppListViewDelegate
;
24 class UserActionClient
;
37 class KeyboardControllerProxy
;
42 class CapsLockDelegate
;
43 class LauncherDelegate
;
46 class RootWindowHostFactory
;
47 class SessionStateDelegate
;
48 class SystemTrayDelegate
;
49 class UserWallpaperDelegate
;
51 enum UserMetricsAction
{
52 UMA_ACCEL_KEYBOARD_BRIGHTNESS_DOWN_F6
,
53 UMA_ACCEL_KEYBOARD_BRIGHTNESS_UP_F7
,
54 UMA_ACCEL_LOCK_SCREEN_L
,
55 UMA_ACCEL_LOCK_SCREEN_LOCK_BUTTON
,
56 UMA_ACCEL_LOCK_SCREEN_POWER_BUTTON
,
57 UMA_ACCEL_FULLSCREEN_F4
,
58 UMA_ACCEL_MAXIMIZE_RESTORE_F4
,
60 UMA_ACCEL_NEXTWINDOW_F5
,
61 UMA_ACCEL_NEXTWINDOW_TAB
,
62 UMA_ACCEL_OVERVIEW_F5
,
63 UMA_ACCEL_PREVWINDOW_F5
,
64 UMA_ACCEL_PREVWINDOW_TAB
,
65 UMA_ACCEL_EXIT_FIRST_Q
,
66 UMA_ACCEL_EXIT_SECOND_Q
,
67 UMA_ACCEL_SEARCH_LWIN
,
68 UMA_ACCEL_SHUT_DOWN_POWER_BUTTON
,
69 UMA_CLOSE_THROUGH_CONTEXT_MENU
,
70 UMA_LAUNCHER_CLICK_ON_APP
,
71 UMA_LAUNCHER_CLICK_ON_APPLIST_BUTTON
,
74 UMA_TOGGLE_MAXIMIZE_CAPTION_CLICK
,
75 UMA_TOGGLE_MAXIMIZE_CAPTION_GESTURE
,
76 UMA_TOUCHSCREEN_TAP_DOWN
,
80 UMA_WINDOW_APP_CLOSE_BUTTON_CLICK
,
81 UMA_WINDOW_CLOSE_BUTTON_CLICK
,
82 UMA_WINDOW_MAXIMIZE_BUTTON_CLICK_EXIT_FULLSCREEN
,
83 UMA_WINDOW_MAXIMIZE_BUTTON_CLICK_MAXIMIZE
,
84 UMA_WINDOW_MAXIMIZE_BUTTON_CLICK_MINIMIZE
,
85 UMA_WINDOW_MAXIMIZE_BUTTON_CLICK_RESTORE
,
86 UMA_WINDOW_MAXIMIZE_BUTTON_MAXIMIZE
,
87 UMA_WINDOW_MAXIMIZE_BUTTON_MAXIMIZE_LEFT
,
88 UMA_WINDOW_MAXIMIZE_BUTTON_MAXIMIZE_RIGHT
,
89 UMA_WINDOW_MAXIMIZE_BUTTON_MINIMIZE
,
90 UMA_WINDOW_MAXIMIZE_BUTTON_RESTORE
,
91 UMA_WINDOW_MAXIMIZE_BUTTON_SHOW_BUBBLE
,
93 // Thumbnail sized overview of windows triggered. This is a subset of
94 // UMA_WINDOW_SELECTION triggered by lingering during alt+tab cycles or
95 // pressing the overview key.
98 // Window selection started by beginning an alt+tab cycle or pressing the
99 // overview key. This does not count each step through an alt+tab cycle.
100 UMA_WINDOW_SELECTION
,
103 enum AccessibilityNotificationVisibility
{
104 A11Y_NOTIFICATION_NONE
,
105 A11Y_NOTIFICATION_SHOW
,
108 // Delegate of the Shell.
109 class ASH_EXPORT ShellDelegate
{
111 // The Shell owns the delegate.
112 virtual ~ShellDelegate() {}
114 // Returns true if this is the first time that the shell has been run after
115 // the system has booted. false is returned after the shell has been
116 // restarted, typically due to logging in as a guest or logging out.
117 virtual bool IsFirstRunAfterBoot() const = 0;
119 // Returns true if multi-profiles feature is enabled.
120 virtual bool IsMultiProfilesEnabled() const = 0;
122 // Returns true if we're running in forced app mode.
123 virtual bool IsRunningInForcedAppMode() const = 0;
125 // Called before processing |Shell::Init()| so that the delegate
126 // can perform tasks necessary before the shell is initialized.
127 virtual void PreInit() = 0;
129 // Shuts down the environment.
130 virtual void Shutdown() = 0;
132 // Invoked when the user uses Ctrl-Shift-Q to close chrome.
133 virtual void Exit() = 0;
135 // Invoked when the user uses Ctrl+T to open a new tab.
136 virtual void NewTab() = 0;
138 // Invoked when the user uses Ctrl-N or Ctrl-Shift-N to open a new window.
139 virtual void NewWindow(bool incognito
) = 0;
141 // Invoked when the user uses Shift+F4 to toggle the window fullscreen state.
142 virtual void ToggleFullscreen() = 0;
144 // Invoked when the user uses F4 to toggle window maximized state.
145 virtual void ToggleMaximized() = 0;
147 // Invoked when an accelerator is used to open the file manager.
148 virtual void OpenFileManager(bool as_dialog
) = 0;
150 // Invoked when the user opens Crosh.
151 virtual void OpenCrosh() = 0;
153 // Invoked when the user uses Shift+Ctrl+T to restore the closed tab.
154 virtual void RestoreTab() = 0;
156 // Shows the keyboard shortcut overlay.
157 virtual void ShowKeyboardOverlay() = 0;
159 // Create a shell-specific keyboard::KeyboardControllerProxy
160 virtual keyboard::KeyboardControllerProxy
*
161 CreateKeyboardControllerProxy() = 0;
163 // Shows the task manager window.
164 virtual void ShowTaskManager() = 0;
166 // Get the current browser context. This will get us the current profile.
167 virtual content::BrowserContext
* GetCurrentBrowserContext() = 0;
169 // Invoked to toggle spoken feedback for accessibility
170 virtual void ToggleSpokenFeedback(
171 AccessibilityNotificationVisibility notify
) = 0;
173 // Returns true if spoken feedback is enabled.
174 virtual bool IsSpokenFeedbackEnabled() const = 0;
176 // Invoked to toggle high contrast for accessibility.
177 virtual void ToggleHighContrast() = 0;
179 // Returns true if high contrast mode is enabled.
180 virtual bool IsHighContrastEnabled() const = 0;
182 // Invoked to enable the screen magnifier.
183 virtual void SetMagnifierEnabled(bool enabled
) = 0;
185 // Invoked to change the type of the screen magnifier.
186 virtual void SetMagnifierType(MagnifierType type
) = 0;
188 // Returns if the screen magnifier is enabled or not.
189 virtual bool IsMagnifierEnabled() const = 0;
191 // Returns the current screen magnifier mode.
192 virtual MagnifierType
GetMagnifierType() const = 0;
194 // Invoked to enable Large Cursor.
195 virtual void SetLargeCursorEnabled(bool enabled
) = 0;
197 // Returns if Large Cursor is enabled or not.
198 virtual bool IsLargeCursorEnabled() const = 0;
200 // Returns true if the user want to show accesibility menu even when all the
201 // accessibility features are disabled.
202 virtual bool ShouldAlwaysShowAccessibilityMenu() const = 0;
204 // Cancel all current and queued speech immediately.
205 virtual void SilenceSpokenFeedback() const = 0;
207 // Invoked to create an AppListViewDelegate. Shell takes the ownership of
208 // the created delegate.
209 virtual app_list::AppListViewDelegate
* CreateAppListViewDelegate() = 0;
211 // Creates a new LauncherDelegate. Shell takes ownership of the returned
213 virtual LauncherDelegate
* CreateLauncherDelegate(
214 ash::LauncherModel
* model
) = 0;
216 // Creates a system-tray delegate. Shell takes ownership of the delegate.
217 virtual SystemTrayDelegate
* CreateSystemTrayDelegate() = 0;
219 // Creates a user wallpaper delegate. Shell takes ownership of the delegate.
220 virtual UserWallpaperDelegate
* CreateUserWallpaperDelegate() = 0;
222 // Creates a caps lock delegate. Shell takes ownership of the delegate.
223 virtual CapsLockDelegate
* CreateCapsLockDelegate() = 0;
225 // Creates a session state delegate. Shell takes ownership of the delegate.
226 virtual SessionStateDelegate
* CreateSessionStateDelegate() = 0;
228 // Creates a user action client. Shell takes ownership of the object.
229 virtual aura::client::UserActionClient
* CreateUserActionClient() = 0;
231 // Opens the feedback page for "Report Issue".
232 virtual void OpenFeedbackPage() = 0;
234 // Records that the user performed an action.
235 virtual void RecordUserMetricsAction(UserMetricsAction action
) = 0;
237 // Handles the Next Track Media shortcut key.
238 virtual void HandleMediaNextTrack() = 0;
240 // Handles the Play/Pause Toggle Media shortcut key.
241 virtual void HandleMediaPlayPause() = 0;
243 // Handles the Previous Track Media shortcut key.
244 virtual void HandleMediaPrevTrack() = 0;
246 // Saves the zoom scale of the full screen magnifier.
247 virtual void SaveScreenMagnifierScale(double scale
) = 0;
249 // Gets a saved value of the zoom scale of full screen magnifier. If a value
250 // is not saved, return a negative value.
251 virtual double GetSavedScreenMagnifierScale() = 0;
253 // Creates a menu model of the context for the |root_window|.
254 virtual ui::MenuModel
* CreateContextMenu(aura::RootWindow
* root_window
) = 0;
256 // Creates a root window host factory. Shell takes ownership of the returned
258 virtual RootWindowHostFactory
* CreateRootWindowHostFactory() = 0;
260 // Get the product name.
261 virtual base::string16
GetProductName() const = 0;
266 #endif // ASH_SHELL_DELEGATE_H_