blob: a94d858e8eaa0f577496c35542c4cd92a727fda8 [file] [log] [blame]
jamescook33375732016-07-14 22:09:281// 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/shell_delegate_mus.h"
6
7#include <utility>
8
jamescook33375732016-07-14 22:09:289#include "ash/common/gpu_support_stub.h"
jdufault0f4fa6e2016-08-05 19:13:5910#include "ash/common/palette_delegate.h"
jamescook33375732016-07-14 22:09:2811#include "ash/common/session/session_state_delegate.h"
msw82839402016-08-30 18:57:2912#include "ash/common/wm_shell.h"
jamescook428f986f2016-07-15 19:13:2513#include "ash/mus/accessibility_delegate_mus.h"
msw0e91d932016-08-25 22:34:0914#include "ash/mus/context_menu_mus.h"
msw82839402016-08-30 18:57:2915#include "ash/mus/shelf_delegate_mus.h"
jamescook01bf23e72017-01-09 19:58:1516#include "ash/mus/system_tray_delegate_mus.h"
msw7d03b2062016-09-10 00:13:2117#include "ash/mus/wallpaper_delegate_mus.h"
jamescook33375732016-07-14 22:09:2818#include "base/memory/ptr_util.h"
19#include "base/strings/string16.h"
mswccb5d692016-08-17 20:37:4820#include "base/strings/string_util.h"
jamescook33375732016-07-14 22:09:2821#include "components/user_manager/user_info_impl.h"
jamescook33375732016-07-14 22:09:2822#include "ui/gfx/image/image.h"
23
24namespace ash {
25namespace {
26
27class SessionStateDelegateStub : public SessionStateDelegate {
28 public:
29 SessionStateDelegateStub()
30 : screen_locked_(false), user_info_(new user_manager::UserInfoImpl()) {}
31
32 ~SessionStateDelegateStub() override {}
33
34 // SessionStateDelegate:
35 int GetMaximumNumberOfLoggedInUsers() const override { return 3; }
36 int NumberOfLoggedInUsers() const override {
37 // ash_shell has 2 users.
38 return 2;
39 }
40 bool IsActiveUserSessionStarted() const override { return true; }
41 bool CanLockScreen() const override { return true; }
42 bool IsScreenLocked() const override { return screen_locked_; }
warxb3fd59ca2016-10-25 04:06:0743 bool ShouldLockScreenAutomatically() const override { return false; }
jamescook33375732016-07-14 22:09:2844 void LockScreen() override {
45 screen_locked_ = true;
46 NOTIMPLEMENTED();
47 }
48 void UnlockScreen() override {
49 NOTIMPLEMENTED();
50 screen_locked_ = false;
51 }
52 bool IsUserSessionBlocked() const override { return false; }
xiyuanba4b204b2016-10-18 17:14:1053 session_manager::SessionState GetSessionState() const override {
54 return session_manager::SessionState::ACTIVE;
55 }
jamescook33375732016-07-14 22:09:2856 const user_manager::UserInfo* GetUserInfo(UserIndex index) const override {
57 return user_info_.get();
58 }
59 bool ShouldShowAvatar(WmWindow* window) const override {
60 NOTIMPLEMENTED();
61 return !user_info_->GetImage().isNull();
62 }
63 gfx::ImageSkia GetAvatarImageForWindow(WmWindow* window) const override {
64 NOTIMPLEMENTED();
65 return gfx::ImageSkia();
66 }
67 void SwitchActiveUser(const AccountId& account_id) override {}
68 void CycleActiveUser(CycleUser cycle_user) override {}
69 bool IsMultiProfileAllowedByPrimaryUserPolicy() const override {
70 return true;
71 }
72 void AddSessionStateObserver(ash::SessionStateObserver* observer) override {}
73 void RemoveSessionStateObserver(
74 ash::SessionStateObserver* observer) override {}
75
76 private:
77 bool screen_locked_;
78
79 // A pseudo user info.
80 std::unique_ptr<user_manager::UserInfo> user_info_;
81
82 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateStub);
83};
84
jamescook33375732016-07-14 22:09:2885} // namespace
86
msw0bc6a072017-02-14 16:33:3887ShellDelegateMus::ShellDelegateMus(service_manager::Connector* connector)
88 : connector_(connector) {}
jamescook33375732016-07-14 22:09:2889
90ShellDelegateMus::~ShellDelegateMus() {}
91
rockot400ea35b2016-10-15 19:15:3292service_manager::Connector* ShellDelegateMus::GetShellConnector() const {
jamescook2a6b8692016-10-04 02:41:2993 return connector_;
94}
95
jamescook33375732016-07-14 22:09:2896bool ShellDelegateMus::IsIncognitoAllowed() const {
97 NOTIMPLEMENTED();
98 return false;
99}
100
101bool ShellDelegateMus::IsMultiProfilesEnabled() const {
102 NOTIMPLEMENTED();
103 return false;
104}
105
106bool ShellDelegateMus::IsRunningInForcedAppMode() const {
107 NOTIMPLEMENTED();
108 return false;
109}
110
111bool ShellDelegateMus::CanShowWindowForUser(WmWindow* window) const {
112 NOTIMPLEMENTED();
113 return true;
114}
115
116bool ShellDelegateMus::IsForceMaximizeOnFirstRun() const {
117 NOTIMPLEMENTED();
118 return false;
119}
120
121void ShellDelegateMus::PreInit() {
122 NOTIMPLEMENTED();
123}
124
125void ShellDelegateMus::PreShutdown() {
126 NOTIMPLEMENTED();
127}
128
129void ShellDelegateMus::Exit() {
130 NOTIMPLEMENTED();
131}
132
133keyboard::KeyboardUI* ShellDelegateMus::CreateKeyboardUI() {
134 NOTIMPLEMENTED();
135 return nullptr;
136}
137
kenobib7af62b2016-07-29 21:40:16138void ShellDelegateMus::OpenUrlFromArc(const GURL& url) {
jamescook33375732016-07-14 22:09:28139 NOTIMPLEMENTED();
140}
141
jamescook33375732016-07-14 22:09:28142ShelfDelegate* ShellDelegateMus::CreateShelfDelegate(ShelfModel* model) {
msw49cfb892016-10-11 16:46:15143 return new ShelfDelegateMus();
jamescook33375732016-07-14 22:09:28144}
145
146SystemTrayDelegate* ShellDelegateMus::CreateSystemTrayDelegate() {
jamescook2a6b8692016-10-04 02:41:29147 return new SystemTrayDelegateMus();
jamescook33375732016-07-14 22:09:28148}
149
msw0e91d932016-08-25 22:34:09150std::unique_ptr<WallpaperDelegate> ShellDelegateMus::CreateWallpaperDelegate() {
mswc691bf12016-10-19 17:05:39151 return base::MakeUnique<WallpaperDelegateMus>();
jamescook33375732016-07-14 22:09:28152}
153
154SessionStateDelegate* ShellDelegateMus::CreateSessionStateDelegate() {
sky1eb7caa2016-09-16 00:02:46155 // TODO: http://crbug.com/647416.
jamescook33375732016-07-14 22:09:28156 NOTIMPLEMENTED() << " Using a stub SessionStateDeleagte implementation";
157 return new SessionStateDelegateStub;
158}
159
160AccessibilityDelegate* ShellDelegateMus::CreateAccessibilityDelegate() {
jamescook428f986f2016-07-15 19:13:25161 return new AccessibilityDelegateMus(connector_);
jamescook33375732016-07-14 22:09:28162}
163
jdufault0f4fa6e2016-08-05 19:13:59164std::unique_ptr<PaletteDelegate> ShellDelegateMus::CreatePaletteDelegate() {
sky1eb7caa2016-09-16 00:02:46165 // TODO: http://crbug.com/647417.
jdufault0f4fa6e2016-08-05 19:13:59166 NOTIMPLEMENTED();
167 return nullptr;
168}
169
jamescook33375732016-07-14 22:09:28170ui::MenuModel* ShellDelegateMus::CreateContextMenu(WmShelf* wm_shelf,
171 const ShelfItem* item) {
msw0e91d932016-08-25 22:34:09172 return new ContextMenuMus(wm_shelf);
jamescook33375732016-07-14 22:09:28173}
174
175GPUSupport* ShellDelegateMus::CreateGPUSupport() {
sky1eb7caa2016-09-16 00:02:46176 // TODO: http://crbug.com/647421.
jamescook33375732016-07-14 22:09:28177 NOTIMPLEMENTED() << " Using a stub GPUSupport implementation";
178 return new GPUSupportStub();
179}
180
181base::string16 ShellDelegateMus::GetProductName() const {
182 NOTIMPLEMENTED();
183 return base::string16();
184}
185
186gfx::Image ShellDelegateMus::GetDeprecatedAcceleratorImage() const {
187 NOTIMPLEMENTED();
188 return gfx::Image();
189}
190
warx4c8baedb2016-12-03 22:38:50191bool ShellDelegateMus::IsTouchscreenEnabledInPrefs(bool use_local_state) const {
192 NOTIMPLEMENTED();
193 return true;
194}
195
196void ShellDelegateMus::SetTouchscreenEnabledInPrefs(bool enabled,
197 bool use_local_state) {
198 NOTIMPLEMENTED();
199}
200
201void ShellDelegateMus::UpdateTouchscreenStatusFromPrefs() {
202 NOTIMPLEMENTED();
203}
204
jamescook33375732016-07-14 22:09:28205} // namespace ash