blob: 38164f2add87c748b9aabfde054fc95a76069f40 [file] [log] [blame]
Torne (Richard Coles)58218062012-11-14 11:43:16 +00001// 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)2a99a7e2013-03-28 15:31:22 +00008#include <string>
Torne (Richard Coles)58218062012-11-14 11:43:16 +00009
10#include "ash/ash_export.h"
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000011#include "ash/magnifier/magnifier_constants.h"
Torne (Richard Coles)58218062012-11-14 11:43:16 +000012#include "ash/shell.h"
13#include "base/callback.h"
Torne (Richard Coles)868fa2f2013-06-11 10:57:03 +010014#include "base/strings/string16.h"
Torne (Richard Coles)58218062012-11-14 11:43:16 +000015
16namespace app_list {
17class AppListViewDelegate;
18}
19
20namespace aura {
21class RootWindow;
22class Window;
23namespace client {
24class UserActionClient;
25}
26}
27
28namespace ui {
29class MenuModel;
30}
31
32namespace views {
33class Widget;
34}
35
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +010036namespace keyboard {
37class KeyboardControllerProxy;
38}
39
Torne (Richard Coles)58218062012-11-14 11:43:16 +000040namespace ash {
41
42class CapsLockDelegate;
43class LauncherDelegate;
44class LauncherModel;
45struct LauncherItem;
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000046class RootWindowHostFactory;
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +010047class SessionStateDelegate;
Torne (Richard Coles)58218062012-11-14 11:43:16 +000048class SystemTrayDelegate;
49class UserWallpaperDelegate;
50
51enum UserMetricsAction {
52 UMA_ACCEL_KEYBOARD_BRIGHTNESS_DOWN_F6,
53 UMA_ACCEL_KEYBOARD_BRIGHTNESS_UP_F7,
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000054 UMA_ACCEL_LOCK_SCREEN_L,
55 UMA_ACCEL_LOCK_SCREEN_LOCK_BUTTON,
56 UMA_ACCEL_LOCK_SCREEN_POWER_BUTTON,
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +010057 UMA_ACCEL_FULLSCREEN_F4,
Torne (Richard Coles)58218062012-11-14 11:43:16 +000058 UMA_ACCEL_MAXIMIZE_RESTORE_F4,
59 UMA_ACCEL_NEWTAB_T,
60 UMA_ACCEL_NEXTWINDOW_F5,
61 UMA_ACCEL_NEXTWINDOW_TAB,
Torne (Richard Coles)a36e5922013-08-05 13:57:33 +010062 UMA_ACCEL_OVERVIEW_F5,
Torne (Richard Coles)58218062012-11-14 11:43:16 +000063 UMA_ACCEL_PREVWINDOW_F5,
64 UMA_ACCEL_PREVWINDOW_TAB,
Torne (Richard Coles)90dce4d2013-05-29 14:40:03 +010065 UMA_ACCEL_EXIT_FIRST_Q,
66 UMA_ACCEL_EXIT_SECOND_Q,
Torne (Richard Coles)58218062012-11-14 11:43:16 +000067 UMA_ACCEL_SEARCH_LWIN,
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000068 UMA_ACCEL_SHUT_DOWN_POWER_BUTTON,
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +010069 UMA_CLOSE_THROUGH_CONTEXT_MENU,
Torne (Richard Coles)58218062012-11-14 11:43:16 +000070 UMA_LAUNCHER_CLICK_ON_APP,
71 UMA_LAUNCHER_CLICK_ON_APPLIST_BUTTON,
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +010072 UMA_MINIMIZE_PER_KEY,
Torne (Richard Coles)58218062012-11-14 11:43:16 +000073 UMA_MOUSE_DOWN,
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000074 UMA_TOGGLE_MAXIMIZE_CAPTION_CLICK,
75 UMA_TOGGLE_MAXIMIZE_CAPTION_GESTURE,
Torne (Richard Coles)58218062012-11-14 11:43:16 +000076 UMA_TOUCHSCREEN_TAP_DOWN,
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +000077 UMA_TRAY_HELP,
78 UMA_TRAY_LOCK_SCREEN,
79 UMA_TRAY_SHUT_DOWN,
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +010080 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)2a99a7e2013-03-28 15:31:22 +000092};
93
94enum AccessibilityNotificationVisibility {
95 A11Y_NOTIFICATION_NONE,
96 A11Y_NOTIFICATION_SHOW,
Torne (Richard Coles)58218062012-11-14 11:43:16 +000097};
98
99// Delegate of the Shell.
100class ASH_EXPORT ShellDelegate {
101 public:
102 // The Shell owns the delegate.
103 virtual ~ShellDelegate() {}
104
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000105 // 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)2a99a7e2013-03-28 15:31:22 +0000108 virtual bool IsFirstRunAfterBoot() const = 0;
109
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +0100110 // Returns true if multi-profiles feature is enabled.
111 virtual bool IsMultiProfilesEnabled() const = 0;
112
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000113 // Returns true if we're running in forced app mode.
114 virtual bool IsRunningInForcedAppMode() const = 0;
115
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000116 // 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)58218062012-11-14 11:43:16 +0000120 // 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)c2e0dbd2013-05-09 18:35:53 +0100132 // Invoked when the user uses Shift+F4 to toggle the window fullscreen state.
133 virtual void ToggleFullscreen() = 0;
134
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000135 // Invoked when the user uses F4 to toggle window maximized state.
136 virtual void ToggleMaximized() = 0;
137
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000138 // Invoked when an accelerator is used to open the file manager.
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000139 virtual void OpenFileManager(bool as_dialog) = 0;
140
141 // Invoked when the user opens Crosh.
142 virtual void OpenCrosh() = 0;
143
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000144 // Invoked when the user uses Shift+Ctrl+T to restore the closed tab.
145 virtual void RestoreTab() = 0;
146
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000147 // Shows the keyboard shortcut overlay.
148 virtual void ShowKeyboardOverlay() = 0;
149
Torne (Richard Coles)c2e0dbd2013-05-09 18:35:53 +0100150 // Create a shell-specific keyboard::KeyboardControllerProxy
151 virtual keyboard::KeyboardControllerProxy*
152 CreateKeyboardControllerProxy() = 0;
153
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000154 // 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)2a99a7e2013-03-28 15:31:22 +0000160 // Invoked to toggle spoken feedback for accessibility
161 virtual void ToggleSpokenFeedback(
162 AccessibilityNotificationVisibility notify) = 0;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000163
164 // Returns true if spoken feedback is enabled.
165 virtual bool IsSpokenFeedbackEnabled() const = 0;
166
Torne (Richard Coles)2a99a7e2013-03-28 15:31:22 +0000167 // 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)868fa2f2013-06-11 10:57:03 +0100185 // 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)2a99a7e2013-03-28 15:31:22 +0000191 // 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)c2e0dbd2013-05-09 18:35:53 +0100195 // Cancel all current and queued speech immediately.
196 virtual void SilenceSpokenFeedback() const = 0;
197
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000198 // 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)c2e0dbd2013-05-09 18:35:53 +0100216 // Creates a session state delegate. Shell takes ownership of the delegate.
217 virtual SessionStateDelegate* CreateSessionStateDelegate() = 0;
218
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000219 // 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)58218062012-11-14 11:43:16 +0000237 // 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)2a99a7e2013-03-28 15:31:22 +0000246
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)c2e0dbd2013-05-09 18:35:53 +0100252 virtual base::string16 GetProductName() const = 0;
Torne (Richard Coles)58218062012-11-14 11:43:16 +0000253};
254
255} // namespace ash
256
257#endif // ASH_SHELL_DELEGATE_H_