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/shell.h"
12 #include "base/callback.h"
13 #include "base/strings/string16.h"
16 class AppListViewDelegate
;
37 class KeyboardControllerProxy
;
42 class AccessibilityDelegate
;
44 class NewWindowDelegate
;
45 class SessionStateDelegate
;
47 class ShelfItemDelegate
;
49 class SystemTrayDelegate
;
50 class UserWallpaperDelegate
;
53 class ASH_EXPORT VirtualKeyboardStateObserver
{
55 // Called when keyboard is activated/deactivated.
56 virtual void OnVirtualKeyboardStateChanged(bool activated
) {}
59 virtual ~VirtualKeyboardStateObserver() {}
62 // Delegate of the Shell.
63 class ASH_EXPORT ShellDelegate
{
65 // The Shell owns the delegate.
66 virtual ~ShellDelegate() {}
68 // Returns true if this is the first time that the shell has been run after
69 // the system has booted. false is returned after the shell has been
70 // restarted, typically due to logging in as a guest or logging out.
71 virtual bool IsFirstRunAfterBoot() const = 0;
73 // Returns true if multi-profiles feature is enabled.
74 virtual bool IsMultiProfilesEnabled() const = 0;
76 // Returns true if incognito mode is allowed for the user.
77 // Incognito windows are restricted for supervised users.
78 virtual bool IsIncognitoAllowed() const = 0;
80 // Returns true if we're running in forced app mode.
81 virtual bool IsRunningInForcedAppMode() const = 0;
83 // Returns true if multi account is enabled.
84 virtual bool IsMultiAccountEnabled() const = 0;
86 // Returns true if the first window shown on first run should be
87 // unconditionally maximized, overriding the heuristic that normally chooses
89 virtual bool IsForceMaximizeOnFirstRun() const = 0;
91 // Called before processing |Shell::Init()| so that the delegate
92 // can perform tasks necessary before the shell is initialized.
93 virtual void PreInit() = 0;
95 // Called at the beginninig of Shell destructor so that
96 // delegate can use Shell instance to perform cleanup tasks.
97 virtual void PreShutdown() = 0;
99 // Invoked when the user uses Ctrl-Shift-Q to close chrome.
100 virtual void Exit() = 0;
102 // Create a shell-specific keyboard::KeyboardControllerProxy
103 virtual keyboard::KeyboardControllerProxy
*
104 CreateKeyboardControllerProxy() = 0;
106 // Called when virtual keyboard has been activated/deactivated.
107 virtual void VirtualKeyboardActivated(bool activated
) = 0;
109 // Adds or removes virtual keyboard state observer.
110 virtual void AddVirtualKeyboardStateObserver(
111 VirtualKeyboardStateObserver
* observer
) = 0;
112 virtual void RemoveVirtualKeyboardStateObserver(
113 VirtualKeyboardStateObserver
* observer
) = 0;
115 // Get the active browser context. This will get us the active profile
117 virtual content::BrowserContext
* GetActiveBrowserContext() = 0;
119 // Get the AppListViewDelegate, creating one if it does not yet exist.
120 // Ownership stays with Chrome's AppListService, or the ShellDelegate.
121 virtual app_list::AppListViewDelegate
* GetAppListViewDelegate() = 0;
123 // Creates a new ShelfDelegate. Shell takes ownership of the returned
125 virtual ShelfDelegate
* CreateShelfDelegate(ShelfModel
* model
) = 0;
127 // Creates a system-tray delegate. Shell takes ownership of the delegate.
128 virtual SystemTrayDelegate
* CreateSystemTrayDelegate() = 0;
130 // Creates a user wallpaper delegate. Shell takes ownership of the delegate.
131 virtual UserWallpaperDelegate
* CreateUserWallpaperDelegate() = 0;
133 // Creates a session state delegate. Shell takes ownership of the delegate.
134 virtual SessionStateDelegate
* CreateSessionStateDelegate() = 0;
136 // Creates a accessibility delegate. Shell takes ownership of the delegate.
137 virtual AccessibilityDelegate
* CreateAccessibilityDelegate() = 0;
139 // Creates an application delegate. Shell takes ownership of the delegate.
140 virtual NewWindowDelegate
* CreateNewWindowDelegate() = 0;
142 // Creates a media delegate. Shell takes ownership of the delegate.
143 virtual MediaDelegate
* CreateMediaDelegate() = 0;
145 // Creates a menu model of the context for the |root_window|.
146 // When a ContextMenu is used for an item created by ShelfWindowWatcher,
147 // passes its ShelfItemDelegate and ShelfItem.
148 virtual ui::MenuModel
* CreateContextMenu(
149 aura::Window
* root_window
,
150 ash::ShelfItemDelegate
* item_delegate
,
151 ash::ShelfItem
* item
) = 0;
153 // Creates a GPU support object. Shell takes ownership of the object.
154 virtual GPUSupport
* CreateGPUSupport() = 0;
156 // Get the product name.
157 virtual base::string16
GetProductName() const = 0;
162 #endif // ASH_SHELL_DELEGATE_H_