blob: cf45d1d9c0c243cecbebee77666a3d37adb9a1f3 [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"
10#include "ash/common/media_delegate.h"
riajiang957bb6a2016-07-22 17:00:2311#include "ash/common/pointer_watcher_delegate.h"
jamescook33375732016-07-14 22:09:2812#include "ash/common/session/session_state_delegate.h"
13#include "ash/common/system/tray/default_system_tray_delegate.h"
jamescook428f986f2016-07-15 19:13:2514#include "ash/mus/accessibility_delegate_mus.h"
skya279c7c2016-07-27 23:08:4215#include "ash/mus/new_window_delegate_mus.h"
jamescook33375732016-07-14 22:09:2816#include "base/memory/ptr_util.h"
17#include "base/strings/string16.h"
18#include "components/user_manager/user_info_impl.h"
19#include "ui/app_list/presenter/app_list_presenter.h"
20#include "ui/gfx/image/image.h"
21
22namespace ash {
23namespace {
24
25class SessionStateDelegateStub : public SessionStateDelegate {
26 public:
27 SessionStateDelegateStub()
28 : screen_locked_(false), user_info_(new user_manager::UserInfoImpl()) {}
29
30 ~SessionStateDelegateStub() override {}
31
32 // SessionStateDelegate:
33 int GetMaximumNumberOfLoggedInUsers() const override { return 3; }
34 int NumberOfLoggedInUsers() const override {
35 // ash_shell has 2 users.
36 return 2;
37 }
38 bool IsActiveUserSessionStarted() const override { return true; }
39 bool CanLockScreen() const override { return true; }
40 bool IsScreenLocked() const override { return screen_locked_; }
41 bool ShouldLockScreenBeforeSuspending() const override { return false; }
42 void LockScreen() override {
43 screen_locked_ = true;
44 NOTIMPLEMENTED();
45 }
46 void UnlockScreen() override {
47 NOTIMPLEMENTED();
48 screen_locked_ = false;
49 }
50 bool IsUserSessionBlocked() const override { return false; }
51 SessionState GetSessionState() const override { return SESSION_STATE_ACTIVE; }
52 const user_manager::UserInfo* GetUserInfo(UserIndex index) const override {
53 return user_info_.get();
54 }
55 bool ShouldShowAvatar(WmWindow* window) const override {
56 NOTIMPLEMENTED();
57 return !user_info_->GetImage().isNull();
58 }
59 gfx::ImageSkia GetAvatarImageForWindow(WmWindow* window) const override {
60 NOTIMPLEMENTED();
61 return gfx::ImageSkia();
62 }
63 void SwitchActiveUser(const AccountId& account_id) override {}
64 void CycleActiveUser(CycleUser cycle_user) override {}
65 bool IsMultiProfileAllowedByPrimaryUserPolicy() const override {
66 return true;
67 }
68 void AddSessionStateObserver(ash::SessionStateObserver* observer) override {}
69 void RemoveSessionStateObserver(
70 ash::SessionStateObserver* observer) override {}
71
72 private:
73 bool screen_locked_;
74
75 // A pseudo user info.
76 std::unique_ptr<user_manager::UserInfo> user_info_;
77
78 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateStub);
79};
80
81class MediaDelegateStub : public MediaDelegate {
82 public:
83 MediaDelegateStub() {}
84 ~MediaDelegateStub() override {}
85
86 // MediaDelegate:
87 void HandleMediaNextTrack() override { NOTIMPLEMENTED(); }
88 void HandleMediaPlayPause() override { NOTIMPLEMENTED(); }
89 void HandleMediaPrevTrack() override { NOTIMPLEMENTED(); }
90 MediaCaptureState GetMediaCaptureState(UserIndex index) override {
91 NOTIMPLEMENTED();
92 return MEDIA_CAPTURE_NONE;
93 }
94
95 private:
96 DISALLOW_COPY_AND_ASSIGN(MediaDelegateStub);
97};
98
99} // namespace
100
101ShellDelegateMus::ShellDelegateMus(
jamescook428f986f2016-07-15 19:13:25102 std::unique_ptr<app_list::AppListPresenter> app_list_presenter,
103 shell::Connector* connector)
104 : app_list_presenter_(std::move(app_list_presenter)),
105 connector_(connector) {
106 // |connector_| may be null in tests.
107}
jamescook33375732016-07-14 22:09:28108
109ShellDelegateMus::~ShellDelegateMus() {}
110
111bool ShellDelegateMus::IsFirstRunAfterBoot() const {
112 NOTIMPLEMENTED();
113 return false;
114}
115
116bool ShellDelegateMus::IsIncognitoAllowed() const {
117 NOTIMPLEMENTED();
118 return false;
119}
120
121bool ShellDelegateMus::IsMultiProfilesEnabled() const {
122 NOTIMPLEMENTED();
123 return false;
124}
125
126bool ShellDelegateMus::IsRunningInForcedAppMode() const {
127 NOTIMPLEMENTED();
128 return false;
129}
130
131bool ShellDelegateMus::CanShowWindowForUser(WmWindow* window) const {
132 NOTIMPLEMENTED();
133 return true;
134}
135
136bool ShellDelegateMus::IsForceMaximizeOnFirstRun() const {
137 NOTIMPLEMENTED();
138 return false;
139}
140
141void ShellDelegateMus::PreInit() {
142 NOTIMPLEMENTED();
143}
144
145void ShellDelegateMus::PreShutdown() {
146 NOTIMPLEMENTED();
147}
148
149void ShellDelegateMus::Exit() {
150 NOTIMPLEMENTED();
151}
152
153keyboard::KeyboardUI* ShellDelegateMus::CreateKeyboardUI() {
154 NOTIMPLEMENTED();
155 return nullptr;
156}
157
kenobib7af62b2016-07-29 21:40:16158void ShellDelegateMus::OpenUrlFromArc(const GURL& url) {
jamescook33375732016-07-14 22:09:28159 NOTIMPLEMENTED();
160}
161
162app_list::AppListPresenter* ShellDelegateMus::GetAppListPresenter() {
163 return app_list_presenter_.get();
164}
165
166ShelfDelegate* ShellDelegateMus::CreateShelfDelegate(ShelfModel* model) {
167 NOTIMPLEMENTED();
168 return nullptr;
169}
170
171SystemTrayDelegate* ShellDelegateMus::CreateSystemTrayDelegate() {
172 NOTIMPLEMENTED() << " Using the default SystemTrayDelegate implementation";
173 return new DefaultSystemTrayDelegate;
174}
175
176UserWallpaperDelegate* ShellDelegateMus::CreateUserWallpaperDelegate() {
177 NOTIMPLEMENTED();
178 return nullptr;
179}
180
181SessionStateDelegate* ShellDelegateMus::CreateSessionStateDelegate() {
182 NOTIMPLEMENTED() << " Using a stub SessionStateDeleagte implementation";
183 return new SessionStateDelegateStub;
184}
185
186AccessibilityDelegate* ShellDelegateMus::CreateAccessibilityDelegate() {
jamescook428f986f2016-07-15 19:13:25187 return new AccessibilityDelegateMus(connector_);
jamescook33375732016-07-14 22:09:28188}
189
190NewWindowDelegate* ShellDelegateMus::CreateNewWindowDelegate() {
skya279c7c2016-07-27 23:08:42191 return new mus::NewWindowDelegateMus;
jamescook33375732016-07-14 22:09:28192}
193
194MediaDelegate* ShellDelegateMus::CreateMediaDelegate() {
195 NOTIMPLEMENTED() << " Using a stub MediaDelegate implementation";
196 return new MediaDelegateStub;
197}
198
riajiang957bb6a2016-07-22 17:00:23199std::unique_ptr<PointerWatcherDelegate>
200ShellDelegateMus::CreatePointerWatcherDelegate() {
jamescook33375732016-07-14 22:09:28201 NOTIMPLEMENTED();
202 return nullptr;
203}
204
205ui::MenuModel* ShellDelegateMus::CreateContextMenu(WmShelf* wm_shelf,
206 const ShelfItem* item) {
207 NOTIMPLEMENTED();
208 return nullptr;
209}
210
211GPUSupport* ShellDelegateMus::CreateGPUSupport() {
212 NOTIMPLEMENTED() << " Using a stub GPUSupport implementation";
213 return new GPUSupportStub();
214}
215
216base::string16 ShellDelegateMus::GetProductName() const {
217 NOTIMPLEMENTED();
218 return base::string16();
219}
220
221gfx::Image ShellDelegateMus::GetDeprecatedAcceleratorImage() const {
222 NOTIMPLEMENTED();
223 return gfx::Image();
224}
225
226} // namespace ash