blob: f7899838d83450dab34a6327550bf183850bf054 [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]f4c92b382012-08-28 00:59:597#include "ash/caps_lock_delegate_stub.h"
[email protected]fca90ea2012-12-14 04:13:308#include "ash/host/root_window_host_factory.h"
[email protected]262f8bd2012-03-23 19:30:279#include "ash/shell/example_factory.h"
10#include "ash/shell/launcher_delegate_impl.h"
[email protected]431552c2012-10-23 00:38:3311#include "ash/shell/context_menu.h"
[email protected]b77236f72012-03-25 03:07:1912#include "ash/shell/toplevel_window.h"
[email protected]262f8bd2012-03-23 19:30:2713#include "ash/shell_window_ids.h"
[email protected]ab177392012-10-10 02:34:0414#include "ash/wm/window_util.h"
[email protected]262f8bd2012-03-23 19:30:2715#include "base/message_loop.h"
16#include "ui/aura/window.h"
17
18namespace ash {
19namespace shell {
20
21ShellDelegateImpl::ShellDelegateImpl()
22 : watcher_(NULL),
23 launcher_delegate_(NULL),
[email protected]7f2af2192012-06-16 11:29:1224 locked_(false),
[email protected]db63363f2012-11-29 14:30:1225 spoken_feedback_enabled_(false),
26 high_contrast_enabled_(false),
[email protected]7585f4c2013-01-10 18:26:4127 screen_magnifier_enabled_(false),
28 screen_magnifier_type_(kDefaultMagnifierType) {
[email protected]262f8bd2012-03-23 19:30:2729}
30
31ShellDelegateImpl::~ShellDelegateImpl() {
32}
33
34void ShellDelegateImpl::SetWatcher(WindowWatcher* watcher) {
35 watcher_ = watcher;
36 if (launcher_delegate_)
37 launcher_delegate_->set_watcher(watcher);
38}
39
[email protected]5c85d5d2012-12-03 14:22:5640bool ShellDelegateImpl::IsUserLoggedIn() const {
[email protected]262f8bd2012-03-23 19:30:2741 return true;
42}
43
[email protected]5c85d5d2012-12-03 14:22:5644bool ShellDelegateImpl::IsSessionStarted() const {
[email protected]7e1df2f62012-07-19 19:17:1845 return true;
46}
47
[email protected]5c85d5d2012-12-03 14:22:5648bool ShellDelegateImpl::IsFirstRunAfterBoot() const {
[email protected]697f04c2012-10-03 01:15:1049 return false;
50}
51
[email protected]5c85d5d2012-12-03 14:22:5652bool ShellDelegateImpl::CanLockScreen() const {
[email protected]91545872012-11-21 13:58:2753 return true;
54}
55
[email protected]262f8bd2012-03-23 19:30:2756void ShellDelegateImpl::LockScreen() {
57 ash::shell::CreateLockScreen();
58 locked_ = true;
[email protected]c758fbf2012-03-25 22:53:5959 ash::Shell::GetInstance()->UpdateShelfVisibility();
[email protected]262f8bd2012-03-23 19:30:2760}
61
62void ShellDelegateImpl::UnlockScreen() {
63 locked_ = false;
[email protected]c758fbf2012-03-25 22:53:5964 ash::Shell::GetInstance()->UpdateShelfVisibility();
[email protected]262f8bd2012-03-23 19:30:2765}
66
67bool ShellDelegateImpl::IsScreenLocked() const {
68 return locked_;
69}
70
[email protected]cae97652012-04-20 03:12:1271void ShellDelegateImpl::Shutdown() {
[email protected]3528b7d2012-04-18 10:46:3672}
73
[email protected]262f8bd2012-03-23 19:30:2774void ShellDelegateImpl::Exit() {
75 MessageLoopForUI::current()->Quit();
76}
77
[email protected]343dc062012-05-25 03:16:5778void ShellDelegateImpl::NewTab() {
79}
80
[email protected]b77236f72012-03-25 03:07:1981void 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]ab177392012-10-10 02:34:0488void ShellDelegateImpl::ToggleMaximized() {
89 aura::Window* window = ash::wm::GetActiveWindow();
90 if (window)
91 ash::wm::ToggleMaximizedWindow(window);
92}
93
[email protected]a5fdb932012-12-11 18:32:4494void ShellDelegateImpl::OpenFileManager() {
[email protected]cae97652012-04-20 03:12:1295}
96
97void ShellDelegateImpl::OpenCrosh() {
98}
99
[email protected]b2e87ad2012-06-06 01:18:09100void ShellDelegateImpl::OpenMobileSetup(const std::string& service_path) {
[email protected]cae97652012-04-20 03:12:12101}
102
[email protected]343dc062012-05-25 03:16:57103void ShellDelegateImpl::RestoreTab() {
104}
105
[email protected]ce711ac2012-06-14 07:05:41106bool ShellDelegateImpl::RotatePaneFocus(Shell::Direction direction) {
107 return true;
108}
109
[email protected]b509fc32012-05-24 21:56:56110void ShellDelegateImpl::ShowKeyboardOverlay() {
[email protected]e6ae78c32012-05-15 19:14:24111}
112
[email protected]343dc062012-05-25 03:16:57113void ShellDelegateImpl::ShowTaskManager() {
114}
115
[email protected]24af4972012-05-04 19:42:18116content::BrowserContext* ShellDelegateImpl::GetCurrentBrowserContext() {
117 return Shell::GetInstance()->browser_context();
118}
119
[email protected]467585b2012-12-13 04:52:36120void ShellDelegateImpl::ToggleSpokenFeedback(
121 AccessibilityNotificationVisibility notify) {
[email protected]7f2af2192012-06-16 11:29:12122 spoken_feedback_enabled_ = !spoken_feedback_enabled_;
123}
124
125bool ShellDelegateImpl::IsSpokenFeedbackEnabled() const {
126 return spoken_feedback_enabled_;
[email protected]ce3d7682012-05-02 23:01:41127}
128
[email protected]db63363f2012-11-29 14:30:12129void ShellDelegateImpl::ToggleHighContrast() {
130 high_contrast_enabled_ = !high_contrast_enabled_;
131}
132
133bool ShellDelegateImpl::IsHighContrastEnabled() const {
134 return high_contrast_enabled_;
135}
136
[email protected]7585f4c2013-01-10 18:26:41137void ShellDelegateImpl::SetMagnifierEnabled(bool enabled) {
138 screen_magnifier_enabled_ = enabled;
139}
140
141void ShellDelegateImpl::SetMagnifierType(MagnifierType type) {
[email protected]db63363f2012-11-29 14:30:12142 screen_magnifier_type_ = type;
143}
144
[email protected]7585f4c2013-01-10 18:26:41145bool ShellDelegateImpl::IsMagnifierEnabled() const {
146 return screen_magnifier_enabled_;
147}
148
[email protected]db63363f2012-11-29 14:30:12149MagnifierType ShellDelegateImpl::GetMagnifierType() const {
150 return screen_magnifier_type_;
151}
152
153bool ShellDelegateImpl::ShouldAlwaysShowAccessibilityMenu() const {
154 return false;
155}
156
[email protected]0039db92012-05-09 04:11:45157app_list::AppListViewDelegate* ShellDelegateImpl::CreateAppListViewDelegate() {
[email protected]262f8bd2012-03-23 19:30:27158 return ash::shell::CreateAppListViewDelegate();
159}
160
[email protected]262f8bd2012-03-23 19:30:27161ash::LauncherDelegate* ShellDelegateImpl::CreateLauncherDelegate(
162 ash::LauncherModel* model) {
163 launcher_delegate_ = new LauncherDelegateImpl(watcher_);
164 return launcher_delegate_;
165}
166
[email protected]51ed5992012-11-07 10:14:39167ash::SystemTrayDelegate* ShellDelegateImpl::CreateSystemTrayDelegate() {
[email protected]262f8bd2012-03-23 19:30:27168 return NULL;
169}
170
171ash::UserWallpaperDelegate* ShellDelegateImpl::CreateUserWallpaperDelegate() {
172 return NULL;
173}
[email protected]4d7ce4352012-07-13 06:56:06174
[email protected]f4c92b382012-08-28 00:59:59175ash::CapsLockDelegate* ShellDelegateImpl::CreateCapsLockDelegate() {
176 return new CapsLockDelegateStub;
177}
178
[email protected]c28853612012-05-31 22:43:44179aura::client::UserActionClient* ShellDelegateImpl::CreateUserActionClient() {
180 return NULL;
181}
[email protected]262f8bd2012-03-23 19:30:27182
[email protected]4d7ce4352012-07-13 06:56:06183void ShellDelegateImpl::OpenFeedbackPage() {
184}
185
[email protected]6cae3d0b2012-07-20 00:58:48186void ShellDelegateImpl::RecordUserMetricsAction(UserMetricsAction action) {
187}
188
[email protected]e54e8192012-08-27 17:38:00189void ShellDelegateImpl::HandleMediaNextTrack() {
190}
191
192void ShellDelegateImpl::HandleMediaPlayPause() {
193}
194
195void ShellDelegateImpl::HandleMediaPrevTrack() {
196}
197
[email protected]4468dd12012-08-30 17:17:20198string16 ShellDelegateImpl::GetTimeRemainingString(base::TimeDelta delta) {
199 return string16();
200}
201
[email protected]b98beff2012-11-28 18:52:02202string16 ShellDelegateImpl::GetTimeDurationLongString(base::TimeDelta delta) {
203 return string16();
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]5673bf52013-02-01 06:14:24221string16 ShellDelegateImpl::GetProductName() const {
222 return string16();
223}
224
[email protected]262f8bd2012-03-23 19:30:27225} // namespace shell
226} // namespace ash