shell_delegate_impl.cc revision 68043e1e95eeb07d5cae7aca370b26518b0867d6
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
7#include <limits>
8
9#include "ash/caps_lock_delegate_stub.h"
10#include "ash/default_user_wallpaper_delegate.h"
11#include "ash/host/root_window_host_factory.h"
12#include "ash/keyboard_controller_proxy_stub.h"
13#include "ash/session_state_delegate.h"
14#include "ash/session_state_delegate_stub.h"
15#include "ash/shell/context_menu.h"
16#include "ash/shell/example_factory.h"
17#include "ash/shell/launcher_delegate_impl.h"
18#include "ash/shell/toplevel_window.h"
19#include "ash/shell_window_ids.h"
20#include "ash/system/tray/default_system_tray_delegate.h"
21#include "ash/wm/window_state.h"
22#include "base/message_loop/message_loop.h"
23#include "ui/aura/window.h"
24#include "ui/views/corewm/input_method_event_filter.h"
25
26namespace ash {
27namespace shell {
28
29ShellDelegateImpl::ShellDelegateImpl()
30    : watcher_(NULL),
31      launcher_delegate_(NULL),
32      spoken_feedback_enabled_(false),
33      high_contrast_enabled_(false),
34      screen_magnifier_enabled_(false),
35      screen_magnifier_type_(kDefaultMagnifierType),
36      large_cursor_enabled_(false) {
37}
38
39ShellDelegateImpl::~ShellDelegateImpl() {
40}
41
42void ShellDelegateImpl::SetWatcher(WindowWatcher* watcher) {
43  watcher_ = watcher;
44  if (launcher_delegate_)
45    launcher_delegate_->set_watcher(watcher);
46}
47
48bool ShellDelegateImpl::IsFirstRunAfterBoot() const {
49  return false;
50}
51
52bool ShellDelegateImpl::IsMultiProfilesEnabled() const {
53  return false;
54}
55
56bool ShellDelegateImpl::IsRunningInForcedAppMode() const {
57  return false;
58}
59
60void ShellDelegateImpl::PreInit() {
61}
62
63void ShellDelegateImpl::Shutdown() {
64}
65
66void ShellDelegateImpl::Exit() {
67  base::MessageLoopForUI::current()->Quit();
68}
69
70void ShellDelegateImpl::NewTab() {
71}
72
73void ShellDelegateImpl::NewWindow(bool incognito) {
74  ash::shell::ToplevelWindow::CreateParams create_params;
75  create_params.can_resize = true;
76  create_params.can_maximize = true;
77  ash::shell::ToplevelWindow::CreateToplevelWindow(create_params);
78}
79
80void ShellDelegateImpl::ToggleFullscreen() {
81  ToggleMaximized();
82}
83
84void ShellDelegateImpl::ToggleMaximized() {
85  wm::WindowState* window_state = wm::GetActiveWindowState();
86  if (window_state)
87    window_state->ToggleMaximized();
88}
89
90void ShellDelegateImpl::OpenFileManager(bool as_dialog) {
91}
92
93void ShellDelegateImpl::OpenCrosh() {
94}
95
96void ShellDelegateImpl::RestoreTab() {
97}
98
99void ShellDelegateImpl::ShowKeyboardOverlay() {
100}
101
102keyboard::KeyboardControllerProxy*
103    ShellDelegateImpl::CreateKeyboardControllerProxy() {
104  return new KeyboardControllerProxyStub();
105}
106
107void ShellDelegateImpl::ShowTaskManager() {
108}
109
110content::BrowserContext* ShellDelegateImpl::GetCurrentBrowserContext() {
111  return Shell::GetInstance()->browser_context();
112}
113
114void ShellDelegateImpl::ToggleSpokenFeedback(
115    AccessibilityNotificationVisibility notify) {
116  spoken_feedback_enabled_ = !spoken_feedback_enabled_;
117}
118
119bool ShellDelegateImpl::IsSpokenFeedbackEnabled() const {
120  return spoken_feedback_enabled_;
121}
122
123void ShellDelegateImpl::ToggleHighContrast() {
124  high_contrast_enabled_ = !high_contrast_enabled_;
125}
126
127bool ShellDelegateImpl::IsHighContrastEnabled() const {
128  return high_contrast_enabled_;
129}
130
131void ShellDelegateImpl::SetMagnifierEnabled(bool enabled) {
132  screen_magnifier_enabled_ = enabled;
133}
134
135void ShellDelegateImpl::SetMagnifierType(MagnifierType type) {
136  screen_magnifier_type_ = type;
137}
138
139bool ShellDelegateImpl::IsMagnifierEnabled() const {
140  return screen_magnifier_enabled_;
141}
142
143MagnifierType ShellDelegateImpl::GetMagnifierType() const {
144  return screen_magnifier_type_;
145}
146
147void ShellDelegateImpl::SetLargeCursorEnabled(bool enabled) {
148  large_cursor_enabled_ = enabled;
149}
150
151bool ShellDelegateImpl::IsLargeCursorEnabled() const {
152  return large_cursor_enabled_;
153}
154
155bool ShellDelegateImpl::ShouldAlwaysShowAccessibilityMenu() const {
156  return false;
157}
158
159void ShellDelegateImpl::SilenceSpokenFeedback() const {
160}
161
162app_list::AppListViewDelegate* ShellDelegateImpl::CreateAppListViewDelegate() {
163  return ash::shell::CreateAppListViewDelegate();
164}
165
166ash::LauncherDelegate* ShellDelegateImpl::CreateLauncherDelegate(
167    ash::LauncherModel* model) {
168  launcher_delegate_ = new LauncherDelegateImpl(watcher_);
169  return launcher_delegate_;
170}
171
172ash::SystemTrayDelegate* ShellDelegateImpl::CreateSystemTrayDelegate() {
173  return new DefaultSystemTrayDelegate;
174}
175
176ash::UserWallpaperDelegate* ShellDelegateImpl::CreateUserWallpaperDelegate() {
177  return new DefaultUserWallpaperDelegate();
178}
179
180ash::CapsLockDelegate* ShellDelegateImpl::CreateCapsLockDelegate() {
181  return new CapsLockDelegateStub;
182}
183
184ash::SessionStateDelegate* ShellDelegateImpl::CreateSessionStateDelegate() {
185  return new SessionStateDelegateStub;
186}
187
188aura::client::UserActionClient* ShellDelegateImpl::CreateUserActionClient() {
189  return NULL;
190}
191
192void ShellDelegateImpl::OpenFeedbackPage() {
193}
194
195void ShellDelegateImpl::RecordUserMetricsAction(UserMetricsAction action) {
196}
197
198void ShellDelegateImpl::HandleMediaNextTrack() {
199}
200
201void ShellDelegateImpl::HandleMediaPlayPause() {
202}
203
204void ShellDelegateImpl::HandleMediaPrevTrack() {
205}
206
207void ShellDelegateImpl::SaveScreenMagnifierScale(double scale) {
208}
209
210double ShellDelegateImpl::GetSavedScreenMagnifierScale() {
211  return std::numeric_limits<double>::min();
212}
213
214ui::MenuModel* ShellDelegateImpl::CreateContextMenu(aura::RootWindow* root) {
215  return new ContextMenu(root);
216}
217
218RootWindowHostFactory* ShellDelegateImpl::CreateRootWindowHostFactory() {
219  return RootWindowHostFactory::Create();
220}
221
222base::string16 ShellDelegateImpl::GetProductName() const {
223  return base::string16();
224}
225
226}  // namespace shell
227}  // namespace ash
228