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