Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 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. |
| 4 | |
| 5 | #ifndef ASH_SHELL_DELEGATE_H_ |
| 6 | #define ASH_SHELL_DELEGATE_H_ |
| 7 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 8 | #include <string> |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 9 | |
| 10 | #include "ash/ash_export.h" |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 11 | #include "ash/magnifier/magnifier_constants.h" |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 12 | #include "ash/shell.h" |
| 13 | #include "base/callback.h" |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 14 | #include "base/strings/string16.h" |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 15 | |
| 16 | namespace app_list { |
| 17 | class AppListViewDelegate; |
| 18 | } |
| 19 | |
| 20 | namespace aura { |
| 21 | class RootWindow; |
| 22 | class Window; |
| 23 | namespace client { |
| 24 | class UserActionClient; |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | namespace ui { |
| 29 | class MenuModel; |
| 30 | } |
| 31 | |
| 32 | namespace views { |
| 33 | class Widget; |
| 34 | } |
| 35 | |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 36 | namespace keyboard { |
| 37 | class KeyboardControllerProxy; |
| 38 | } |
| 39 | |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 40 | namespace ash { |
| 41 | |
| 42 | class CapsLockDelegate; |
| 43 | class LauncherDelegate; |
| 44 | class LauncherModel; |
| 45 | struct LauncherItem; |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 46 | class RootWindowHostFactory; |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 47 | class SessionStateDelegate; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 48 | class SystemTrayDelegate; |
| 49 | class UserWallpaperDelegate; |
| 50 | |
| 51 | enum UserMetricsAction { |
| 52 | UMA_ACCEL_KEYBOARD_BRIGHTNESS_DOWN_F6, |
| 53 | UMA_ACCEL_KEYBOARD_BRIGHTNESS_UP_F7, |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 54 | UMA_ACCEL_LOCK_SCREEN_L, |
| 55 | UMA_ACCEL_LOCK_SCREEN_LOCK_BUTTON, |
| 56 | UMA_ACCEL_LOCK_SCREEN_POWER_BUTTON, |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 57 | UMA_ACCEL_FULLSCREEN_F4, |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 58 | UMA_ACCEL_MAXIMIZE_RESTORE_F4, |
| 59 | UMA_ACCEL_NEWTAB_T, |
| 60 | UMA_ACCEL_NEXTWINDOW_F5, |
| 61 | UMA_ACCEL_NEXTWINDOW_TAB, |
Torne (Richard Coles) | a36e592 | 2013-08-05 13:57:33 +0100 | [diff] [blame] | 62 | UMA_ACCEL_OVERVIEW_F5, |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 63 | UMA_ACCEL_PREVWINDOW_F5, |
| 64 | UMA_ACCEL_PREVWINDOW_TAB, |
Torne (Richard Coles) | 90dce4d | 2013-05-29 14:40:03 +0100 | [diff] [blame] | 65 | UMA_ACCEL_EXIT_FIRST_Q, |
| 66 | UMA_ACCEL_EXIT_SECOND_Q, |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 67 | UMA_ACCEL_SEARCH_LWIN, |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 68 | UMA_ACCEL_SHUT_DOWN_POWER_BUTTON, |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 69 | UMA_CLOSE_THROUGH_CONTEXT_MENU, |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 70 | UMA_LAUNCHER_CLICK_ON_APP, |
| 71 | UMA_LAUNCHER_CLICK_ON_APPLIST_BUTTON, |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 72 | UMA_MINIMIZE_PER_KEY, |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 73 | UMA_MOUSE_DOWN, |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 74 | UMA_TOGGLE_MAXIMIZE_CAPTION_CLICK, |
| 75 | UMA_TOGGLE_MAXIMIZE_CAPTION_GESTURE, |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 76 | UMA_TOUCHSCREEN_TAP_DOWN, |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 77 | UMA_TRAY_HELP, |
| 78 | UMA_TRAY_LOCK_SCREEN, |
| 79 | UMA_TRAY_SHUT_DOWN, |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 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, |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 92 | }; |
| 93 | |
| 94 | enum AccessibilityNotificationVisibility { |
| 95 | A11Y_NOTIFICATION_NONE, |
| 96 | A11Y_NOTIFICATION_SHOW, |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 97 | }; |
| 98 | |
| 99 | // Delegate of the Shell. |
| 100 | class ASH_EXPORT ShellDelegate { |
| 101 | public: |
| 102 | // The Shell owns the delegate. |
| 103 | virtual ~ShellDelegate() {} |
| 104 | |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 105 | // Returns true if this is the first time that the shell has been run after |
| 106 | // the system has booted. false is returned after the shell has been |
| 107 | // restarted, typically due to logging in as a guest or logging out. |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 108 | virtual bool IsFirstRunAfterBoot() const = 0; |
| 109 | |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 110 | // Returns true if multi-profiles feature is enabled. |
| 111 | virtual bool IsMultiProfilesEnabled() const = 0; |
| 112 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 113 | // Returns true if we're running in forced app mode. |
| 114 | virtual bool IsRunningInForcedAppMode() const = 0; |
| 115 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 116 | // Called before processing |Shell::Init()| so that the delegate |
| 117 | // can perform tasks necessary before the shell is initialized. |
| 118 | virtual void PreInit() = 0; |
| 119 | |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 120 | // Shuts down the environment. |
| 121 | virtual void Shutdown() = 0; |
| 122 | |
| 123 | // Invoked when the user uses Ctrl-Shift-Q to close chrome. |
| 124 | virtual void Exit() = 0; |
| 125 | |
| 126 | // Invoked when the user uses Ctrl+T to open a new tab. |
| 127 | virtual void NewTab() = 0; |
| 128 | |
| 129 | // Invoked when the user uses Ctrl-N or Ctrl-Shift-N to open a new window. |
| 130 | virtual void NewWindow(bool incognito) = 0; |
| 131 | |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 132 | // Invoked when the user uses Shift+F4 to toggle the window fullscreen state. |
| 133 | virtual void ToggleFullscreen() = 0; |
| 134 | |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 135 | // Invoked when the user uses F4 to toggle window maximized state. |
| 136 | virtual void ToggleMaximized() = 0; |
| 137 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 138 | // Invoked when an accelerator is used to open the file manager. |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 139 | virtual void OpenFileManager(bool as_dialog) = 0; |
| 140 | |
| 141 | // Invoked when the user opens Crosh. |
| 142 | virtual void OpenCrosh() = 0; |
| 143 | |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 144 | // Invoked when the user uses Shift+Ctrl+T to restore the closed tab. |
| 145 | virtual void RestoreTab() = 0; |
| 146 | |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 147 | // Shows the keyboard shortcut overlay. |
| 148 | virtual void ShowKeyboardOverlay() = 0; |
| 149 | |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 150 | // Create a shell-specific keyboard::KeyboardControllerProxy |
| 151 | virtual keyboard::KeyboardControllerProxy* |
| 152 | CreateKeyboardControllerProxy() = 0; |
| 153 | |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 154 | // Shows the task manager window. |
| 155 | virtual void ShowTaskManager() = 0; |
| 156 | |
| 157 | // Get the current browser context. This will get us the current profile. |
| 158 | virtual content::BrowserContext* GetCurrentBrowserContext() = 0; |
| 159 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 160 | // Invoked to toggle spoken feedback for accessibility |
| 161 | virtual void ToggleSpokenFeedback( |
| 162 | AccessibilityNotificationVisibility notify) = 0; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 163 | |
| 164 | // Returns true if spoken feedback is enabled. |
| 165 | virtual bool IsSpokenFeedbackEnabled() const = 0; |
| 166 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 167 | // Invoked to toggle high contrast for accessibility. |
| 168 | virtual void ToggleHighContrast() = 0; |
| 169 | |
| 170 | // Returns true if high contrast mode is enabled. |
| 171 | virtual bool IsHighContrastEnabled() const = 0; |
| 172 | |
| 173 | // Invoked to enable the screen magnifier. |
| 174 | virtual void SetMagnifierEnabled(bool enabled) = 0; |
| 175 | |
| 176 | // Invoked to change the type of the screen magnifier. |
| 177 | virtual void SetMagnifierType(MagnifierType type) = 0; |
| 178 | |
| 179 | // Returns if the screen magnifier is enabled or not. |
| 180 | virtual bool IsMagnifierEnabled() const = 0; |
| 181 | |
| 182 | // Returns the current screen magnifier mode. |
| 183 | virtual MagnifierType GetMagnifierType() const = 0; |
| 184 | |
Torne (Richard Coles) | 868fa2f | 2013-06-11 10:57:03 +0100 | [diff] [blame] | 185 | // Invoked to enable Large Cursor. |
| 186 | virtual void SetLargeCursorEnabled(bool enabled) = 0; |
| 187 | |
| 188 | // Returns if Large Cursor is enabled or not. |
| 189 | virtual bool IsLargeCursorEnabled() const = 0; |
| 190 | |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 191 | // Returns true if the user want to show accesibility menu even when all the |
| 192 | // accessibility features are disabled. |
| 193 | virtual bool ShouldAlwaysShowAccessibilityMenu() const = 0; |
| 194 | |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 195 | // Cancel all current and queued speech immediately. |
| 196 | virtual void SilenceSpokenFeedback() const = 0; |
| 197 | |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 198 | // Invoked to create an AppListViewDelegate. Shell takes the ownership of |
| 199 | // the created delegate. |
| 200 | virtual app_list::AppListViewDelegate* CreateAppListViewDelegate() = 0; |
| 201 | |
| 202 | // Creates a new LauncherDelegate. Shell takes ownership of the returned |
| 203 | // value. |
| 204 | virtual LauncherDelegate* CreateLauncherDelegate( |
| 205 | ash::LauncherModel* model) = 0; |
| 206 | |
| 207 | // Creates a system-tray delegate. Shell takes ownership of the delegate. |
| 208 | virtual SystemTrayDelegate* CreateSystemTrayDelegate() = 0; |
| 209 | |
| 210 | // Creates a user wallpaper delegate. Shell takes ownership of the delegate. |
| 211 | virtual UserWallpaperDelegate* CreateUserWallpaperDelegate() = 0; |
| 212 | |
| 213 | // Creates a caps lock delegate. Shell takes ownership of the delegate. |
| 214 | virtual CapsLockDelegate* CreateCapsLockDelegate() = 0; |
| 215 | |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 216 | // Creates a session state delegate. Shell takes ownership of the delegate. |
| 217 | virtual SessionStateDelegate* CreateSessionStateDelegate() = 0; |
| 218 | |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 219 | // Creates a user action client. Shell takes ownership of the object. |
| 220 | virtual aura::client::UserActionClient* CreateUserActionClient() = 0; |
| 221 | |
| 222 | // Opens the feedback page for "Report Issue". |
| 223 | virtual void OpenFeedbackPage() = 0; |
| 224 | |
| 225 | // Records that the user performed an action. |
| 226 | virtual void RecordUserMetricsAction(UserMetricsAction action) = 0; |
| 227 | |
| 228 | // Handles the Next Track Media shortcut key. |
| 229 | virtual void HandleMediaNextTrack() = 0; |
| 230 | |
| 231 | // Handles the Play/Pause Toggle Media shortcut key. |
| 232 | virtual void HandleMediaPlayPause() = 0; |
| 233 | |
| 234 | // Handles the Previous Track Media shortcut key. |
| 235 | virtual void HandleMediaPrevTrack() = 0; |
| 236 | |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 237 | // Saves the zoom scale of the full screen magnifier. |
| 238 | virtual void SaveScreenMagnifierScale(double scale) = 0; |
| 239 | |
| 240 | // Gets a saved value of the zoom scale of full screen magnifier. If a value |
| 241 | // is not saved, return a negative value. |
| 242 | virtual double GetSavedScreenMagnifierScale() = 0; |
| 243 | |
| 244 | // Creates a menu model of the context for the |root_window|. |
| 245 | virtual ui::MenuModel* CreateContextMenu(aura::RootWindow* root_window) = 0; |
Torne (Richard Coles) | 2a99a7e | 2013-03-28 15:31:22 +0000 | [diff] [blame] | 246 | |
| 247 | // Creates a root window host factory. Shell takes ownership of the returned |
| 248 | // value. |
| 249 | virtual RootWindowHostFactory* CreateRootWindowHostFactory() = 0; |
| 250 | |
| 251 | // Get the product name. |
Torne (Richard Coles) | c2e0dbd | 2013-05-09 18:35:53 +0100 | [diff] [blame] | 252 | virtual base::string16 GetProductName() const = 0; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 253 | }; |
| 254 | |
| 255 | } // namespace ash |
| 256 | |
| 257 | #endif // ASH_SHELL_DELEGATE_H_ |