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