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