shell_delegate_impl.cc revision 0f1bc08d4cfcc34181b0b5cbf065c40f687bf740
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/accessibility_delegate.h" 8#include "ash/caps_lock_delegate_stub.h" 9#include "ash/default_accessibility_delegate.h" 10#include "ash/default_user_wallpaper_delegate.h" 11#include "ash/host/root_window_host_factory.h" 12#include "ash/keyboard_controller_proxy_stub.h" 13#include "ash/media_delegate.h" 14#include "ash/new_window_delegate.h" 15#include "ash/session_state_delegate.h" 16#include "ash/session_state_delegate_stub.h" 17#include "ash/shell/context_menu.h" 18#include "ash/shell/example_factory.h" 19#include "ash/shell/launcher_delegate_impl.h" 20#include "ash/shell/toplevel_window.h" 21#include "ash/shell_window_ids.h" 22#include "ash/system/tray/default_system_tray_delegate.h" 23#include "ash/wm/window_state.h" 24#include "base/message_loop/message_loop.h" 25#include "ui/aura/window.h" 26#include "ui/views/corewm/input_method_event_filter.h" 27 28namespace ash { 29namespace shell { 30namespace { 31 32class NewWindowDelegateImpl : public NewWindowDelegate { 33 public: 34 NewWindowDelegateImpl() {} 35 virtual ~NewWindowDelegateImpl() {} 36 37 virtual void NewTab() OVERRIDE {} 38 virtual void NewWindow(bool incognito) OVERRIDE { 39 ash::shell::ToplevelWindow::CreateParams create_params; 40 create_params.can_resize = true; 41 create_params.can_maximize = true; 42 ash::shell::ToplevelWindow::CreateToplevelWindow(create_params); 43 } 44 virtual void OpenFileManager() OVERRIDE {} 45 virtual void OpenCrosh() OVERRIDE {} 46 virtual void RestoreTab() OVERRIDE {} 47 virtual void ShowKeyboardOverlay() OVERRIDE {} 48 virtual void ShowTaskManager() OVERRIDE {} 49 virtual void OpenFeedbackPage() OVERRIDE {} 50 51 private: 52 DISALLOW_COPY_AND_ASSIGN(NewWindowDelegateImpl); 53}; 54 55class MediaDelegateImpl : public MediaDelegate { 56 public: 57 MediaDelegateImpl() {} 58 virtual ~MediaDelegateImpl() {} 59 60 virtual void HandleMediaNextTrack() OVERRIDE {} 61 virtual void HandleMediaPlayPause() OVERRIDE {} 62 virtual void HandleMediaPrevTrack() OVERRIDE {} 63 64 private: 65 DISALLOW_COPY_AND_ASSIGN(MediaDelegateImpl); 66}; 67 68} // namespace 69 70ShellDelegateImpl::ShellDelegateImpl() 71 : watcher_(NULL), 72 launcher_delegate_(NULL) { 73} 74 75ShellDelegateImpl::~ShellDelegateImpl() { 76} 77 78void ShellDelegateImpl::SetWatcher(WindowWatcher* watcher) { 79 watcher_ = watcher; 80 if (launcher_delegate_) 81 launcher_delegate_->set_watcher(watcher); 82} 83 84bool ShellDelegateImpl::IsFirstRunAfterBoot() const { 85 return false; 86} 87 88bool ShellDelegateImpl::IsIncognitoAllowed() const { 89 return true; 90} 91 92bool ShellDelegateImpl::IsMultiProfilesEnabled() const { 93 return false; 94} 95 96bool ShellDelegateImpl::IsRunningInForcedAppMode() const { 97 return false; 98} 99 100void ShellDelegateImpl::PreInit() { 101} 102 103void ShellDelegateImpl::Shutdown() { 104} 105 106void ShellDelegateImpl::Exit() { 107 base::MessageLoopForUI::current()->Quit(); 108} 109 110keyboard::KeyboardControllerProxy* 111 ShellDelegateImpl::CreateKeyboardControllerProxy() { 112 return new KeyboardControllerProxyStub(); 113} 114 115content::BrowserContext* ShellDelegateImpl::GetCurrentBrowserContext() { 116 return Shell::GetInstance()->browser_context(); 117} 118 119app_list::AppListViewDelegate* ShellDelegateImpl::CreateAppListViewDelegate() { 120 return ash::shell::CreateAppListViewDelegate(); 121} 122 123ash::LauncherDelegate* ShellDelegateImpl::CreateLauncherDelegate( 124 ash::LauncherModel* model) { 125 launcher_delegate_ = new LauncherDelegateImpl(watcher_); 126 return launcher_delegate_; 127} 128 129ash::SystemTrayDelegate* ShellDelegateImpl::CreateSystemTrayDelegate() { 130 return new DefaultSystemTrayDelegate; 131} 132 133ash::UserWallpaperDelegate* ShellDelegateImpl::CreateUserWallpaperDelegate() { 134 return new DefaultUserWallpaperDelegate(); 135} 136 137ash::CapsLockDelegate* ShellDelegateImpl::CreateCapsLockDelegate() { 138 return new CapsLockDelegateStub; 139} 140 141ash::SessionStateDelegate* ShellDelegateImpl::CreateSessionStateDelegate() { 142 return new SessionStateDelegateStub; 143} 144 145ash::AccessibilityDelegate* ShellDelegateImpl::CreateAccessibilityDelegate() { 146 return new internal::DefaultAccessibilityDelegate; 147} 148 149ash::NewWindowDelegate* ShellDelegateImpl::CreateNewWindowDelegate() { 150 return new NewWindowDelegateImpl; 151} 152 153ash::MediaDelegate* ShellDelegateImpl::CreateMediaDelegate() { 154 return new MediaDelegateImpl; 155} 156 157aura::client::UserActionClient* ShellDelegateImpl::CreateUserActionClient() { 158 return NULL; 159} 160 161void ShellDelegateImpl::RecordUserMetricsAction(UserMetricsAction action) { 162} 163 164ui::MenuModel* ShellDelegateImpl::CreateContextMenu(aura::Window* root) { 165 return new ContextMenu(root); 166} 167 168RootWindowHostFactory* ShellDelegateImpl::CreateRootWindowHostFactory() { 169 return RootWindowHostFactory::Create(); 170} 171 172base::string16 ShellDelegateImpl::GetProductName() const { 173 return base::string16(); 174} 175 176} // namespace shell 177} // namespace ash 178