blob: 260cf067feda5ffd4a9e80196ff2a886df17b32b [file] [log] [blame]
[email protected]262f8bd2012-03-23 19:30:271// 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]565f32fc02013-03-05 18:51:487#include <limits>
8
[email protected]f4c92b382012-08-28 00:59:599#include "ash/caps_lock_delegate_stub.h"
[email protected]fca90ea2012-12-14 04:13:3010#include "ash/host/root_window_host_factory.h"
[email protected]565f32fc02013-03-05 18:51:4811#include "ash/shell/context_menu.h"
[email protected]262f8bd2012-03-23 19:30:2712#include "ash/shell/example_factory.h"
13#include "ash/shell/launcher_delegate_impl.h"
[email protected]b77236f72012-03-25 03:07:1914#include "ash/shell/toplevel_window.h"
[email protected]262f8bd2012-03-23 19:30:2715#include "ash/shell_window_ids.h"
[email protected]ab177392012-10-10 02:34:0416#include "ash/wm/window_util.h"
[email protected]262f8bd2012-03-23 19:30:2717#include "base/message_loop.h"
18#include "ui/aura/window.h"
19
20namespace ash {
21namespace shell {
22
23ShellDelegateImpl::ShellDelegateImpl()
24 : watcher_(NULL),
25 launcher_delegate_(NULL),
[email protected]7f2af2192012-06-16 11:29:1226 locked_(false),
[email protected]db63363f2012-11-29 14:30:1227 spoken_feedback_enabled_(false),
28 high_contrast_enabled_(false),
[email protected]7585f4c2013-01-10 18:26:4129 screen_magnifier_enabled_(false),
30 screen_magnifier_type_(kDefaultMagnifierType) {
[email protected]262f8bd2012-03-23 19:30:2731}
32
33ShellDelegateImpl::~ShellDelegateImpl() {
34}
35
36void ShellDelegateImpl::SetWatcher(WindowWatcher* watcher) {
37 watcher_ = watcher;
38 if (launcher_delegate_)
39 launcher_delegate_->set_watcher(watcher);
40}
41
[email protected]5c85d5d2012-12-03 14:22:5642bool ShellDelegateImpl::IsUserLoggedIn() const {
[email protected]262f8bd2012-03-23 19:30:2743 return true;
44}
45
[email protected]5c85d5d2012-12-03 14:22:5646bool ShellDelegateImpl::IsSessionStarted() const {
[email protected]7e1df2f62012-07-19 19:17:1847 return true;
48}
49
[email protected]363b7ab2013-03-19 16:29:5950bool ShellDelegateImpl::IsGuestSession() const {
51 return false;
52}
53
[email protected]5c85d5d2012-12-03 14:22:5654bool ShellDelegateImpl::IsFirstRunAfterBoot() const {
[email protected]697f04c2012-10-03 01:15:1055 return false;
56}
57
[email protected]565f32fc02013-03-05 18:51:4858bool ShellDelegateImpl::IsRunningInForcedAppMode() const {
59 return false;
60}
61
[email protected]5c85d5d2012-12-03 14:22:5662bool ShellDelegateImpl::CanLockScreen() const {
[email protected]91545872012-11-21 13:58:2763 return true;
64}
65
[email protected]262f8bd2012-03-23 19:30:2766void ShellDelegateImpl::LockScreen() {
67 ash::shell::CreateLockScreen();
68 locked_ = true;
[email protected]c758fbf2012-03-25 22:53:5969 ash::Shell::GetInstance()->UpdateShelfVisibility();
[email protected]262f8bd2012-03-23 19:30:2770}
71
72void ShellDelegateImpl::UnlockScreen() {
73 locked_ = false;
[email protected]c758fbf2012-03-25 22:53:5974 ash::Shell::GetInstance()->UpdateShelfVisibility();
[email protected]262f8bd2012-03-23 19:30:2775}
76
77bool ShellDelegateImpl::IsScreenLocked() const {
78 return locked_;
79}
80
[email protected]dcc990722013-03-24 16:35:2081void ShellDelegateImpl::PreInit() {
82}
83
[email protected]cae97652012-04-20 03:12:1284void ShellDelegateImpl::Shutdown() {
[email protected]3528b7d2012-04-18 10:46:3685}
86
[email protected]262f8bd2012-03-23 19:30:2787void ShellDelegateImpl::Exit() {
88 MessageLoopForUI::current()->Quit();
89}
90
[email protected]343dc062012-05-25 03:16:5791void ShellDelegateImpl::NewTab() {
92}
93
[email protected]b77236f72012-03-25 03:07:1994void 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]ab177392012-10-10 02:34:04101void ShellDelegateImpl::ToggleMaximized() {
102 aura::Window* window = ash::wm::GetActiveWindow();
103 if (window)
104 ash::wm::ToggleMaximizedWindow(window);
105}
106
[email protected]41bd6d872013-02-25 14:15:54107void ShellDelegateImpl::OpenFileManager(bool as_dialog) {
[email protected]cae97652012-04-20 03:12:12108}
109
110void ShellDelegateImpl::OpenCrosh() {
111}
112
[email protected]b2e87ad2012-06-06 01:18:09113void ShellDelegateImpl::OpenMobileSetup(const std::string& service_path) {
[email protected]cae97652012-04-20 03:12:12114}
115
[email protected]343dc062012-05-25 03:16:57116void ShellDelegateImpl::RestoreTab() {
117}
118
[email protected]ce711ac2012-06-14 07:05:41119bool ShellDelegateImpl::RotatePaneFocus(Shell::Direction direction) {
120 return true;
121}
122
[email protected]b509fc32012-05-24 21:56:56123void ShellDelegateImpl::ShowKeyboardOverlay() {
[email protected]e6ae78c32012-05-15 19:14:24124}
125
[email protected]86459e2c2013-04-10 13:39:24126keyboard::KeyboardControllerProxy*
127 ShellDelegateImpl::CreateKeyboardControllerProxy() {
128 return NULL;
129}
130
[email protected]343dc062012-05-25 03:16:57131void ShellDelegateImpl::ShowTaskManager() {
132}
133
[email protected]24af4972012-05-04 19:42:18134content::BrowserContext* ShellDelegateImpl::GetCurrentBrowserContext() {
135 return Shell::GetInstance()->browser_context();
136}
137
[email protected]467585b2012-12-13 04:52:36138void ShellDelegateImpl::ToggleSpokenFeedback(
139 AccessibilityNotificationVisibility notify) {
[email protected]7f2af2192012-06-16 11:29:12140 spoken_feedback_enabled_ = !spoken_feedback_enabled_;
141}
142
143bool ShellDelegateImpl::IsSpokenFeedbackEnabled() const {
144 return spoken_feedback_enabled_;
[email protected]ce3d7682012-05-02 23:01:41145}
146
[email protected]db63363f2012-11-29 14:30:12147void ShellDelegateImpl::ToggleHighContrast() {
148 high_contrast_enabled_ = !high_contrast_enabled_;
149}
150
151bool ShellDelegateImpl::IsHighContrastEnabled() const {
152 return high_contrast_enabled_;
153}
154
[email protected]7585f4c2013-01-10 18:26:41155void ShellDelegateImpl::SetMagnifierEnabled(bool enabled) {
156 screen_magnifier_enabled_ = enabled;
157}
158
159void ShellDelegateImpl::SetMagnifierType(MagnifierType type) {
[email protected]db63363f2012-11-29 14:30:12160 screen_magnifier_type_ = type;
161}
162
[email protected]7585f4c2013-01-10 18:26:41163bool ShellDelegateImpl::IsMagnifierEnabled() const {
164 return screen_magnifier_enabled_;
165}
166
[email protected]db63363f2012-11-29 14:30:12167MagnifierType ShellDelegateImpl::GetMagnifierType() const {
168 return screen_magnifier_type_;
169}
170
171bool ShellDelegateImpl::ShouldAlwaysShowAccessibilityMenu() const {
172 return false;
173}
174
[email protected]0039db92012-05-09 04:11:45175app_list::AppListViewDelegate* ShellDelegateImpl::CreateAppListViewDelegate() {
[email protected]262f8bd2012-03-23 19:30:27176 return ash::shell::CreateAppListViewDelegate();
177}
178
[email protected]262f8bd2012-03-23 19:30:27179ash::LauncherDelegate* ShellDelegateImpl::CreateLauncherDelegate(
180 ash::LauncherModel* model) {
181 launcher_delegate_ = new LauncherDelegateImpl(watcher_);
182 return launcher_delegate_;
183}
184
[email protected]51ed5992012-11-07 10:14:39185ash::SystemTrayDelegate* ShellDelegateImpl::CreateSystemTrayDelegate() {
[email protected]262f8bd2012-03-23 19:30:27186 return NULL;
187}
188
189ash::UserWallpaperDelegate* ShellDelegateImpl::CreateUserWallpaperDelegate() {
190 return NULL;
191}
[email protected]4d7ce4352012-07-13 06:56:06192
[email protected]f4c92b382012-08-28 00:59:59193ash::CapsLockDelegate* ShellDelegateImpl::CreateCapsLockDelegate() {
194 return new CapsLockDelegateStub;
195}
196
[email protected]c28853612012-05-31 22:43:44197aura::client::UserActionClient* ShellDelegateImpl::CreateUserActionClient() {
198 return NULL;
199}
[email protected]262f8bd2012-03-23 19:30:27200
[email protected]4d7ce4352012-07-13 06:56:06201void ShellDelegateImpl::OpenFeedbackPage() {
202}
203
[email protected]6cae3d0b2012-07-20 00:58:48204void ShellDelegateImpl::RecordUserMetricsAction(UserMetricsAction action) {
205}
206
[email protected]e54e8192012-08-27 17:38:00207void ShellDelegateImpl::HandleMediaNextTrack() {
208}
209
210void ShellDelegateImpl::HandleMediaPlayPause() {
211}
212
213void ShellDelegateImpl::HandleMediaPrevTrack() {
214}
215
[email protected]4468dd12012-08-30 17:17:20216string16 ShellDelegateImpl::GetTimeRemainingString(base::TimeDelta delta) {
217 return string16();
218}
219
[email protected]b98beff2012-11-28 18:52:02220string16 ShellDelegateImpl::GetTimeDurationLongString(base::TimeDelta delta) {
221 return string16();
222}
223
[email protected]4da73a712012-09-27 19:12:48224void ShellDelegateImpl::SaveScreenMagnifierScale(double scale) {
225}
226
227double ShellDelegateImpl::GetSavedScreenMagnifierScale() {
228 return std::numeric_limits<double>::min();
229}
230
[email protected]431552c2012-10-23 00:38:33231ui::MenuModel* ShellDelegateImpl::CreateContextMenu(aura::RootWindow* root) {
232 return new ContextMenu(root);
233}
234
[email protected]fca90ea2012-12-14 04:13:30235RootWindowHostFactory* ShellDelegateImpl::CreateRootWindowHostFactory() {
236 return RootWindowHostFactory::Create();
237}
238
[email protected]5673bf52013-02-01 06:14:24239string16 ShellDelegateImpl::GetProductName() const {
240 return string16();
241}
242
[email protected]262f8bd2012-03-23 19:30:27243} // namespace shell
244} // namespace ash