- add sources.
[platform/framework/web/crosswalk.git] / src / ash / shell_delegate.h
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
8 #include <string>
9
10 #include "ash/ash_export.h"
11 #include "ash/shell.h"
12 #include "base/callback.h"
13 #include "base/strings/string16.h"
14
15 namespace app_list {
16 class AppListViewDelegate;
17 }
18
19 namespace aura {
20 class RootWindow;
21 class Window;
22 namespace client {
23 class UserActionClient;
24 }
25 }
26
27 namespace ui {
28 class MenuModel;
29 }
30
31 namespace views {
32 class Widget;
33 }
34
35 namespace keyboard {
36 class KeyboardControllerProxy;
37 }
38
39 namespace ash {
40
41 class CapsLockDelegate;
42 class LauncherDelegate;
43 class LauncherModel;
44 struct LauncherItem;
45 class MediaDelegate;
46 class NewWindowDelegate;
47 class RootWindowHostFactory;
48 class AccessibilityDelegate;
49 class SessionStateDelegate;
50 class SystemTrayDelegate;
51 class UserWallpaperDelegate;
52
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,
61   UMA_ACCEL_NEWTAB_T,
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,
72   UMA_GESTURE_OVERVIEW,
73   UMA_LAUNCHER_CLICK_ON_APP,
74   UMA_LAUNCHER_CLICK_ON_APPLIST_BUTTON,
75   UMA_MINIMIZE_PER_KEY,
76   UMA_MOUSE_DOWN,
77   UMA_TOGGLE_MAXIMIZE_CAPTION_CLICK,
78   UMA_TOGGLE_MAXIMIZE_CAPTION_GESTURE,
79   UMA_TOUCHPAD_GESTURE_OVERVIEW,
80   UMA_TOUCHSCREEN_TAP_DOWN,
81   UMA_TRAY_HELP,
82   UMA_TRAY_LOCK_SCREEN,
83   UMA_TRAY_SHUT_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,
96
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.
100   UMA_WINDOW_OVERVIEW,
101
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,
105 };
106
107 // Delegate of the Shell.
108 class ASH_EXPORT ShellDelegate {
109  public:
110   // The Shell owns the delegate.
111   virtual ~ShellDelegate() {}
112
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;
117
118   // Returns true if multi-profiles feature is enabled.
119   virtual bool IsMultiProfilesEnabled() const = 0;
120
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;
124
125   // Returns true if we're running in forced app mode.
126   virtual bool IsRunningInForcedAppMode() const = 0;
127
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;
131
132   // Shuts down the environment.
133   virtual void Shutdown() = 0;
134
135   // Invoked when the user uses Ctrl-Shift-Q to close chrome.
136   virtual void Exit() = 0;
137
138   // Create a shell-specific keyboard::KeyboardControllerProxy
139   virtual keyboard::KeyboardControllerProxy*
140       CreateKeyboardControllerProxy() = 0;
141
142   // Get the current browser context. This will get us the current profile.
143   virtual content::BrowserContext* GetCurrentBrowserContext() = 0;
144
145   // Invoked to create an AppListViewDelegate. Shell takes the ownership of
146   // the created delegate.
147   virtual app_list::AppListViewDelegate* CreateAppListViewDelegate() = 0;
148
149   // Creates a new LauncherDelegate. Shell takes ownership of the returned
150   // value.
151   virtual LauncherDelegate* CreateLauncherDelegate(
152       ash::LauncherModel* model) = 0;
153
154   // Creates a system-tray delegate. Shell takes ownership of the delegate.
155   virtual SystemTrayDelegate* CreateSystemTrayDelegate() = 0;
156
157   // Creates a user wallpaper delegate. Shell takes ownership of the delegate.
158   virtual UserWallpaperDelegate* CreateUserWallpaperDelegate() = 0;
159
160   // Creates a caps lock delegate. Shell takes ownership of the delegate.
161   virtual CapsLockDelegate* CreateCapsLockDelegate() = 0;
162
163   // Creates a session state delegate. Shell takes ownership of the delegate.
164   virtual SessionStateDelegate* CreateSessionStateDelegate() = 0;
165
166   // Creates a accessibility delegate. Shell takes ownership of the delegate.
167   virtual AccessibilityDelegate* CreateAccessibilityDelegate() = 0;
168
169   // Creates an application delegate. Shell takes ownership of the delegate.
170   virtual NewWindowDelegate* CreateNewWindowDelegate() = 0;
171
172   // Creates a media delegate. Shell takes ownership of the delegate.
173   virtual MediaDelegate* CreateMediaDelegate() = 0;
174
175   // Creates a user action client. Shell takes ownership of the object.
176   virtual aura::client::UserActionClient* CreateUserActionClient() = 0;
177
178   // Records that the user performed an action.
179   virtual void RecordUserMetricsAction(UserMetricsAction action) = 0;
180
181   // Creates a menu model of the context for the |root_window|.
182   virtual ui::MenuModel* CreateContextMenu(aura::Window* root_window) = 0;
183
184   // Creates a root window host factory. Shell takes ownership of the returned
185   // value.
186   virtual RootWindowHostFactory* CreateRootWindowHostFactory() = 0;
187
188   // Get the product name.
189   virtual base::string16 GetProductName() const = 0;
190 };
191
192 }  // namespace ash
193
194 #endif  // ASH_SHELL_DELEGATE_H_