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 } 23 24 namespace content { 25 class BrowserContext; 26 } 27 28 namespace ui { 29 class MenuModel; 30 } 31 32 namespace views { 33 class Widget; 34 } 35 36 namespace keyboard { 37 class KeyboardControllerProxy; 38 } 39 40 namespace ash { 41 42 class AccessibilityDelegate; 43 class MediaDelegate; 44 class NewWindowDelegate; 45 class SessionStateDelegate; 46 class ShelfDelegate; 47 class ShelfItemDelegate; 48 class ShelfModel; 49 class SystemTrayDelegate; 50 class UserWallpaperDelegate; 51 struct ShelfItem; 52 53 class ASH_EXPORT VirtualKeyboardStateObserver { 54 public: 55 // Called when keyboard is activated/deactivated. OnVirtualKeyboardStateChanged(bool activated)56 virtual void OnVirtualKeyboardStateChanged(bool activated) {} 57 58 protected: ~VirtualKeyboardStateObserver()59 virtual ~VirtualKeyboardStateObserver() {} 60 }; 61 62 // Delegate of the Shell. 63 class ASH_EXPORT ShellDelegate { 64 public: 65 // The Shell owns the delegate. ~ShellDelegate()66 virtual ~ShellDelegate() {} 67 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; 72 73 // Returns true if multi-profiles feature is enabled. 74 virtual bool IsMultiProfilesEnabled() const = 0; 75 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; 79 80 // Returns true if we're running in forced app mode. 81 virtual bool IsRunningInForcedAppMode() const = 0; 82 83 // Returns true if multi account is enabled. 84 virtual bool IsMultiAccountEnabled() const = 0; 85 86 // Called before processing |Shell::Init()| so that the delegate 87 // can perform tasks necessary before the shell is initialized. 88 virtual void PreInit() = 0; 89 90 // Called at the beginninig of Shell destructor so that 91 // delegate can use Shell instance to perform cleanup tasks. 92 virtual void PreShutdown() = 0; 93 94 // Invoked when the user uses Ctrl-Shift-Q to close chrome. 95 virtual void Exit() = 0; 96 97 // Create a shell-specific keyboard::KeyboardControllerProxy 98 virtual keyboard::KeyboardControllerProxy* 99 CreateKeyboardControllerProxy() = 0; 100 101 // Called when virtual keyboard has been activated/deactivated. 102 virtual void VirtualKeyboardActivated(bool activated) = 0; 103 104 // Adds or removes virtual keyboard state observer. 105 virtual void AddVirtualKeyboardStateObserver( 106 VirtualKeyboardStateObserver* observer) = 0; 107 virtual void RemoveVirtualKeyboardStateObserver( 108 VirtualKeyboardStateObserver* observer) = 0; 109 110 // Get the active browser context. This will get us the active profile 111 // in chrome. 112 virtual content::BrowserContext* GetActiveBrowserContext() = 0; 113 114 // Invoked to create an AppListViewDelegate. Shell takes the ownership of 115 // the created delegate. 116 virtual app_list::AppListViewDelegate* CreateAppListViewDelegate() = 0; 117 118 // Creates a new ShelfDelegate. Shell takes ownership of the returned 119 // value. 120 virtual ShelfDelegate* CreateShelfDelegate(ShelfModel* model) = 0; 121 122 // Creates a system-tray delegate. Shell takes ownership of the delegate. 123 virtual SystemTrayDelegate* CreateSystemTrayDelegate() = 0; 124 125 // Creates a user wallpaper delegate. Shell takes ownership of the delegate. 126 virtual UserWallpaperDelegate* CreateUserWallpaperDelegate() = 0; 127 128 // Creates a session state delegate. Shell takes ownership of the delegate. 129 virtual SessionStateDelegate* CreateSessionStateDelegate() = 0; 130 131 // Creates a accessibility delegate. Shell takes ownership of the delegate. 132 virtual AccessibilityDelegate* CreateAccessibilityDelegate() = 0; 133 134 // Creates an application delegate. Shell takes ownership of the delegate. 135 virtual NewWindowDelegate* CreateNewWindowDelegate() = 0; 136 137 // Creates a media delegate. Shell takes ownership of the delegate. 138 virtual MediaDelegate* CreateMediaDelegate() = 0; 139 140 // Creates a menu model of the context for the |root_window|. 141 // When a ContextMenu is used for an item created by ShelfWindowWatcher, 142 // passes its ShelfItemDelegate and ShelfItem. 143 virtual ui::MenuModel* CreateContextMenu( 144 aura::Window* root_window, 145 ash::ShelfItemDelegate* item_delegate, 146 ash::ShelfItem* item) = 0; 147 148 // Creates a GPU support object. Shell takes ownership of the object. 149 virtual GPUSupport* CreateGPUSupport() = 0; 150 151 // Get the product name. 152 virtual base::string16 GetProductName() const = 0; 153 }; 154 155 } // namespace ash 156 157 #endif // ASH_SHELL_DELEGATE_H_ 158