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