Add per-day app launcher usage histogram
[chromium-blink-merge.git] / ash / shell / shell_delegate_impl.cc
blob81b51c6bd1ad4e701a7997b9ca2620d905f01403
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.
5 #include "ash/shell/shell_delegate_impl.h"
7 #include <limits>
9 #include "ash/caps_lock_delegate_stub.h"
10 #include "ash/host/root_window_host_factory.h"
11 #include "ash/shell/context_menu.h"
12 #include "ash/shell/example_factory.h"
13 #include "ash/shell/launcher_delegate_impl.h"
14 #include "ash/shell/toplevel_window.h"
15 #include "ash/shell_window_ids.h"
16 #include "ash/wm/window_util.h"
17 #include "base/message_loop.h"
18 #include "ui/aura/window.h"
20 namespace ash {
21 namespace shell {
23 ShellDelegateImpl::ShellDelegateImpl()
24 : watcher_(NULL),
25 launcher_delegate_(NULL),
26 locked_(false),
27 spoken_feedback_enabled_(false),
28 high_contrast_enabled_(false),
29 screen_magnifier_enabled_(false),
30 screen_magnifier_type_(kDefaultMagnifierType) {
33 ShellDelegateImpl::~ShellDelegateImpl() {
36 void ShellDelegateImpl::SetWatcher(WindowWatcher* watcher) {
37 watcher_ = watcher;
38 if (launcher_delegate_)
39 launcher_delegate_->set_watcher(watcher);
42 bool ShellDelegateImpl::IsUserLoggedIn() const {
43 return true;
46 bool ShellDelegateImpl::IsSessionStarted() const {
47 return true;
50 bool ShellDelegateImpl::IsGuestSession() const {
51 return false;
54 bool ShellDelegateImpl::IsFirstRunAfterBoot() const {
55 return false;
58 bool ShellDelegateImpl::IsRunningInForcedAppMode() const {
59 return false;
62 bool ShellDelegateImpl::CanLockScreen() const {
63 return true;
66 void ShellDelegateImpl::LockScreen() {
67 ash::shell::CreateLockScreen();
68 locked_ = true;
69 ash::Shell::GetInstance()->UpdateShelfVisibility();
72 void ShellDelegateImpl::UnlockScreen() {
73 locked_ = false;
74 ash::Shell::GetInstance()->UpdateShelfVisibility();
77 bool ShellDelegateImpl::IsScreenLocked() const {
78 return locked_;
81 void ShellDelegateImpl::PreInit() {
84 void ShellDelegateImpl::Shutdown() {
87 void ShellDelegateImpl::Exit() {
88 MessageLoopForUI::current()->Quit();
91 void ShellDelegateImpl::NewTab() {
94 void 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);
101 void ShellDelegateImpl::ToggleMaximized() {
102 aura::Window* window = ash::wm::GetActiveWindow();
103 if (window)
104 ash::wm::ToggleMaximizedWindow(window);
107 void ShellDelegateImpl::OpenFileManager(bool as_dialog) {
110 void ShellDelegateImpl::OpenCrosh() {
113 void ShellDelegateImpl::OpenMobileSetup(const std::string& service_path) {
116 void ShellDelegateImpl::RestoreTab() {
119 bool ShellDelegateImpl::RotatePaneFocus(Shell::Direction direction) {
120 return true;
123 void ShellDelegateImpl::ShowKeyboardOverlay() {
126 void ShellDelegateImpl::ShowTaskManager() {
129 content::BrowserContext* ShellDelegateImpl::GetCurrentBrowserContext() {
130 return Shell::GetInstance()->browser_context();
133 void ShellDelegateImpl::ToggleSpokenFeedback(
134 AccessibilityNotificationVisibility notify) {
135 spoken_feedback_enabled_ = !spoken_feedback_enabled_;
138 bool ShellDelegateImpl::IsSpokenFeedbackEnabled() const {
139 return spoken_feedback_enabled_;
142 void ShellDelegateImpl::ToggleHighContrast() {
143 high_contrast_enabled_ = !high_contrast_enabled_;
146 bool ShellDelegateImpl::IsHighContrastEnabled() const {
147 return high_contrast_enabled_;
150 void ShellDelegateImpl::SetMagnifierEnabled(bool enabled) {
151 screen_magnifier_enabled_ = enabled;
154 void ShellDelegateImpl::SetMagnifierType(MagnifierType type) {
155 screen_magnifier_type_ = type;
158 bool ShellDelegateImpl::IsMagnifierEnabled() const {
159 return screen_magnifier_enabled_;
162 MagnifierType ShellDelegateImpl::GetMagnifierType() const {
163 return screen_magnifier_type_;
166 bool ShellDelegateImpl::ShouldAlwaysShowAccessibilityMenu() const {
167 return false;
170 app_list::AppListViewDelegate* ShellDelegateImpl::CreateAppListViewDelegate() {
171 return ash::shell::CreateAppListViewDelegate();
174 ash::LauncherDelegate* ShellDelegateImpl::CreateLauncherDelegate(
175 ash::LauncherModel* model) {
176 launcher_delegate_ = new LauncherDelegateImpl(watcher_);
177 return launcher_delegate_;
180 ash::SystemTrayDelegate* ShellDelegateImpl::CreateSystemTrayDelegate() {
181 return NULL;
184 ash::UserWallpaperDelegate* ShellDelegateImpl::CreateUserWallpaperDelegate() {
185 return NULL;
188 ash::CapsLockDelegate* ShellDelegateImpl::CreateCapsLockDelegate() {
189 return new CapsLockDelegateStub;
192 aura::client::UserActionClient* ShellDelegateImpl::CreateUserActionClient() {
193 return NULL;
196 void ShellDelegateImpl::OpenFeedbackPage() {
199 void ShellDelegateImpl::RecordUserMetricsAction(UserMetricsAction action) {
202 void ShellDelegateImpl::HandleMediaNextTrack() {
205 void ShellDelegateImpl::HandleMediaPlayPause() {
208 void ShellDelegateImpl::HandleMediaPrevTrack() {
211 string16 ShellDelegateImpl::GetTimeRemainingString(base::TimeDelta delta) {
212 return string16();
215 string16 ShellDelegateImpl::GetTimeDurationLongString(base::TimeDelta delta) {
216 return string16();
219 void ShellDelegateImpl::SaveScreenMagnifierScale(double scale) {
222 double ShellDelegateImpl::GetSavedScreenMagnifierScale() {
223 return std::numeric_limits<double>::min();
226 ui::MenuModel* ShellDelegateImpl::CreateContextMenu(aura::RootWindow* root) {
227 return new ContextMenu(root);
230 RootWindowHostFactory* ShellDelegateImpl::CreateRootWindowHostFactory() {
231 return RootWindowHostFactory::Create();
234 string16 ShellDelegateImpl::GetProductName() const {
235 return string16();
238 } // namespace shell
239 } // namespace ash