Revert 219825 "Blink roll 156773:156785"
[chromium-blink-merge.git] / ash / shell_delegate.h
blob38164f2add87c748b9aabfde054fc95a76069f40
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_
8 #include <string>
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"
16 namespace app_list {
17 class AppListViewDelegate;
20 namespace aura {
21 class RootWindow;
22 class Window;
23 namespace client {
24 class UserActionClient;
28 namespace ui {
29 class MenuModel;
32 namespace views {
33 class Widget;
36 namespace keyboard {
37 class KeyboardControllerProxy;
40 namespace ash {
42 class CapsLockDelegate;
43 class LauncherDelegate;
44 class LauncherModel;
45 struct LauncherItem;
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,
59 UMA_ACCEL_NEWTAB_T,
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,
72 UMA_MINIMIZE_PER_KEY,
73 UMA_MOUSE_DOWN,
74 UMA_TOGGLE_MAXIMIZE_CAPTION_CLICK,
75 UMA_TOGGLE_MAXIMIZE_CAPTION_GESTURE,
76 UMA_TOUCHSCREEN_TAP_DOWN,
77 UMA_TRAY_HELP,
78 UMA_TRAY_LOCK_SCREEN,
79 UMA_TRAY_SHUT_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,
94 enum AccessibilityNotificationVisibility {
95 A11Y_NOTIFICATION_NONE,
96 A11Y_NOTIFICATION_SHOW,
99 // Delegate of the Shell.
100 class ASH_EXPORT ShellDelegate {
101 public:
102 // The Shell owns the delegate.
103 virtual ~ShellDelegate() {}
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.
108 virtual bool IsFirstRunAfterBoot() const = 0;
110 // Returns true if multi-profiles feature is enabled.
111 virtual bool IsMultiProfilesEnabled() const = 0;
113 // Returns true if we're running in forced app mode.
114 virtual bool IsRunningInForcedAppMode() const = 0;
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;
120 // Shuts down the environment.
121 virtual void Shutdown() = 0;
123 // Invoked when the user uses Ctrl-Shift-Q to close chrome.
124 virtual void Exit() = 0;
126 // Invoked when the user uses Ctrl+T to open a new tab.
127 virtual void NewTab() = 0;
129 // Invoked when the user uses Ctrl-N or Ctrl-Shift-N to open a new window.
130 virtual void NewWindow(bool incognito) = 0;
132 // Invoked when the user uses Shift+F4 to toggle the window fullscreen state.
133 virtual void ToggleFullscreen() = 0;
135 // Invoked when the user uses F4 to toggle window maximized state.
136 virtual void ToggleMaximized() = 0;
138 // Invoked when an accelerator is used to open the file manager.
139 virtual void OpenFileManager(bool as_dialog) = 0;
141 // Invoked when the user opens Crosh.
142 virtual void OpenCrosh() = 0;
144 // Invoked when the user uses Shift+Ctrl+T to restore the closed tab.
145 virtual void RestoreTab() = 0;
147 // Shows the keyboard shortcut overlay.
148 virtual void ShowKeyboardOverlay() = 0;
150 // Create a shell-specific keyboard::KeyboardControllerProxy
151 virtual keyboard::KeyboardControllerProxy*
152 CreateKeyboardControllerProxy() = 0;
154 // Shows the task manager window.
155 virtual void ShowTaskManager() = 0;
157 // Get the current browser context. This will get us the current profile.
158 virtual content::BrowserContext* GetCurrentBrowserContext() = 0;
160 // Invoked to toggle spoken feedback for accessibility
161 virtual void ToggleSpokenFeedback(
162 AccessibilityNotificationVisibility notify) = 0;
164 // Returns true if spoken feedback is enabled.
165 virtual bool IsSpokenFeedbackEnabled() const = 0;
167 // Invoked to toggle high contrast for accessibility.
168 virtual void ToggleHighContrast() = 0;
170 // Returns true if high contrast mode is enabled.
171 virtual bool IsHighContrastEnabled() const = 0;
173 // Invoked to enable the screen magnifier.
174 virtual void SetMagnifierEnabled(bool enabled) = 0;
176 // Invoked to change the type of the screen magnifier.
177 virtual void SetMagnifierType(MagnifierType type) = 0;
179 // Returns if the screen magnifier is enabled or not.
180 virtual bool IsMagnifierEnabled() const = 0;
182 // Returns the current screen magnifier mode.
183 virtual MagnifierType GetMagnifierType() const = 0;
185 // Invoked to enable Large Cursor.
186 virtual void SetLargeCursorEnabled(bool enabled) = 0;
188 // Returns if Large Cursor is enabled or not.
189 virtual bool IsLargeCursorEnabled() const = 0;
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;
195 // Cancel all current and queued speech immediately.
196 virtual void SilenceSpokenFeedback() const = 0;
198 // Invoked to create an AppListViewDelegate. Shell takes the ownership of
199 // the created delegate.
200 virtual app_list::AppListViewDelegate* CreateAppListViewDelegate() = 0;
202 // Creates a new LauncherDelegate. Shell takes ownership of the returned
203 // value.
204 virtual LauncherDelegate* CreateLauncherDelegate(
205 ash::LauncherModel* model) = 0;
207 // Creates a system-tray delegate. Shell takes ownership of the delegate.
208 virtual SystemTrayDelegate* CreateSystemTrayDelegate() = 0;
210 // Creates a user wallpaper delegate. Shell takes ownership of the delegate.
211 virtual UserWallpaperDelegate* CreateUserWallpaperDelegate() = 0;
213 // Creates a caps lock delegate. Shell takes ownership of the delegate.
214 virtual CapsLockDelegate* CreateCapsLockDelegate() = 0;
216 // Creates a session state delegate. Shell takes ownership of the delegate.
217 virtual SessionStateDelegate* CreateSessionStateDelegate() = 0;
219 // Creates a user action client. Shell takes ownership of the object.
220 virtual aura::client::UserActionClient* CreateUserActionClient() = 0;
222 // Opens the feedback page for "Report Issue".
223 virtual void OpenFeedbackPage() = 0;
225 // Records that the user performed an action.
226 virtual void RecordUserMetricsAction(UserMetricsAction action) = 0;
228 // Handles the Next Track Media shortcut key.
229 virtual void HandleMediaNextTrack() = 0;
231 // Handles the Play/Pause Toggle Media shortcut key.
232 virtual void HandleMediaPlayPause() = 0;
234 // Handles the Previous Track Media shortcut key.
235 virtual void HandleMediaPrevTrack() = 0;
237 // Saves the zoom scale of the full screen magnifier.
238 virtual void SaveScreenMagnifierScale(double scale) = 0;
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;
244 // Creates a menu model of the context for the |root_window|.
245 virtual ui::MenuModel* CreateContextMenu(aura::RootWindow* root_window) = 0;
247 // Creates a root window host factory. Shell takes ownership of the returned
248 // value.
249 virtual RootWindowHostFactory* CreateRootWindowHostFactory() = 0;
251 // Get the product name.
252 virtual base::string16 GetProductName() const = 0;
255 } // namespace ash
257 #endif // ASH_SHELL_DELEGATE_H_