OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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/mus/sysui/shell_delegate_mus.h" |
| 6 |
| 7 #include "ash/default_accessibility_delegate.h" |
| 8 #include "ash/default_user_wallpaper_delegate.h" |
| 9 #include "ash/session/session_state_delegate.h" |
| 10 #include "ash/system/tray/default_system_tray_delegate.h" |
| 11 #include "base/strings/string16.h" |
| 12 #include "components/user_manager/user_info_impl.h" |
| 13 #include "ui/gfx/image/image.h" |
| 14 |
| 15 namespace ash { |
| 16 namespace sysui { |
| 17 |
| 18 namespace { |
| 19 |
| 20 class SessionStateDelegateStub : public SessionStateDelegate { |
| 21 public: |
| 22 SessionStateDelegateStub() |
| 23 : screen_locked_(false), user_info_(new user_manager::UserInfoImpl()) {} |
| 24 |
| 25 ~SessionStateDelegateStub() override {} |
| 26 |
| 27 // SessionStateDelegate: |
| 28 int GetMaximumNumberOfLoggedInUsers() const override { return 3; } |
| 29 int NumberOfLoggedInUsers() const override { |
| 30 // ash_shell has 2 users. |
| 31 return 2; |
| 32 } |
| 33 bool IsActiveUserSessionStarted() const override { return true; } |
| 34 bool CanLockScreen() const override { return true; } |
| 35 bool IsScreenLocked() const override { return screen_locked_; } |
| 36 bool ShouldLockScreenBeforeSuspending() const override { return false; } |
| 37 void LockScreen() override { |
| 38 screen_locked_ = true; |
| 39 NOTIMPLEMENTED(); |
| 40 } |
| 41 void UnlockScreen() override { |
| 42 NOTIMPLEMENTED(); |
| 43 screen_locked_ = false; |
| 44 } |
| 45 bool IsUserSessionBlocked() const override { return false; } |
| 46 SessionState GetSessionState() const override { return SESSION_STATE_ACTIVE; } |
| 47 const user_manager::UserInfo* GetUserInfo(UserIndex index) const override { |
| 48 return user_info_.get(); |
| 49 } |
| 50 bool ShouldShowAvatar(aura::Window* window) const override { |
| 51 return !user_info_->GetImage().isNull(); |
| 52 } |
| 53 gfx::ImageSkia GetAvatarImageForWindow(aura::Window* window) const override { |
| 54 return gfx::ImageSkia(); |
| 55 } |
| 56 void SwitchActiveUser(const AccountId& account_id) override {} |
| 57 void CycleActiveUser(CycleUser cycle_user) override {} |
| 58 bool IsMultiProfileAllowedByPrimaryUserPolicy() const override { |
| 59 return true; |
| 60 } |
| 61 void AddSessionStateObserver(ash::SessionStateObserver* observer) override {} |
| 62 void RemoveSessionStateObserver( |
| 63 ash::SessionStateObserver* observer) override {} |
| 64 |
| 65 private: |
| 66 bool screen_locked_; |
| 67 |
| 68 // A pseudo user info. |
| 69 scoped_ptr<user_manager::UserInfo> user_info_; |
| 70 |
| 71 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateStub); |
| 72 }; |
| 73 |
| 74 } // namespace |
| 75 |
| 76 ShellDelegateMus::ShellDelegateMus() {} |
| 77 ShellDelegateMus::~ShellDelegateMus() {} |
| 78 |
| 79 bool ShellDelegateMus::IsFirstRunAfterBoot() const { |
| 80 return false; |
| 81 } |
| 82 |
| 83 bool ShellDelegateMus::IsIncognitoAllowed() const { |
| 84 return false; |
| 85 } |
| 86 |
| 87 bool ShellDelegateMus::IsMultiProfilesEnabled() const { |
| 88 return false; |
| 89 } |
| 90 |
| 91 bool ShellDelegateMus::IsRunningInForcedAppMode() const { |
| 92 return false; |
| 93 } |
| 94 |
| 95 bool ShellDelegateMus::CanShowWindowForUser(aura::Window* window) const { |
| 96 return true; |
| 97 } |
| 98 |
| 99 bool ShellDelegateMus::IsForceMaximizeOnFirstRun() const { |
| 100 return false; |
| 101 } |
| 102 |
| 103 void ShellDelegateMus::PreInit() {} |
| 104 |
| 105 void ShellDelegateMus::PreShutdown() {} |
| 106 |
| 107 void ShellDelegateMus::Exit() {} |
| 108 |
| 109 keyboard::KeyboardUI* ShellDelegateMus::CreateKeyboardUI() { |
| 110 return nullptr; |
| 111 } |
| 112 |
| 113 void ShellDelegateMus::VirtualKeyboardActivated(bool activated) {} |
| 114 |
| 115 void ShellDelegateMus::AddVirtualKeyboardStateObserver( |
| 116 VirtualKeyboardStateObserver* observer) {} |
| 117 |
| 118 void ShellDelegateMus::RemoveVirtualKeyboardStateObserver( |
| 119 VirtualKeyboardStateObserver* observer) {} |
| 120 |
| 121 app_list::AppListViewDelegate* ShellDelegateMus::GetAppListViewDelegate() { |
| 122 return nullptr; |
| 123 } |
| 124 |
| 125 ShelfDelegate* ShellDelegateMus::CreateShelfDelegate(ShelfModel* model) { |
| 126 return nullptr; |
| 127 } |
| 128 |
| 129 ash::SystemTrayDelegate* ShellDelegateMus::CreateSystemTrayDelegate() { |
| 130 return new DefaultSystemTrayDelegate; |
| 131 } |
| 132 |
| 133 ash::UserWallpaperDelegate* ShellDelegateMus::CreateUserWallpaperDelegate() { |
| 134 return new DefaultUserWallpaperDelegate(); |
| 135 } |
| 136 |
| 137 ash::SessionStateDelegate* ShellDelegateMus::CreateSessionStateDelegate() { |
| 138 return new SessionStateDelegateStub; |
| 139 } |
| 140 |
| 141 ash::AccessibilityDelegate* ShellDelegateMus::CreateAccessibilityDelegate() { |
| 142 return new DefaultAccessibilityDelegate; |
| 143 } |
| 144 |
| 145 ash::NewWindowDelegate* ShellDelegateMus::CreateNewWindowDelegate() { |
| 146 return nullptr; |
| 147 } |
| 148 |
| 149 ash::MediaDelegate* ShellDelegateMus::CreateMediaDelegate() { |
| 150 return nullptr; |
| 151 } |
| 152 |
| 153 ui::MenuModel* ShellDelegateMus::CreateContextMenu( |
| 154 aura::Window* root_window, |
| 155 ash::ShelfItemDelegate* item_delegate, |
| 156 ash::ShelfItem* item) { |
| 157 return nullptr; |
| 158 } |
| 159 |
| 160 GPUSupport* ShellDelegateMus::CreateGPUSupport() { |
| 161 return nullptr; |
| 162 } |
| 163 |
| 164 base::string16 ShellDelegateMus::GetProductName() const { |
| 165 return base::string16(); |
| 166 } |
| 167 |
| 168 gfx::Image ShellDelegateMus::GetDeprecatedAcceleratorImage() const { |
| 169 return gfx::Image(); |
| 170 } |
| 171 |
| 172 } // namespace sysui |
| 173 } // namespace ash |
OLD | NEW |