OLD | NEW |
| (Empty) |
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 <memory> | |
9 #include <string> | |
10 | |
11 #include "ash/ash_export.h" | |
12 #include "base/callback.h" | |
13 #include "base/strings/string16.h" | |
14 | |
15 class GURL; | |
16 | |
17 namespace app_list { | |
18 class AppListPresenter; | |
19 class AppListViewDelegate; | |
20 } | |
21 | |
22 namespace gfx { | |
23 class Image; | |
24 } | |
25 | |
26 namespace keyboard { | |
27 class KeyboardUI; | |
28 } | |
29 | |
30 namespace ui { | |
31 class MenuModel; | |
32 } | |
33 | |
34 namespace views { | |
35 class Widget; | |
36 } | |
37 | |
38 namespace ash { | |
39 | |
40 class AccessibilityDelegate; | |
41 class GPUSupport; | |
42 class MediaDelegate; | |
43 class NewWindowDelegate; | |
44 class PointerWatcherDelegate; | |
45 class SessionStateDelegate; | |
46 class ShelfDelegate; | |
47 class ShelfModel; | |
48 class SystemTrayDelegate; | |
49 class UserWallpaperDelegate; | |
50 struct ShelfItem; | |
51 class WmShelf; | |
52 class WmWindow; | |
53 | |
54 class ASH_EXPORT VirtualKeyboardStateObserver { | |
55 public: | |
56 // Called when keyboard is activated/deactivated. | |
57 virtual void OnVirtualKeyboardStateChanged(bool activated) {} | |
58 | |
59 protected: | |
60 virtual ~VirtualKeyboardStateObserver() {} | |
61 }; | |
62 | |
63 // Delegate of the Shell. | |
64 class ASH_EXPORT ShellDelegate { | |
65 public: | |
66 // The Shell owns the delegate. | |
67 virtual ~ShellDelegate() {} | |
68 | |
69 // Returns true if this is the first time that the shell has been run after | |
70 // the system has booted. false is returned after the shell has been | |
71 // restarted, typically due to logging in as a guest or logging out. | |
72 virtual bool IsFirstRunAfterBoot() const = 0; | |
73 | |
74 // Returns true if multi-profiles feature is enabled. | |
75 virtual bool IsMultiProfilesEnabled() const = 0; | |
76 | |
77 // Returns true if incognito mode is allowed for the user. | |
78 // Incognito windows are restricted for supervised users. | |
79 virtual bool IsIncognitoAllowed() const = 0; | |
80 | |
81 // Returns true if we're running in forced app mode. | |
82 virtual bool IsRunningInForcedAppMode() const = 0; | |
83 | |
84 // Returns true if |window| can be shown for the delegate's concept of current | |
85 // user. | |
86 virtual bool CanShowWindowForUser(WmWindow* window) const = 0; | |
87 | |
88 // Returns true if the first window shown on first run should be | |
89 // unconditionally maximized, overriding the heuristic that normally chooses | |
90 // the window size. | |
91 virtual bool IsForceMaximizeOnFirstRun() const = 0; | |
92 | |
93 // Called before processing |Shell::Init()| so that the delegate | |
94 // can perform tasks necessary before the shell is initialized. | |
95 virtual void PreInit() = 0; | |
96 | |
97 // Called at the beginninig of Shell destructor so that | |
98 // delegate can use Shell instance to perform cleanup tasks. | |
99 virtual void PreShutdown() = 0; | |
100 | |
101 // Invoked when the user uses Ctrl-Shift-Q to close chrome. | |
102 virtual void Exit() = 0; | |
103 | |
104 // Create a shell-specific keyboard::KeyboardUI | |
105 virtual keyboard::KeyboardUI* CreateKeyboardUI() = 0; | |
106 | |
107 // Called when virtual keyboard has been activated/deactivated. | |
108 virtual void VirtualKeyboardActivated(bool activated) = 0; | |
109 | |
110 // Adds or removes virtual keyboard state observer. | |
111 virtual void AddVirtualKeyboardStateObserver( | |
112 VirtualKeyboardStateObserver* observer) = 0; | |
113 virtual void RemoveVirtualKeyboardStateObserver( | |
114 VirtualKeyboardStateObserver* observer) = 0; | |
115 | |
116 // Opens the |url| in a new browser tab. | |
117 virtual void OpenUrl(const GURL& url) = 0; | |
118 | |
119 // Get the AppListPresenter. Ownership stays with Chrome. | |
120 virtual app_list::AppListPresenter* GetAppListPresenter() = 0; | |
121 | |
122 // Creates a new ShelfDelegate. Shell takes ownership of the returned | |
123 // value. | |
124 virtual ShelfDelegate* CreateShelfDelegate(ShelfModel* model) = 0; | |
125 | |
126 // Creates a system-tray delegate. Shell takes ownership of the delegate. | |
127 virtual SystemTrayDelegate* CreateSystemTrayDelegate() = 0; | |
128 | |
129 // Creates a user wallpaper delegate. Shell takes ownership of the delegate. | |
130 virtual UserWallpaperDelegate* CreateUserWallpaperDelegate() = 0; | |
131 | |
132 // Creates a session state delegate. Shell takes ownership of the delegate. | |
133 virtual SessionStateDelegate* CreateSessionStateDelegate() = 0; | |
134 | |
135 // Creates a accessibility delegate. Shell takes ownership of the delegate. | |
136 virtual AccessibilityDelegate* CreateAccessibilityDelegate() = 0; | |
137 | |
138 // Creates an application delegate. Shell takes ownership of the delegate. | |
139 virtual NewWindowDelegate* CreateNewWindowDelegate() = 0; | |
140 | |
141 // Creates a media delegate. Shell takes ownership of the delegate. | |
142 virtual MediaDelegate* CreateMediaDelegate() = 0; | |
143 | |
144 virtual std::unique_ptr<PointerWatcherDelegate> | |
145 CreatePointerWatcherDelegate() = 0; | |
146 | |
147 // Creates a menu model for the |wm_shelf| and optional shelf |item|. | |
148 // If |item| is null, this creates a context menu for the desktop or shelf. | |
149 virtual ui::MenuModel* CreateContextMenu(WmShelf* wm_shelf, | |
150 const ShelfItem* item) = 0; | |
151 | |
152 // Creates a GPU support object. Shell takes ownership of the object. | |
153 virtual GPUSupport* CreateGPUSupport() = 0; | |
154 | |
155 // Get the product name. | |
156 virtual base::string16 GetProductName() const = 0; | |
157 | |
158 virtual void OpenKeyboardShortcutHelpPage() const {} | |
159 | |
160 virtual gfx::Image GetDeprecatedAcceleratorImage() const = 0; | |
161 | |
162 // Toggles the status of the touchpad / touchscreen on or off. | |
163 virtual void ToggleTouchpad() {} | |
164 virtual void ToggleTouchscreen() {} | |
165 }; | |
166 | |
167 } // namespace ash | |
168 | |
169 #endif // ASH_SHELL_DELEGATE_H_ | |
OLD | NEW |