blob: 9a4fb29bd9d4900eb51dd0f9286a691d44bdbb5c [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
James Cookb0bf8e82017-04-09 17:01:449#include "ash/gpu_support_stub.h"
jamescook428f986f2016-07-15 19:13:2510#include "ash/mus/accessibility_delegate_mus.h"
msw0e91d932016-08-25 22:34:0911#include "ash/mus/context_menu_mus.h"
jamescook01bf23e72017-01-09 19:58:1512#include "ash/mus/system_tray_delegate_mus.h"
msw7d03b2062016-09-10 00:13:2113#include "ash/mus/wallpaper_delegate_mus.h"
James Cookb0bf8e82017-04-09 17:01:4414#include "ash/palette_delegate.h"
15#include "ash/session/session_state_delegate.h"
jamescook33375732016-07-14 22:09:2816#include "base/memory/ptr_util.h"
17#include "base/strings/string16.h"
mswccb5d692016-08-17 20:37:4818#include "base/strings/string_util.h"
jamescook33375732016-07-14 22:09:2819#include "components/user_manager/user_info_impl.h"
jamescook33375732016-07-14 22:09:2820#include "ui/gfx/image/image.h"
21
22namespace ash {
23namespace {
24
25class SessionStateDelegateStub : public SessionStateDelegate {
26 public:
xiyuanf1ff14d2017-03-20 20:28:1427 SessionStateDelegateStub() : user_info_(new user_manager::UserInfoImpl()) {}
jamescook33375732016-07-14 22:09:2828
29 ~SessionStateDelegateStub() override {}
30
31 // SessionStateDelegate:
jamescook33375732016-07-14 22:09:2832 bool ShouldShowAvatar(WmWindow* window) const override {
33 NOTIMPLEMENTED();
34 return !user_info_->GetImage().isNull();
35 }
36 gfx::ImageSkia GetAvatarImageForWindow(WmWindow* window) const override {
37 NOTIMPLEMENTED();
38 return gfx::ImageSkia();
39 }
jamescook33375732016-07-14 22:09:2840
41 private:
jamescook33375732016-07-14 22:09:2842 // A pseudo user info.
43 std::unique_ptr<user_manager::UserInfo> user_info_;
44
45 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateStub);
46};
47
jamescook33375732016-07-14 22:09:2848} // namespace
49
msw0bc6a072017-02-14 16:33:3850ShellDelegateMus::ShellDelegateMus(service_manager::Connector* connector)
51 : connector_(connector) {}
jamescook33375732016-07-14 22:09:2852
53ShellDelegateMus::~ShellDelegateMus() {}
54
rockot400ea35b2016-10-15 19:15:3255service_manager::Connector* ShellDelegateMus::GetShellConnector() const {
jamescook2a6b8692016-10-04 02:41:2956 return connector_;
57}
58
jamescook33375732016-07-14 22:09:2859bool ShellDelegateMus::IsIncognitoAllowed() const {
60 NOTIMPLEMENTED();
61 return false;
62}
63
64bool ShellDelegateMus::IsMultiProfilesEnabled() const {
65 NOTIMPLEMENTED();
66 return false;
67}
68
69bool ShellDelegateMus::IsRunningInForcedAppMode() const {
70 NOTIMPLEMENTED();
71 return false;
72}
73
74bool ShellDelegateMus::CanShowWindowForUser(WmWindow* window) const {
75 NOTIMPLEMENTED();
76 return true;
77}
78
79bool ShellDelegateMus::IsForceMaximizeOnFirstRun() const {
80 NOTIMPLEMENTED();
81 return false;
82}
83
84void ShellDelegateMus::PreInit() {
85 NOTIMPLEMENTED();
86}
87
88void ShellDelegateMus::PreShutdown() {
89 NOTIMPLEMENTED();
90}
91
92void ShellDelegateMus::Exit() {
93 NOTIMPLEMENTED();
94}
95
96keyboard::KeyboardUI* ShellDelegateMus::CreateKeyboardUI() {
97 NOTIMPLEMENTED();
98 return nullptr;
99}
100
kenobib7af62b2016-07-29 21:40:16101void ShellDelegateMus::OpenUrlFromArc(const GURL& url) {
jamescook33375732016-07-14 22:09:28102 NOTIMPLEMENTED();
103}
104
msw5138f3d2017-04-20 00:22:07105void ShellDelegateMus::ShelfInit() {
106 NOTIMPLEMENTED();
107}
108
109void ShellDelegateMus::ShelfShutdown() {
110 NOTIMPLEMENTED();
jamescook33375732016-07-14 22:09:28111}
112
113SystemTrayDelegate* ShellDelegateMus::CreateSystemTrayDelegate() {
jamescook2a6b8692016-10-04 02:41:29114 return new SystemTrayDelegateMus();
jamescook33375732016-07-14 22:09:28115}
116
msw0e91d932016-08-25 22:34:09117std::unique_ptr<WallpaperDelegate> ShellDelegateMus::CreateWallpaperDelegate() {
mswc691bf12016-10-19 17:05:39118 return base::MakeUnique<WallpaperDelegateMus>();
jamescook33375732016-07-14 22:09:28119}
120
121SessionStateDelegate* ShellDelegateMus::CreateSessionStateDelegate() {
sky1eb7caa2016-09-16 00:02:46122 // TODO: http://crbug.com/647416.
jamescook33375732016-07-14 22:09:28123 NOTIMPLEMENTED() << " Using a stub SessionStateDeleagte implementation";
124 return new SessionStateDelegateStub;
125}
126
127AccessibilityDelegate* ShellDelegateMus::CreateAccessibilityDelegate() {
jamescook428f986f2016-07-15 19:13:25128 return new AccessibilityDelegateMus(connector_);
jamescook33375732016-07-14 22:09:28129}
130
jdufault0f4fa6e2016-08-05 19:13:59131std::unique_ptr<PaletteDelegate> ShellDelegateMus::CreatePaletteDelegate() {
sky1eb7caa2016-09-16 00:02:46132 // TODO: http://crbug.com/647417.
jdufault0f4fa6e2016-08-05 19:13:59133 NOTIMPLEMENTED();
134 return nullptr;
135}
136
James Cook840177e2017-05-25 02:20:01137ui::MenuModel* ShellDelegateMus::CreateContextMenu(Shelf* shelf,
jamescook33375732016-07-14 22:09:28138 const ShelfItem* item) {
James Cook840177e2017-05-25 02:20:01139 return new ContextMenuMus(shelf);
jamescook33375732016-07-14 22:09:28140}
141
142GPUSupport* ShellDelegateMus::CreateGPUSupport() {
sky1eb7caa2016-09-16 00:02:46143 // TODO: http://crbug.com/647421.
jamescook33375732016-07-14 22:09:28144 NOTIMPLEMENTED() << " Using a stub GPUSupport implementation";
145 return new GPUSupportStub();
146}
147
148base::string16 ShellDelegateMus::GetProductName() const {
149 NOTIMPLEMENTED();
150 return base::string16();
151}
152
153gfx::Image ShellDelegateMus::GetDeprecatedAcceleratorImage() const {
154 NOTIMPLEMENTED();
155 return gfx::Image();
156}
157
afakhry15eb9282017-04-27 04:03:31158PrefService* ShellDelegateMus::GetActiveUserPrefService() const {
159 // This code should never be called in the case of Config::MASH. Rather, the
160 // PrefService instance is stored by Shell when it manages to connect to the
161 // pref service in Chrome.
162 NOTREACHED();
163 return nullptr;
164}
165
warx4c8baedb2016-12-03 22:38:50166bool ShellDelegateMus::IsTouchscreenEnabledInPrefs(bool use_local_state) const {
167 NOTIMPLEMENTED();
168 return true;
169}
170
171void ShellDelegateMus::SetTouchscreenEnabledInPrefs(bool enabled,
172 bool use_local_state) {
173 NOTIMPLEMENTED();
174}
175
176void ShellDelegateMus::UpdateTouchscreenStatusFromPrefs() {
177 NOTIMPLEMENTED();
178}
179
jamescook33375732016-07-14 22:09:28180} // namespace ash