blob: 8aab1aee913dfbfc233d50f7a6d00a23c650b697 [file] [log] [blame]
[email protected]262f8bd2012-03-23 19:30:271// Copyright (c) 2012 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/shell/shell_delegate_impl.h"
6
James Cookb0bf8e82017-04-09 17:01:447#include "ash/accessibility_delegate.h"
8#include "ash/default_accessibility_delegate.h"
msw0e91d932016-08-25 22:34:099#include "ash/default_wallpaper_delegate.h"
James Cookb0bf8e82017-04-09 17:01:4410#include "ash/gpu_support_stub.h"
11#include "ash/palette_delegate.h"
jamescook8800b8232016-10-19 12:46:2712#include "ash/public/cpp/shell_window_ids.h"
James Cookb0bf8e82017-04-09 17:01:4413#include "ash/session/session_state_delegate.h"
jamescookfd4ba1d2016-06-10 04:38:1714#include "ash/shell.h"
[email protected]565f32fc02013-03-05 18:51:4815#include "ash/shell/context_menu.h"
[email protected]262f8bd2012-03-23 19:30:2716#include "ash/shell/example_factory.h"
[email protected]b77236f72012-03-25 03:07:1917#include "ash/shell/toplevel_window.h"
ben974286a2015-10-10 00:45:1218#include "ash/test/test_keyboard_ui.h"
jamescook1a1473722017-04-19 00:29:4919#include "ash/test/test_system_tray_delegate.h"
James Cookb0bf8e82017-04-09 17:01:4420#include "ash/wm/window_state.h"
mfomitchev493ed602016-04-09 00:48:3921#include "base/memory/ptr_util.h"
[email protected]9e3e6352013-07-17 04:07:5122#include "base/message_loop/message_loop.h"
[email protected]7009d9b2014-05-03 21:38:3623#include "base/strings/utf_string_conversions.h"
[email protected]d66eac42014-07-14 23:48:3024#include "components/user_manager/user_info_impl.h"
[email protected]262f8bd2012-03-23 19:30:2725#include "ui/aura/window.h"
afakhrycd2bb98d2015-09-09 09:03:4226#include "ui/gfx/image/image.h"
ben93072442015-10-05 19:14:3227#include "ui/gfx/image/image_skia.h"
[email protected]262f8bd2012-03-23 19:30:2728
29namespace ash {
30namespace shell {
[email protected]47686c42013-10-25 01:49:1731namespace {
32
jdufault0f4fa6e2016-08-05 19:13:5933class PaletteDelegateImpl : public PaletteDelegate {
34 public:
jdufault77dfb1852016-08-22 18:46:3035 PaletteDelegateImpl() {}
36 ~PaletteDelegateImpl() override {}
37
38 // PaletteDelegate:
jdufaultfbe81f62016-08-26 16:51:0639 std::unique_ptr<EnableListenerSubscription> AddPaletteEnableListener(
40 const EnableListener& on_state_changed) override {
41 on_state_changed.Run(false);
42 return nullptr;
43 }
jdufault77dfb1852016-08-22 18:46:3044 void CreateNote() override {}
45 bool HasNoteApp() override { return false; }
jdufaultd57fbda2016-08-26 00:18:0146 bool ShouldAutoOpenPalette() override { return false; }
jdufaulta0ff88622016-08-26 22:22:1347 bool ShouldShowPalette() override { return false; }
jdufaulte18aeb22016-08-24 00:46:3548 void TakeScreenshot() override {}
jdufaulte4546d222016-09-02 20:27:1749 void TakePartialScreenshot(const base::Closure& done) override {
50 if (done)
51 done.Run();
52 }
53 void CancelPartialScreenshot() override {}
jdufault0f4fa6e2016-08-05 19:13:5954
55 private:
56 DISALLOW_COPY_AND_ASSIGN(PaletteDelegateImpl);
57};
58
[email protected]7009d9b2014-05-03 21:38:3659class SessionStateDelegateImpl : public SessionStateDelegate {
60 public:
xiyuanf1ff14d2017-03-20 20:28:1461 SessionStateDelegateImpl() : user_info_(new user_manager::UserInfoImpl()) {}
[email protected]7009d9b2014-05-03 21:38:3662
dchengf5963512014-10-28 01:14:1363 ~SessionStateDelegateImpl() override {}
[email protected]7009d9b2014-05-03 21:38:3664
65 // SessionStateDelegate:
jamescook26db34d52016-06-07 18:25:3866 bool ShouldShowAvatar(WmWindow* window) const override {
[email protected]7009d9b2014-05-03 21:38:3667 return !user_info_->GetImage().isNull();
68 }
jamescook26db34d52016-06-07 18:25:3869 gfx::ImageSkia GetAvatarImageForWindow(WmWindow* window) const override {
ben93072442015-10-05 19:14:3270 return gfx::ImageSkia();
71 }
[email protected]7009d9b2014-05-03 21:38:3672
73 private:
[email protected]7009d9b2014-05-03 21:38:3674 // A pseudo user info.
dchenga94547472016-04-08 08:41:1175 std::unique_ptr<user_manager::UserInfo> user_info_;
[email protected]7009d9b2014-05-03 21:38:3676
77 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateImpl);
78};
79
[email protected]47686c42013-10-25 01:49:1780} // namespace
[email protected]262f8bd2012-03-23 19:30:2781
mswfb834642017-01-04 22:50:0582ShellDelegateImpl::ShellDelegateImpl() {}
[email protected]262f8bd2012-03-23 19:30:2783
mswc3cf79d2016-01-05 20:52:0684ShellDelegateImpl::~ShellDelegateImpl() {}
[email protected]262f8bd2012-03-23 19:30:2785
rockot400ea35b2016-10-15 19:15:3286::service_manager::Connector* ShellDelegateImpl::GetShellConnector() const {
jamescook2a6b8692016-10-04 02:41:2987 return nullptr;
88}
89
[email protected]5ecf6122013-10-31 12:24:0990bool ShellDelegateImpl::IsIncognitoAllowed() const {
91 return true;
92}
93
[email protected]e718e6f2013-04-15 16:01:5994bool ShellDelegateImpl::IsMultiProfilesEnabled() const {
95 return false;
96}
97
[email protected]565f32fc02013-03-05 18:51:4898bool ShellDelegateImpl::IsRunningInForcedAppMode() const {
99 return false;
100}
101
jamescookfd4ba1d2016-06-10 04:38:17102bool ShellDelegateImpl::CanShowWindowForUser(WmWindow* window) const {
ben894584d2015-09-30 23:56:53103 return true;
104}
105
peletskyida0bbb12015-04-08 17:11:04106bool ShellDelegateImpl::IsForceMaximizeOnFirstRun() const {
107 return false;
108}
109
jamescookb8dcef522016-06-25 14:42:55110void ShellDelegateImpl::PreInit() {}
[email protected]dcc990722013-03-24 16:35:20111
jamescookb8dcef522016-06-25 14:42:55112void ShellDelegateImpl::PreShutdown() {}
[email protected]3528b7d2012-04-18 10:46:36113
[email protected]262f8bd2012-03-23 19:30:27114void ShellDelegateImpl::Exit() {
sadruld3af96a2016-01-28 16:16:24115 base::MessageLoop::current()->QuitWhenIdle();
[email protected]262f8bd2012-03-23 19:30:27116}
117
ben974286a2015-10-10 00:45:12118keyboard::KeyboardUI* ShellDelegateImpl::CreateKeyboardUI() {
119 return new TestKeyboardUI;
[email protected]86459e2c2013-04-10 13:39:24120}
121
kenobib7af62b2016-07-29 21:40:16122void ShellDelegateImpl::OpenUrlFromArc(const GURL& url) {}
yusukes0b08bdbb2016-03-30 21:39:54123
msw5138f3d2017-04-20 00:22:07124void ShellDelegateImpl::ShelfInit() {}
125
126void ShellDelegateImpl::ShelfShutdown() {}
[email protected]262f8bd2012-03-23 19:30:27127
msw0e91d932016-08-25 22:34:09128SystemTrayDelegate* ShellDelegateImpl::CreateSystemTrayDelegate() {
jamescook1a1473722017-04-19 00:29:49129 return new test::TestSystemTrayDelegate;
[email protected]262f8bd2012-03-23 19:30:27130}
131
msw0e91d932016-08-25 22:34:09132std::unique_ptr<WallpaperDelegate>
133ShellDelegateImpl::CreateWallpaperDelegate() {
134 return base::MakeUnique<DefaultWallpaperDelegate>();
[email protected]262f8bd2012-03-23 19:30:27135}
[email protected]4d7ce4352012-07-13 06:56:06136
msw0e91d932016-08-25 22:34:09137SessionStateDelegate* ShellDelegateImpl::CreateSessionStateDelegate() {
[email protected]7009d9b2014-05-03 21:38:36138 return new SessionStateDelegateImpl;
[email protected]fcb123d2013-04-17 15:58:49139}
140
msw0e91d932016-08-25 22:34:09141AccessibilityDelegate* ShellDelegateImpl::CreateAccessibilityDelegate() {
[email protected]093b8d642014-04-03 20:59:28142 return new DefaultAccessibilityDelegate;
[email protected]f3ab6eff52013-10-24 03:29:38143}
144
jdufault0f4fa6e2016-08-05 19:13:59145std::unique_ptr<PaletteDelegate> ShellDelegateImpl::CreatePaletteDelegate() {
riceac9462d42016-08-22 02:40:28146 return base::MakeUnique<PaletteDelegateImpl>();
jdufault0f4fa6e2016-08-05 19:13:59147}
148
jamescookda53c142016-06-08 23:38:56149ui::MenuModel* ShellDelegateImpl::CreateContextMenu(WmShelf* wm_shelf,
150 const ShelfItem* item) {
151 return new ContextMenu(wm_shelf);
[email protected]431552c2012-10-23 00:38:33152}
153
[email protected]99edff3e2014-01-31 18:20:36154GPUSupport* ShellDelegateImpl::CreateGPUSupport() {
155 // Real GPU support depends on src/content, so just use a stub.
156 return new GPUSupportStub;
157}
158
[email protected]ed95e022013-04-11 04:03:32159base::string16 ShellDelegateImpl::GetProductName() const {
160 return base::string16();
[email protected]5673bf52013-02-01 06:14:24161}
162
afakhrycd2bb98d2015-09-09 09:03:42163gfx::Image ShellDelegateImpl::GetDeprecatedAcceleratorImage() const {
164 return gfx::Image();
165}
166
warx4c8baedb2016-12-03 22:38:50167bool ShellDelegateImpl::IsTouchscreenEnabledInPrefs(
168 bool use_local_state) const {
169 return true;
170}
171
172void ShellDelegateImpl::SetTouchscreenEnabledInPrefs(bool enabled,
173 bool use_local_state) {}
174
175void ShellDelegateImpl::UpdateTouchscreenStatusFromPrefs() {}
176
[email protected]262f8bd2012-03-23 19:30:27177} // namespace shell
178} // namespace ash