shell_delegate_impl.cc revision 2a99a7e74a7f215066514fe81d2bfa6639d9eddd
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/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" 19 20namespace ash { 21namespace shell { 22 23ShellDelegateImpl::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) { 31} 32 33ShellDelegateImpl::~ShellDelegateImpl() { 34} 35 36void ShellDelegateImpl::SetWatcher(WindowWatcher* watcher) { 37 watcher_ = watcher; 38 if (launcher_delegate_) 39 launcher_delegate_->set_watcher(watcher); 40} 41 42bool ShellDelegateImpl::IsUserLoggedIn() const { 43 return true; 44} 45 46bool ShellDelegateImpl::IsSessionStarted() const { 47 return true; 48} 49 50bool ShellDelegateImpl::IsGuestSession() const { 51 return false; 52} 53 54bool ShellDelegateImpl::IsFirstRunAfterBoot() const { 55 return false; 56} 57 58bool ShellDelegateImpl::IsRunningInForcedAppMode() const { 59 return false; 60} 61 62bool ShellDelegateImpl::CanLockScreen() const { 63 return true; 64} 65 66void ShellDelegateImpl::LockScreen() { 67 ash::shell::CreateLockScreen(); 68 locked_ = true; 69 ash::Shell::GetInstance()->UpdateShelfVisibility(); 70} 71 72void ShellDelegateImpl::UnlockScreen() { 73 locked_ = false; 74 ash::Shell::GetInstance()->UpdateShelfVisibility(); 75} 76 77bool ShellDelegateImpl::IsScreenLocked() const { 78 return locked_; 79} 80 81void ShellDelegateImpl::PreInit() { 82} 83 84void ShellDelegateImpl::Shutdown() { 85} 86 87void ShellDelegateImpl::Exit() { 88 MessageLoopForUI::current()->Quit(); 89} 90 91void ShellDelegateImpl::NewTab() { 92} 93 94void 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); 99} 100 101void ShellDelegateImpl::ToggleMaximized() { 102 aura::Window* window = ash::wm::GetActiveWindow(); 103 if (window) 104 ash::wm::ToggleMaximizedWindow(window); 105} 106 107void ShellDelegateImpl::OpenFileManager(bool as_dialog) { 108} 109 110void ShellDelegateImpl::OpenCrosh() { 111} 112 113void ShellDelegateImpl::OpenMobileSetup(const std::string& service_path) { 114} 115 116void ShellDelegateImpl::RestoreTab() { 117} 118 119bool ShellDelegateImpl::RotatePaneFocus(Shell::Direction direction) { 120 return true; 121} 122 123void ShellDelegateImpl::ShowKeyboardOverlay() { 124} 125 126void ShellDelegateImpl::ShowTaskManager() { 127} 128 129content::BrowserContext* ShellDelegateImpl::GetCurrentBrowserContext() { 130 return Shell::GetInstance()->browser_context(); 131} 132 133void ShellDelegateImpl::ToggleSpokenFeedback( 134 AccessibilityNotificationVisibility notify) { 135 spoken_feedback_enabled_ = !spoken_feedback_enabled_; 136} 137 138bool ShellDelegateImpl::IsSpokenFeedbackEnabled() const { 139 return spoken_feedback_enabled_; 140} 141 142void ShellDelegateImpl::ToggleHighContrast() { 143 high_contrast_enabled_ = !high_contrast_enabled_; 144} 145 146bool ShellDelegateImpl::IsHighContrastEnabled() const { 147 return high_contrast_enabled_; 148} 149 150void ShellDelegateImpl::SetMagnifierEnabled(bool enabled) { 151 screen_magnifier_enabled_ = enabled; 152} 153 154void ShellDelegateImpl::SetMagnifierType(MagnifierType type) { 155 screen_magnifier_type_ = type; 156} 157 158bool ShellDelegateImpl::IsMagnifierEnabled() const { 159 return screen_magnifier_enabled_; 160} 161 162MagnifierType ShellDelegateImpl::GetMagnifierType() const { 163 return screen_magnifier_type_; 164} 165 166bool ShellDelegateImpl::ShouldAlwaysShowAccessibilityMenu() const { 167 return false; 168} 169 170app_list::AppListViewDelegate* ShellDelegateImpl::CreateAppListViewDelegate() { 171 return ash::shell::CreateAppListViewDelegate(); 172} 173 174ash::LauncherDelegate* ShellDelegateImpl::CreateLauncherDelegate( 175 ash::LauncherModel* model) { 176 launcher_delegate_ = new LauncherDelegateImpl(watcher_); 177 return launcher_delegate_; 178} 179 180ash::SystemTrayDelegate* ShellDelegateImpl::CreateSystemTrayDelegate() { 181 return NULL; 182} 183 184ash::UserWallpaperDelegate* ShellDelegateImpl::CreateUserWallpaperDelegate() { 185 return NULL; 186} 187 188ash::CapsLockDelegate* ShellDelegateImpl::CreateCapsLockDelegate() { 189 return new CapsLockDelegateStub; 190} 191 192aura::client::UserActionClient* ShellDelegateImpl::CreateUserActionClient() { 193 return NULL; 194} 195 196void ShellDelegateImpl::OpenFeedbackPage() { 197} 198 199void ShellDelegateImpl::RecordUserMetricsAction(UserMetricsAction action) { 200} 201 202void ShellDelegateImpl::HandleMediaNextTrack() { 203} 204 205void ShellDelegateImpl::HandleMediaPlayPause() { 206} 207 208void ShellDelegateImpl::HandleMediaPrevTrack() { 209} 210 211string16 ShellDelegateImpl::GetTimeRemainingString(base::TimeDelta delta) { 212 return string16(); 213} 214 215string16 ShellDelegateImpl::GetTimeDurationLongString(base::TimeDelta delta) { 216 return string16(); 217} 218 219void ShellDelegateImpl::SaveScreenMagnifierScale(double scale) { 220} 221 222double ShellDelegateImpl::GetSavedScreenMagnifierScale() { 223 return std::numeric_limits<double>::min(); 224} 225 226ui::MenuModel* ShellDelegateImpl::CreateContextMenu(aura::RootWindow* root) { 227 return new ContextMenu(root); 228} 229 230RootWindowHostFactory* ShellDelegateImpl::CreateRootWindowHostFactory() { 231 return RootWindowHostFactory::Create(); 232} 233 234string16 ShellDelegateImpl::GetProductName() const { 235 return string16(); 236} 237 238} // namespace shell 239} // namespace ash 240