blob: eb6839c40d9620226f974f680c5fc9fd5245e0af [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]eff4c7f2013-08-13 01:45:5011#include "ash/keyboard_controller_proxy_stub.h"
[email protected]fcb123d2013-04-17 15:58:4912#include "ash/session_state_delegate.h"
13#include "ash/session_state_delegate_stub.h"
[email protected]565f32fc02013-03-05 18:51:4814#include "ash/shell/context_menu.h"
[email protected]262f8bd2012-03-23 19:30:2715#include "ash/shell/example_factory.h"
16#include "ash/shell/launcher_delegate_impl.h"
[email protected]b77236f72012-03-25 03:07:1917#include "ash/shell/toplevel_window.h"
[email protected]262f8bd2012-03-23 19:30:2718#include "ash/shell_window_ids.h"
[email protected]9f19d5c2013-09-13 17:01:4819#include "ash/system/tray/default_system_tray_delegate.h"
[email protected]a41b4e12013-09-20 04:36:3420#include "ash/wm/window_state.h"
[email protected]9e3e6352013-07-17 04:07:5121#include "base/message_loop/message_loop.h"
[email protected]262f8bd2012-03-23 19:30:2722#include "ui/aura/window.h"
[email protected]f1d5c3a2013-04-23 17:42:5623#include "ui/views/corewm/input_method_event_filter.h"
[email protected]262f8bd2012-03-23 19:30:2724
25namespace ash {
26namespace shell {
27
28ShellDelegateImpl::ShellDelegateImpl()
29 : watcher_(NULL),
30 launcher_delegate_(NULL),
[email protected]db63363f2012-11-29 14:30:1231 spoken_feedback_enabled_(false),
32 high_contrast_enabled_(false),
[email protected]7585f4c2013-01-10 18:26:4133 screen_magnifier_enabled_(false),
[email protected]57999022013-06-07 12:52:0334 screen_magnifier_type_(kDefaultMagnifierType),
35 large_cursor_enabled_(false) {
[email protected]262f8bd2012-03-23 19:30:2736}
37
38ShellDelegateImpl::~ShellDelegateImpl() {
39}
40
41void ShellDelegateImpl::SetWatcher(WindowWatcher* watcher) {
42 watcher_ = watcher;
43 if (launcher_delegate_)
44 launcher_delegate_->set_watcher(watcher);
45}
46
[email protected]5c85d5d2012-12-03 14:22:5647bool ShellDelegateImpl::IsFirstRunAfterBoot() const {
[email protected]697f04c2012-10-03 01:15:1048 return false;
49}
50
[email protected]e718e6f2013-04-15 16:01:5951bool ShellDelegateImpl::IsMultiProfilesEnabled() const {
52 return false;
53}
54
[email protected]565f32fc02013-03-05 18:51:4855bool ShellDelegateImpl::IsRunningInForcedAppMode() const {
56 return false;
57}
58
[email protected]dcc990722013-03-24 16:35:2059void ShellDelegateImpl::PreInit() {
60}
61
[email protected]cae97652012-04-20 03:12:1262void ShellDelegateImpl::Shutdown() {
[email protected]3528b7d2012-04-18 10:46:3663}
64
[email protected]262f8bd2012-03-23 19:30:2765void ShellDelegateImpl::Exit() {
[email protected]bd9a7f32013-04-30 20:25:4266 base::MessageLoopForUI::current()->Quit();
[email protected]262f8bd2012-03-23 19:30:2767}
68
[email protected]343dc062012-05-25 03:16:5769void ShellDelegateImpl::NewTab() {
70}
71
[email protected]b77236f72012-03-25 03:07:1972void 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]e9e90252013-04-24 09:05:5779void ShellDelegateImpl::ToggleFullscreen() {
80 ToggleMaximized();
81}
82
[email protected]ab177392012-10-10 02:34:0483void ShellDelegateImpl::ToggleMaximized() {
[email protected]a41b4e12013-09-20 04:36:3484 wm::WindowState* window_state = wm::GetActiveWindowState();
85 if (window_state)
86 window_state->ToggleMaximized();
[email protected]ab177392012-10-10 02:34:0487}
88
[email protected]41bd6d872013-02-25 14:15:5489void ShellDelegateImpl::OpenFileManager(bool as_dialog) {
[email protected]cae97652012-04-20 03:12:1290}
91
92void ShellDelegateImpl::OpenCrosh() {
93}
94
[email protected]343dc062012-05-25 03:16:5795void ShellDelegateImpl::RestoreTab() {
96}
97
[email protected]b509fc32012-05-24 21:56:5698void ShellDelegateImpl::ShowKeyboardOverlay() {
[email protected]e6ae78c32012-05-15 19:14:2499}
100
[email protected]86459e2c2013-04-10 13:39:24101keyboard::KeyboardControllerProxy*
102 ShellDelegateImpl::CreateKeyboardControllerProxy() {
[email protected]eff4c7f2013-08-13 01:45:50103 return new KeyboardControllerProxyStub();
[email protected]86459e2c2013-04-10 13:39:24104}
105
[email protected]343dc062012-05-25 03:16:57106void ShellDelegateImpl::ShowTaskManager() {
107}
108
[email protected]24af4972012-05-04 19:42:18109content::BrowserContext* ShellDelegateImpl::GetCurrentBrowserContext() {
110 return Shell::GetInstance()->browser_context();
111}
112
[email protected]467585b2012-12-13 04:52:36113void ShellDelegateImpl::ToggleSpokenFeedback(
114 AccessibilityNotificationVisibility notify) {
[email protected]7f2af2192012-06-16 11:29:12115 spoken_feedback_enabled_ = !spoken_feedback_enabled_;
116}
117
118bool ShellDelegateImpl::IsSpokenFeedbackEnabled() const {
119 return spoken_feedback_enabled_;
[email protected]ce3d7682012-05-02 23:01:41120}
121
[email protected]db63363f2012-11-29 14:30:12122void ShellDelegateImpl::ToggleHighContrast() {
123 high_contrast_enabled_ = !high_contrast_enabled_;
124}
125
126bool ShellDelegateImpl::IsHighContrastEnabled() const {
127 return high_contrast_enabled_;
128}
129
[email protected]7585f4c2013-01-10 18:26:41130void ShellDelegateImpl::SetMagnifierEnabled(bool enabled) {
131 screen_magnifier_enabled_ = enabled;
132}
133
134void ShellDelegateImpl::SetMagnifierType(MagnifierType type) {
[email protected]db63363f2012-11-29 14:30:12135 screen_magnifier_type_ = type;
136}
137
[email protected]7585f4c2013-01-10 18:26:41138bool ShellDelegateImpl::IsMagnifierEnabled() const {
139 return screen_magnifier_enabled_;
140}
141
[email protected]db63363f2012-11-29 14:30:12142MagnifierType ShellDelegateImpl::GetMagnifierType() const {
143 return screen_magnifier_type_;
144}
145
[email protected]57999022013-06-07 12:52:03146void ShellDelegateImpl::SetLargeCursorEnabled(bool enabled) {
147 large_cursor_enabled_ = enabled;
148}
149
150bool ShellDelegateImpl::IsLargeCursorEnabled() const {
151 return large_cursor_enabled_;
152}
153
[email protected]db63363f2012-11-29 14:30:12154bool ShellDelegateImpl::ShouldAlwaysShowAccessibilityMenu() const {
155 return false;
156}
157
[email protected]319b944a2013-05-02 22:14:09158void ShellDelegateImpl::SilenceSpokenFeedback() const {
159}
160
[email protected]0039db92012-05-09 04:11:45161app_list::AppListViewDelegate* ShellDelegateImpl::CreateAppListViewDelegate() {
[email protected]262f8bd2012-03-23 19:30:27162 return ash::shell::CreateAppListViewDelegate();
163}
164
[email protected]262f8bd2012-03-23 19:30:27165ash::LauncherDelegate* ShellDelegateImpl::CreateLauncherDelegate(
166 ash::LauncherModel* model) {
167 launcher_delegate_ = new LauncherDelegateImpl(watcher_);
168 return launcher_delegate_;
169}
170
[email protected]51ed5992012-11-07 10:14:39171ash::SystemTrayDelegate* ShellDelegateImpl::CreateSystemTrayDelegate() {
[email protected]9f19d5c2013-09-13 17:01:48172 return new DefaultSystemTrayDelegate;
[email protected]262f8bd2012-03-23 19:30:27173}
174
175ash::UserWallpaperDelegate* ShellDelegateImpl::CreateUserWallpaperDelegate() {
176 return NULL;
177}
[email protected]4d7ce4352012-07-13 06:56:06178
[email protected]f4c92b382012-08-28 00:59:59179ash::CapsLockDelegate* ShellDelegateImpl::CreateCapsLockDelegate() {
180 return new CapsLockDelegateStub;
181}
182
[email protected]fcb123d2013-04-17 15:58:49183ash::SessionStateDelegate* ShellDelegateImpl::CreateSessionStateDelegate() {
184 return new SessionStateDelegateStub;
185}
186
[email protected]c28853612012-05-31 22:43:44187aura::client::UserActionClient* ShellDelegateImpl::CreateUserActionClient() {
188 return NULL;
189}
[email protected]262f8bd2012-03-23 19:30:27190
[email protected]4d7ce4352012-07-13 06:56:06191void ShellDelegateImpl::OpenFeedbackPage() {
192}
193
[email protected]6cae3d0b2012-07-20 00:58:48194void ShellDelegateImpl::RecordUserMetricsAction(UserMetricsAction action) {
195}
196
[email protected]e54e8192012-08-27 17:38:00197void ShellDelegateImpl::HandleMediaNextTrack() {
198}
199
200void ShellDelegateImpl::HandleMediaPlayPause() {
201}
202
203void ShellDelegateImpl::HandleMediaPrevTrack() {
204}
205
[email protected]4da73a712012-09-27 19:12:48206void ShellDelegateImpl::SaveScreenMagnifierScale(double scale) {
207}
208
209double ShellDelegateImpl::GetSavedScreenMagnifierScale() {
210 return std::numeric_limits<double>::min();
211}
212
[email protected]431552c2012-10-23 00:38:33213ui::MenuModel* ShellDelegateImpl::CreateContextMenu(aura::RootWindow* root) {
214 return new ContextMenu(root);
215}
216
[email protected]fca90ea2012-12-14 04:13:30217RootWindowHostFactory* ShellDelegateImpl::CreateRootWindowHostFactory() {
218 return RootWindowHostFactory::Create();
219}
220
[email protected]ed95e022013-04-11 04:03:32221base::string16 ShellDelegateImpl::GetProductName() const {
222 return base::string16();
[email protected]5673bf52013-02-01 06:14:24223}
224
[email protected]262f8bd2012-03-23 19:30:27225} // namespace shell
226} // namespace ash