shell_delegate_impl.cc revision 5821806d5e7f356e8fa4b058a389a808ea183019
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 "ash/caps_lock_delegate_stub.h" 8#include "ash/shell/example_factory.h" 9#include "ash/shell/launcher_delegate_impl.h" 10#include "ash/shell/context_menu.h" 11#include "ash/shell/toplevel_window.h" 12#include "ash/shell_window_ids.h" 13#include "ash/wm/window_util.h" 14#include "base/message_loop.h" 15#include "ui/aura/window.h" 16 17namespace ash { 18namespace shell { 19 20ShellDelegateImpl::ShellDelegateImpl() 21 : watcher_(NULL), 22 launcher_delegate_(NULL), 23 locked_(false), 24 spoken_feedback_enabled_(false) { 25} 26 27ShellDelegateImpl::~ShellDelegateImpl() { 28} 29 30void ShellDelegateImpl::SetWatcher(WindowWatcher* watcher) { 31 watcher_ = watcher; 32 if (launcher_delegate_) 33 launcher_delegate_->set_watcher(watcher); 34} 35 36bool ShellDelegateImpl::IsUserLoggedIn() { 37 return true; 38} 39 40bool ShellDelegateImpl::IsSessionStarted() { 41 return true; 42} 43 44bool ShellDelegateImpl::IsFirstRunAfterBoot() { 45 return false; 46} 47 48void ShellDelegateImpl::LockScreen() { 49 ash::shell::CreateLockScreen(); 50 locked_ = true; 51 ash::Shell::GetInstance()->UpdateShelfVisibility(); 52} 53 54void ShellDelegateImpl::UnlockScreen() { 55 locked_ = false; 56 ash::Shell::GetInstance()->UpdateShelfVisibility(); 57} 58 59bool ShellDelegateImpl::IsScreenLocked() const { 60 return locked_; 61} 62 63void ShellDelegateImpl::Shutdown() { 64} 65 66void ShellDelegateImpl::Exit() { 67 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::ToggleMaximized() { 81 aura::Window* window = ash::wm::GetActiveWindow(); 82 if (window) 83 ash::wm::ToggleMaximizedWindow(window); 84} 85 86void ShellDelegateImpl::OpenFileManager(bool as_dialog) { 87} 88 89void ShellDelegateImpl::OpenCrosh() { 90} 91 92void ShellDelegateImpl::OpenMobileSetup(const std::string& service_path) { 93} 94 95void ShellDelegateImpl::RestoreTab() { 96} 97 98bool ShellDelegateImpl::RotatePaneFocus(Shell::Direction direction) { 99 return true; 100} 101 102void ShellDelegateImpl::ShowKeyboardOverlay() { 103} 104 105void ShellDelegateImpl::ShowTaskManager() { 106} 107 108content::BrowserContext* ShellDelegateImpl::GetCurrentBrowserContext() { 109 return Shell::GetInstance()->browser_context(); 110} 111 112void ShellDelegateImpl::ToggleSpokenFeedback() { 113 spoken_feedback_enabled_ = !spoken_feedback_enabled_; 114} 115 116bool ShellDelegateImpl::IsSpokenFeedbackEnabled() const { 117 return spoken_feedback_enabled_; 118} 119 120app_list::AppListViewDelegate* ShellDelegateImpl::CreateAppListViewDelegate() { 121 return ash::shell::CreateAppListViewDelegate(); 122} 123 124ash::LauncherDelegate* ShellDelegateImpl::CreateLauncherDelegate( 125 ash::LauncherModel* model) { 126 launcher_delegate_ = new LauncherDelegateImpl(watcher_); 127 return launcher_delegate_; 128} 129 130ash::SystemTrayDelegate* ShellDelegateImpl::CreateSystemTrayDelegate() { 131 return NULL; 132} 133 134ash::UserWallpaperDelegate* ShellDelegateImpl::CreateUserWallpaperDelegate() { 135 return NULL; 136} 137 138ash::CapsLockDelegate* ShellDelegateImpl::CreateCapsLockDelegate() { 139 return new CapsLockDelegateStub; 140} 141 142aura::client::UserActionClient* ShellDelegateImpl::CreateUserActionClient() { 143 return NULL; 144} 145 146void ShellDelegateImpl::OpenFeedbackPage() { 147} 148 149void ShellDelegateImpl::RecordUserMetricsAction(UserMetricsAction action) { 150} 151 152void ShellDelegateImpl::HandleMediaNextTrack() { 153} 154 155void ShellDelegateImpl::HandleMediaPlayPause() { 156} 157 158void ShellDelegateImpl::HandleMediaPrevTrack() { 159} 160 161string16 ShellDelegateImpl::GetTimeRemainingString(base::TimeDelta delta) { 162 return string16(); 163} 164 165void ShellDelegateImpl::SaveScreenMagnifierScale(double scale) { 166} 167 168double ShellDelegateImpl::GetSavedScreenMagnifierScale() { 169 return std::numeric_limits<double>::min(); 170} 171 172ui::MenuModel* ShellDelegateImpl::CreateContextMenu(aura::RootWindow* root) { 173 return new ContextMenu(root); 174} 175 176} // namespace shell 177} // namespace ash 178