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