blob: 6474dd5f4e74e8f7c0895faeb1eb952c7ca7ac63 [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 {}
kaznacheev466e48c82017-04-20 22:35:2454 bool IsMetalayerSupported() override { return false; }
55 void ShowMetalayer(const base::Closure& closed) override {}
56 void HideMetalayer() override {}
jdufault0f4fa6e2016-08-05 19:13:5957
58 private:
59 DISALLOW_COPY_AND_ASSIGN(PaletteDelegateImpl);
60};
61
[email protected]7009d9b2014-05-03 21:38:3662class SessionStateDelegateImpl : public SessionStateDelegate {
63 public:
xiyuanf1ff14d2017-03-20 20:28:1464 SessionStateDelegateImpl() : user_info_(new user_manager::UserInfoImpl()) {}
[email protected]7009d9b2014-05-03 21:38:3665
dchengf5963512014-10-28 01:14:1366 ~SessionStateDelegateImpl() override {}
[email protected]7009d9b2014-05-03 21:38:3667
68 // SessionStateDelegate:
jamescook26db34d52016-06-07 18:25:3869 bool ShouldShowAvatar(WmWindow* window) const override {
[email protected]7009d9b2014-05-03 21:38:3670 return !user_info_->GetImage().isNull();
71 }
jamescook26db34d52016-06-07 18:25:3872 gfx::ImageSkia GetAvatarImageForWindow(WmWindow* window) const override {
ben93072442015-10-05 19:14:3273 return gfx::ImageSkia();
74 }
[email protected]7009d9b2014-05-03 21:38:3675
76 private:
[email protected]7009d9b2014-05-03 21:38:3677 // A pseudo user info.
dchenga94547472016-04-08 08:41:1178 std::unique_ptr<user_manager::UserInfo> user_info_;
[email protected]7009d9b2014-05-03 21:38:3679
80 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateImpl);
81};
82
[email protected]47686c42013-10-25 01:49:1783} // namespace
[email protected]262f8bd2012-03-23 19:30:2784
mswfb834642017-01-04 22:50:0585ShellDelegateImpl::ShellDelegateImpl() {}
[email protected]262f8bd2012-03-23 19:30:2786
mswc3cf79d2016-01-05 20:52:0687ShellDelegateImpl::~ShellDelegateImpl() {}
[email protected]262f8bd2012-03-23 19:30:2788
rockot400ea35b2016-10-15 19:15:3289::service_manager::Connector* ShellDelegateImpl::GetShellConnector() const {
jamescook2a6b8692016-10-04 02:41:2990 return nullptr;
91}
92
[email protected]5ecf6122013-10-31 12:24:0993bool ShellDelegateImpl::IsIncognitoAllowed() const {
94 return true;
95}
96
[email protected]e718e6f2013-04-15 16:01:5997bool ShellDelegateImpl::IsMultiProfilesEnabled() const {
98 return false;
99}
100
[email protected]565f32fc02013-03-05 18:51:48101bool ShellDelegateImpl::IsRunningInForcedAppMode() const {
102 return false;
103}
104
jamescookfd4ba1d2016-06-10 04:38:17105bool ShellDelegateImpl::CanShowWindowForUser(WmWindow* window) const {
ben894584d2015-09-30 23:56:53106 return true;
107}
108
peletskyida0bbb12015-04-08 17:11:04109bool ShellDelegateImpl::IsForceMaximizeOnFirstRun() const {
110 return false;
111}
112
jamescookb8dcef522016-06-25 14:42:55113void ShellDelegateImpl::PreInit() {}
[email protected]dcc990722013-03-24 16:35:20114
jamescookb8dcef522016-06-25 14:42:55115void ShellDelegateImpl::PreShutdown() {}
[email protected]3528b7d2012-04-18 10:46:36116
[email protected]262f8bd2012-03-23 19:30:27117void ShellDelegateImpl::Exit() {
sadruld3af96a2016-01-28 16:16:24118 base::MessageLoop::current()->QuitWhenIdle();
[email protected]262f8bd2012-03-23 19:30:27119}
120
ben974286a2015-10-10 00:45:12121keyboard::KeyboardUI* ShellDelegateImpl::CreateKeyboardUI() {
122 return new TestKeyboardUI;
[email protected]86459e2c2013-04-10 13:39:24123}
124
kenobib7af62b2016-07-29 21:40:16125void ShellDelegateImpl::OpenUrlFromArc(const GURL& url) {}
yusukes0b08bdbb2016-03-30 21:39:54126
msw5138f3d2017-04-20 00:22:07127void ShellDelegateImpl::ShelfInit() {}
128
129void ShellDelegateImpl::ShelfShutdown() {}
[email protected]262f8bd2012-03-23 19:30:27130
msw0e91d932016-08-25 22:34:09131SystemTrayDelegate* ShellDelegateImpl::CreateSystemTrayDelegate() {
jamescook1a1473722017-04-19 00:29:49132 return new test::TestSystemTrayDelegate;
[email protected]262f8bd2012-03-23 19:30:27133}
134
msw0e91d932016-08-25 22:34:09135std::unique_ptr<WallpaperDelegate>
136ShellDelegateImpl::CreateWallpaperDelegate() {
137 return base::MakeUnique<DefaultWallpaperDelegate>();
[email protected]262f8bd2012-03-23 19:30:27138}
[email protected]4d7ce4352012-07-13 06:56:06139
msw0e91d932016-08-25 22:34:09140SessionStateDelegate* ShellDelegateImpl::CreateSessionStateDelegate() {
[email protected]7009d9b2014-05-03 21:38:36141 return new SessionStateDelegateImpl;
[email protected]fcb123d2013-04-17 15:58:49142}
143
msw0e91d932016-08-25 22:34:09144AccessibilityDelegate* ShellDelegateImpl::CreateAccessibilityDelegate() {
[email protected]093b8d642014-04-03 20:59:28145 return new DefaultAccessibilityDelegate;
[email protected]f3ab6eff52013-10-24 03:29:38146}
147
jdufault0f4fa6e2016-08-05 19:13:59148std::unique_ptr<PaletteDelegate> ShellDelegateImpl::CreatePaletteDelegate() {
riceac9462d42016-08-22 02:40:28149 return base::MakeUnique<PaletteDelegateImpl>();
jdufault0f4fa6e2016-08-05 19:13:59150}
151
jamescookda53c142016-06-08 23:38:56152ui::MenuModel* ShellDelegateImpl::CreateContextMenu(WmShelf* wm_shelf,
153 const ShelfItem* item) {
154 return new ContextMenu(wm_shelf);
[email protected]431552c2012-10-23 00:38:33155}
156
[email protected]99edff3e2014-01-31 18:20:36157GPUSupport* ShellDelegateImpl::CreateGPUSupport() {
158 // Real GPU support depends on src/content, so just use a stub.
159 return new GPUSupportStub;
160}
161
[email protected]ed95e022013-04-11 04:03:32162base::string16 ShellDelegateImpl::GetProductName() const {
163 return base::string16();
[email protected]5673bf52013-02-01 06:14:24164}
165
afakhrycd2bb98d2015-09-09 09:03:42166gfx::Image ShellDelegateImpl::GetDeprecatedAcceleratorImage() const {
167 return gfx::Image();
168}
169
warx4c8baedb2016-12-03 22:38:50170bool ShellDelegateImpl::IsTouchscreenEnabledInPrefs(
171 bool use_local_state) const {
172 return true;
173}
174
175void ShellDelegateImpl::SetTouchscreenEnabledInPrefs(bool enabled,
176 bool use_local_state) {}
177
178void ShellDelegateImpl::UpdateTouchscreenStatusFromPrefs() {}
179
[email protected]262f8bd2012-03-23 19:30:27180} // namespace shell
181} // namespace ash