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