[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 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 | #include "ash/shell/shell_delegate_impl.h" | ||||
6 | |||||
[email protected] | 565f32fc0 | 2013-03-05 18:51:48 | [diff] [blame] | 7 | #include <limits> |
8 | |||||
[email protected] | f4c92b38 | 2012-08-28 00:59:59 | [diff] [blame] | 9 | #include "ash/caps_lock_delegate_stub.h" |
[email protected] | fca90ea | 2012-12-14 04:13:30 | [diff] [blame] | 10 | #include "ash/host/root_window_host_factory.h" |
[email protected] | 565f32fc0 | 2013-03-05 18:51:48 | [diff] [blame] | 11 | #include "ash/shell/context_menu.h" |
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 12 | #include "ash/shell/example_factory.h" |
13 | #include "ash/shell/launcher_delegate_impl.h" | ||||
[email protected] | b77236f7 | 2012-03-25 03:07:19 | [diff] [blame] | 14 | #include "ash/shell/toplevel_window.h" |
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 15 | #include "ash/shell_window_ids.h" |
[email protected] | ab17739 | 2012-10-10 02:34:04 | [diff] [blame] | 16 | #include "ash/wm/window_util.h" |
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 17 | #include "base/message_loop.h" |
18 | #include "ui/aura/window.h" | ||||
19 | |||||
20 | namespace ash { | ||||
21 | namespace shell { | ||||
22 | |||||
23 | ShellDelegateImpl::ShellDelegateImpl() | ||||
24 | : watcher_(NULL), | ||||
25 | launcher_delegate_(NULL), | ||||
[email protected] | 7f2af219 | 2012-06-16 11:29:12 | [diff] [blame] | 26 | locked_(false), |
[email protected] | db63363f | 2012-11-29 14:30:12 | [diff] [blame] | 27 | spoken_feedback_enabled_(false), |
28 | high_contrast_enabled_(false), | ||||
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 29 | screen_magnifier_enabled_(false), |
30 | screen_magnifier_type_(kDefaultMagnifierType) { | ||||
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 31 | } |
32 | |||||
33 | ShellDelegateImpl::~ShellDelegateImpl() { | ||||
34 | } | ||||
35 | |||||
36 | void ShellDelegateImpl::SetWatcher(WindowWatcher* watcher) { | ||||
37 | watcher_ = watcher; | ||||
38 | if (launcher_delegate_) | ||||
39 | launcher_delegate_->set_watcher(watcher); | ||||
40 | } | ||||
41 | |||||
[email protected] | 5c85d5d | 2012-12-03 14:22:56 | [diff] [blame] | 42 | bool ShellDelegateImpl::IsUserLoggedIn() const { |
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 43 | return true; |
44 | } | ||||
45 | |||||
[email protected] | 5c85d5d | 2012-12-03 14:22:56 | [diff] [blame] | 46 | bool ShellDelegateImpl::IsSessionStarted() const { |
[email protected] | 7e1df2f6 | 2012-07-19 19:17:18 | [diff] [blame] | 47 | return true; |
48 | } | ||||
49 | |||||
[email protected] | 363b7ab | 2013-03-19 16:29:59 | [diff] [blame] | 50 | bool ShellDelegateImpl::IsGuestSession() const { |
51 | return false; | ||||
52 | } | ||||
53 | |||||
[email protected] | 5c85d5d | 2012-12-03 14:22:56 | [diff] [blame] | 54 | bool ShellDelegateImpl::IsFirstRunAfterBoot() const { |
[email protected] | 697f04c | 2012-10-03 01:15:10 | [diff] [blame] | 55 | return false; |
56 | } | ||||
57 | |||||
[email protected] | 565f32fc0 | 2013-03-05 18:51:48 | [diff] [blame] | 58 | bool ShellDelegateImpl::IsRunningInForcedAppMode() const { |
59 | return false; | ||||
60 | } | ||||
61 | |||||
[email protected] | 5c85d5d | 2012-12-03 14:22:56 | [diff] [blame] | 62 | bool ShellDelegateImpl::CanLockScreen() const { |
[email protected] | 9154587 | 2012-11-21 13:58:27 | [diff] [blame] | 63 | return true; |
64 | } | ||||
65 | |||||
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 66 | void ShellDelegateImpl::LockScreen() { |
67 | ash::shell::CreateLockScreen(); | ||||
68 | locked_ = true; | ||||
[email protected] | c758fbf | 2012-03-25 22:53:59 | [diff] [blame] | 69 | ash::Shell::GetInstance()->UpdateShelfVisibility(); |
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 70 | } |
71 | |||||
72 | void ShellDelegateImpl::UnlockScreen() { | ||||
73 | locked_ = false; | ||||
[email protected] | c758fbf | 2012-03-25 22:53:59 | [diff] [blame] | 74 | ash::Shell::GetInstance()->UpdateShelfVisibility(); |
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 75 | } |
76 | |||||
77 | bool ShellDelegateImpl::IsScreenLocked() const { | ||||
78 | return locked_; | ||||
79 | } | ||||
80 | |||||
[email protected] | dcc99072 | 2013-03-24 16:35:20 | [diff] [blame] | 81 | void ShellDelegateImpl::PreInit() { |
82 | } | ||||
83 | |||||
[email protected] | cae9765 | 2012-04-20 03:12:12 | [diff] [blame] | 84 | void ShellDelegateImpl::Shutdown() { |
[email protected] | 3528b7d | 2012-04-18 10:46:36 | [diff] [blame] | 85 | } |
86 | |||||
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 87 | void ShellDelegateImpl::Exit() { |
88 | MessageLoopForUI::current()->Quit(); | ||||
89 | } | ||||
90 | |||||
[email protected] | 343dc06 | 2012-05-25 03:16:57 | [diff] [blame] | 91 | void ShellDelegateImpl::NewTab() { |
92 | } | ||||
93 | |||||
[email protected] | b77236f7 | 2012-03-25 03:07:19 | [diff] [blame] | 94 | void ShellDelegateImpl::NewWindow(bool incognito) { |
95 | ash::shell::ToplevelWindow::CreateParams create_params; | ||||
96 | create_params.can_resize = true; | ||||
97 | create_params.can_maximize = true; | ||||
98 | ash::shell::ToplevelWindow::CreateToplevelWindow(create_params); | ||||
99 | } | ||||
100 | |||||
[email protected] | ab17739 | 2012-10-10 02:34:04 | [diff] [blame] | 101 | void ShellDelegateImpl::ToggleMaximized() { |
102 | aura::Window* window = ash::wm::GetActiveWindow(); | ||||
103 | if (window) | ||||
104 | ash::wm::ToggleMaximizedWindow(window); | ||||
105 | } | ||||
106 | |||||
[email protected] | 41bd6d87 | 2013-02-25 14:15:54 | [diff] [blame] | 107 | void ShellDelegateImpl::OpenFileManager(bool as_dialog) { |
[email protected] | cae9765 | 2012-04-20 03:12:12 | [diff] [blame] | 108 | } |
109 | |||||
110 | void ShellDelegateImpl::OpenCrosh() { | ||||
111 | } | ||||
112 | |||||
[email protected] | b2e87ad | 2012-06-06 01:18:09 | [diff] [blame] | 113 | void ShellDelegateImpl::OpenMobileSetup(const std::string& service_path) { |
[email protected] | cae9765 | 2012-04-20 03:12:12 | [diff] [blame] | 114 | } |
115 | |||||
[email protected] | 343dc06 | 2012-05-25 03:16:57 | [diff] [blame] | 116 | void ShellDelegateImpl::RestoreTab() { |
117 | } | ||||
118 | |||||
[email protected] | ce711ac | 2012-06-14 07:05:41 | [diff] [blame] | 119 | bool ShellDelegateImpl::RotatePaneFocus(Shell::Direction direction) { |
120 | return true; | ||||
121 | } | ||||
122 | |||||
[email protected] | b509fc3 | 2012-05-24 21:56:56 | [diff] [blame] | 123 | void ShellDelegateImpl::ShowKeyboardOverlay() { |
[email protected] | e6ae78c3 | 2012-05-15 19:14:24 | [diff] [blame] | 124 | } |
125 | |||||
[email protected] | 86459e2c | 2013-04-10 13:39:24 | [diff] [blame^] | 126 | keyboard::KeyboardControllerProxy* |
127 | ShellDelegateImpl::CreateKeyboardControllerProxy() { | ||||
128 | return NULL; | ||||
129 | } | ||||
130 | |||||
[email protected] | 343dc06 | 2012-05-25 03:16:57 | [diff] [blame] | 131 | void ShellDelegateImpl::ShowTaskManager() { |
132 | } | ||||
133 | |||||
[email protected] | 24af497 | 2012-05-04 19:42:18 | [diff] [blame] | 134 | content::BrowserContext* ShellDelegateImpl::GetCurrentBrowserContext() { |
135 | return Shell::GetInstance()->browser_context(); | ||||
136 | } | ||||
137 | |||||
[email protected] | 467585b | 2012-12-13 04:52:36 | [diff] [blame] | 138 | void ShellDelegateImpl::ToggleSpokenFeedback( |
139 | AccessibilityNotificationVisibility notify) { | ||||
[email protected] | 7f2af219 | 2012-06-16 11:29:12 | [diff] [blame] | 140 | spoken_feedback_enabled_ = !spoken_feedback_enabled_; |
141 | } | ||||
142 | |||||
143 | bool ShellDelegateImpl::IsSpokenFeedbackEnabled() const { | ||||
144 | return spoken_feedback_enabled_; | ||||
[email protected] | ce3d768 | 2012-05-02 23:01:41 | [diff] [blame] | 145 | } |
146 | |||||
[email protected] | db63363f | 2012-11-29 14:30:12 | [diff] [blame] | 147 | void ShellDelegateImpl::ToggleHighContrast() { |
148 | high_contrast_enabled_ = !high_contrast_enabled_; | ||||
149 | } | ||||
150 | |||||
151 | bool ShellDelegateImpl::IsHighContrastEnabled() const { | ||||
152 | return high_contrast_enabled_; | ||||
153 | } | ||||
154 | |||||
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 155 | void ShellDelegateImpl::SetMagnifierEnabled(bool enabled) { |
156 | screen_magnifier_enabled_ = enabled; | ||||
157 | } | ||||
158 | |||||
159 | void ShellDelegateImpl::SetMagnifierType(MagnifierType type) { | ||||
[email protected] | db63363f | 2012-11-29 14:30:12 | [diff] [blame] | 160 | screen_magnifier_type_ = type; |
161 | } | ||||
162 | |||||
[email protected] | 7585f4c | 2013-01-10 18:26:41 | [diff] [blame] | 163 | bool ShellDelegateImpl::IsMagnifierEnabled() const { |
164 | return screen_magnifier_enabled_; | ||||
165 | } | ||||
166 | |||||
[email protected] | db63363f | 2012-11-29 14:30:12 | [diff] [blame] | 167 | MagnifierType ShellDelegateImpl::GetMagnifierType() const { |
168 | return screen_magnifier_type_; | ||||
169 | } | ||||
170 | |||||
171 | bool ShellDelegateImpl::ShouldAlwaysShowAccessibilityMenu() const { | ||||
172 | return false; | ||||
173 | } | ||||
174 | |||||
[email protected] | 0039db9 | 2012-05-09 04:11:45 | [diff] [blame] | 175 | app_list::AppListViewDelegate* ShellDelegateImpl::CreateAppListViewDelegate() { |
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 176 | return ash::shell::CreateAppListViewDelegate(); |
177 | } | ||||
178 | |||||
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 179 | ash::LauncherDelegate* ShellDelegateImpl::CreateLauncherDelegate( |
180 | ash::LauncherModel* model) { | ||||
181 | launcher_delegate_ = new LauncherDelegateImpl(watcher_); | ||||
182 | return launcher_delegate_; | ||||
183 | } | ||||
184 | |||||
[email protected] | 51ed599 | 2012-11-07 10:14:39 | [diff] [blame] | 185 | ash::SystemTrayDelegate* ShellDelegateImpl::CreateSystemTrayDelegate() { |
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 186 | return NULL; |
187 | } | ||||
188 | |||||
189 | ash::UserWallpaperDelegate* ShellDelegateImpl::CreateUserWallpaperDelegate() { | ||||
190 | return NULL; | ||||
191 | } | ||||
[email protected] | 4d7ce435 | 2012-07-13 06:56:06 | [diff] [blame] | 192 | |
[email protected] | f4c92b38 | 2012-08-28 00:59:59 | [diff] [blame] | 193 | ash::CapsLockDelegate* ShellDelegateImpl::CreateCapsLockDelegate() { |
194 | return new CapsLockDelegateStub; | ||||
195 | } | ||||
196 | |||||
[email protected] | c2885361 | 2012-05-31 22:43:44 | [diff] [blame] | 197 | aura::client::UserActionClient* ShellDelegateImpl::CreateUserActionClient() { |
198 | return NULL; | ||||
199 | } | ||||
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 200 | |
[email protected] | 4d7ce435 | 2012-07-13 06:56:06 | [diff] [blame] | 201 | void ShellDelegateImpl::OpenFeedbackPage() { |
202 | } | ||||
203 | |||||
[email protected] | 6cae3d0b | 2012-07-20 00:58:48 | [diff] [blame] | 204 | void ShellDelegateImpl::RecordUserMetricsAction(UserMetricsAction action) { |
205 | } | ||||
206 | |||||
[email protected] | e54e819 | 2012-08-27 17:38:00 | [diff] [blame] | 207 | void ShellDelegateImpl::HandleMediaNextTrack() { |
208 | } | ||||
209 | |||||
210 | void ShellDelegateImpl::HandleMediaPlayPause() { | ||||
211 | } | ||||
212 | |||||
213 | void ShellDelegateImpl::HandleMediaPrevTrack() { | ||||
214 | } | ||||
215 | |||||
[email protected] | 4468dd1 | 2012-08-30 17:17:20 | [diff] [blame] | 216 | string16 ShellDelegateImpl::GetTimeRemainingString(base::TimeDelta delta) { |
217 | return string16(); | ||||
218 | } | ||||
219 | |||||
[email protected] | b98beff | 2012-11-28 18:52:02 | [diff] [blame] | 220 | string16 ShellDelegateImpl::GetTimeDurationLongString(base::TimeDelta delta) { |
221 | return string16(); | ||||
222 | } | ||||
223 | |||||
[email protected] | 4da73a71 | 2012-09-27 19:12:48 | [diff] [blame] | 224 | void ShellDelegateImpl::SaveScreenMagnifierScale(double scale) { |
225 | } | ||||
226 | |||||
227 | double ShellDelegateImpl::GetSavedScreenMagnifierScale() { | ||||
228 | return std::numeric_limits<double>::min(); | ||||
229 | } | ||||
230 | |||||
[email protected] | 431552c | 2012-10-23 00:38:33 | [diff] [blame] | 231 | ui::MenuModel* ShellDelegateImpl::CreateContextMenu(aura::RootWindow* root) { |
232 | return new ContextMenu(root); | ||||
233 | } | ||||
234 | |||||
[email protected] | fca90ea | 2012-12-14 04:13:30 | [diff] [blame] | 235 | RootWindowHostFactory* ShellDelegateImpl::CreateRootWindowHostFactory() { |
236 | return RootWindowHostFactory::Create(); | ||||
237 | } | ||||
238 | |||||
[email protected] | 5673bf5 | 2013-02-01 06:14:24 | [diff] [blame] | 239 | string16 ShellDelegateImpl::GetProductName() const { |
240 | return string16(); | ||||
241 | } | ||||
242 | |||||
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 243 | } // namespace shell |
244 | } // namespace ash |