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 content { 28 class BrowserContext; 29 } 30 31 namespace ui { 32 class MenuModel; 33 } 34 35 namespace views { 36 class Widget; 37 } 38 39 namespace keyboard { 40 class KeyboardControllerProxy; 41 } 42 43 namespace ash { 44 45 class AccessibilityDelegate; 46 class CapsLockDelegate; 47 class MediaDelegate; 48 class NewWindowDelegate; 49 class RootWindowHostFactory; 50 class SessionStateDelegate; 51 class ShelfDelegate; 52 class ShelfModel; 53 class SystemTrayDelegate; 54 class UserWallpaperDelegate; 55 struct LauncherItem; 56 57 // Delegate of the Shell. 58 class ASH_EXPORT ShellDelegate { 59 public: 60 // The Shell owns the delegate. 61 virtual ~ShellDelegate() {} 62 63 // Returns true if this is the first time that the shell has been run after 64 // the system has booted. false is returned after the shell has been 65 // restarted, typically due to logging in as a guest or logging out. 66 virtual bool IsFirstRunAfterBoot() const = 0; 67 68 // Returns true if multi-profiles feature is enabled. 69 virtual bool IsMultiProfilesEnabled() const = 0; 70 71 // Returns true if incognito mode is allowed for the user. 72 // Incognito windows are restricted for supervised users. 73 virtual bool IsIncognitoAllowed() const = 0; 74 75 // Returns true if we're running in forced app mode. 76 virtual bool IsRunningInForcedAppMode() const = 0; 77 78 // Called before processing |Shell::Init()| so that the delegate 79 // can perform tasks necessary before the shell is initialized. 80 virtual void PreInit() = 0; 81 82 // Shuts down the environment. 83 virtual void Shutdown() = 0; 84 85 // Invoked when the user uses Ctrl-Shift-Q to close chrome. 86 virtual void Exit() = 0; 87 88 // Create a shell-specific keyboard::KeyboardControllerProxy 89 virtual keyboard::KeyboardControllerProxy* 90 CreateKeyboardControllerProxy() = 0; 91 92 // Get the active browser context. This will get us the active profile 93 // in chrome. 94 virtual content::BrowserContext* GetActiveBrowserContext() = 0; 95 96 // Invoked to create an AppListViewDelegate. Shell takes the ownership of 97 // the created delegate. 98 virtual app_list::AppListViewDelegate* CreateAppListViewDelegate() = 0; 99 100 // Creates a new ShelfDelegate. Shell takes ownership of the returned 101 // value. 102 virtual ShelfDelegate* CreateShelfDelegate(ShelfModel* model) = 0; 103 104 // Creates a system-tray delegate. Shell takes ownership of the delegate. 105 virtual SystemTrayDelegate* CreateSystemTrayDelegate() = 0; 106 107 // Creates a user wallpaper delegate. Shell takes ownership of the delegate. 108 virtual UserWallpaperDelegate* CreateUserWallpaperDelegate() = 0; 109 110 // Creates a caps lock delegate. Shell takes ownership of the delegate. 111 virtual CapsLockDelegate* CreateCapsLockDelegate() = 0; 112 113 // Creates a session state delegate. Shell takes ownership of the delegate. 114 virtual SessionStateDelegate* CreateSessionStateDelegate() = 0; 115 116 // Creates a accessibility delegate. Shell takes ownership of the delegate. 117 virtual AccessibilityDelegate* CreateAccessibilityDelegate() = 0; 118 119 // Creates an application delegate. Shell takes ownership of the delegate. 120 virtual NewWindowDelegate* CreateNewWindowDelegate() = 0; 121 122 // Creates a media delegate. Shell takes ownership of the delegate. 123 virtual MediaDelegate* CreateMediaDelegate() = 0; 124 125 // Creates a user action client. Shell takes ownership of the object. 126 virtual aura::client::UserActionClient* CreateUserActionClient() = 0; 127 128 // Creates a menu model of the context for the |root_window|. 129 virtual ui::MenuModel* CreateContextMenu(aura::Window* root_window) = 0; 130 131 // Creates a root window host factory. Shell takes ownership of the returned 132 // value. 133 virtual RootWindowHostFactory* CreateRootWindowHostFactory() = 0; 134 135 // Get the product name. 136 virtual base::string16 GetProductName() const = 0; 137 }; 138 139 } // namespace ash 140 141 #endif // ASH_SHELL_DELEGATE_H_ 142