blob: 04815eb055eac84d243dfab6e9a0d2987ae4864d [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"
jamescookfd4ba1d2016-06-10 04:38:1713#include "ash/shell.h"
[email protected]565f32fc02013-03-05 18:51:4814#include "ash/shell/context_menu.h"
[email protected]262f8bd2012-03-23 19:30:2715#include "ash/shell/example_factory.h"
[email protected]b77236f72012-03-25 03:07:1916#include "ash/shell/toplevel_window.h"
James Cookbb026732017-06-09 23:01:5517#include "ash/system/tray/system_tray_delegate.h"
ben974286a2015-10-10 00:45:1218#include "ash/test/test_keyboard_ui.h"
James Cookb0bf8e82017-04-09 17:01:4419#include "ash/wm/window_state.h"
mfomitchev493ed602016-04-09 00:48:3920#include "base/memory/ptr_util.h"
[email protected]9e3e6352013-07-17 04:07:5121#include "base/message_loop/message_loop.h"
[email protected]7009d9b2014-05-03 21:38:3622#include "base/strings/utf_string_conversions.h"
[email protected]d66eac42014-07-14 23:48:3023#include "components/user_manager/user_info_impl.h"
[email protected]262f8bd2012-03-23 19:30:2724#include "ui/aura/window.h"
afakhrycd2bb98d2015-09-09 09:03:4225#include "ui/gfx/image/image.h"
ben93072442015-10-05 19:14:3226#include "ui/gfx/image/image_skia.h"
[email protected]262f8bd2012-03-23 19:30:2727
28namespace ash {
29namespace shell {
[email protected]47686c42013-10-25 01:49:1730namespace {
31
jdufault0f4fa6e2016-08-05 19:13:5932class PaletteDelegateImpl : public PaletteDelegate {
33 public:
jdufault77dfb1852016-08-22 18:46:3034 PaletteDelegateImpl() {}
35 ~PaletteDelegateImpl() override {}
36
37 // PaletteDelegate:
jdufaultfbe81f62016-08-26 16:51:0638 std::unique_ptr<EnableListenerSubscription> AddPaletteEnableListener(
39 const EnableListener& on_state_changed) override {
40 on_state_changed.Run(false);
41 return nullptr;
42 }
jdufault77dfb1852016-08-22 18:46:3043 void CreateNote() override {}
44 bool HasNoteApp() override { return false; }
jdufaultd57fbda2016-08-26 00:18:0145 bool ShouldAutoOpenPalette() override { return false; }
jdufaulta0ff88622016-08-26 22:22:1346 bool ShouldShowPalette() override { return false; }
jdufaulte18aeb22016-08-24 00:46:3547 void TakeScreenshot() override {}
jdufaulte4546d222016-09-02 20:27:1748 void TakePartialScreenshot(const base::Closure& done) override {
49 if (done)
50 done.Run();
51 }
52 void CancelPartialScreenshot() override {}
kaznacheev466e48c82017-04-20 22:35:2453 bool IsMetalayerSupported() override { return false; }
54 void ShowMetalayer(const base::Closure& closed) override {}
55 void HideMetalayer() override {}
jdufault0f4fa6e2016-08-05 19:13:5956
57 private:
58 DISALLOW_COPY_AND_ASSIGN(PaletteDelegateImpl);
59};
60
[email protected]47686c42013-10-25 01:49:1761} // namespace
[email protected]262f8bd2012-03-23 19:30:2762
mswfb834642017-01-04 22:50:0563ShellDelegateImpl::ShellDelegateImpl() {}
[email protected]262f8bd2012-03-23 19:30:2764
mswc3cf79d2016-01-05 20:52:0665ShellDelegateImpl::~ShellDelegateImpl() {}
[email protected]262f8bd2012-03-23 19:30:2766
rockot400ea35b2016-10-15 19:15:3267::service_manager::Connector* ShellDelegateImpl::GetShellConnector() const {
jamescook2a6b8692016-10-04 02:41:2968 return nullptr;
69}
70
[email protected]5ecf6122013-10-31 12:24:0971bool ShellDelegateImpl::IsIncognitoAllowed() const {
72 return true;
73}
74
[email protected]e718e6f2013-04-15 16:01:5975bool ShellDelegateImpl::IsMultiProfilesEnabled() const {
76 return false;
77}
78
[email protected]565f32fc02013-03-05 18:51:4879bool ShellDelegateImpl::IsRunningInForcedAppMode() const {
80 return false;
81}
82
varkhad43f55242017-05-26 20:55:5883bool ShellDelegateImpl::CanShowWindowForUser(aura::Window* window) const {
ben894584d2015-09-30 23:56:5384 return true;
85}
86
peletskyida0bbb12015-04-08 17:11:0487bool ShellDelegateImpl::IsForceMaximizeOnFirstRun() const {
88 return false;
89}
90
jamescookb8dcef522016-06-25 14:42:5591void ShellDelegateImpl::PreInit() {}
[email protected]dcc990722013-03-24 16:35:2092
jamescookb8dcef522016-06-25 14:42:5593void ShellDelegateImpl::PreShutdown() {}
[email protected]3528b7d2012-04-18 10:46:3694
[email protected]262f8bd2012-03-23 19:30:2795void ShellDelegateImpl::Exit() {
sadruld3af96a2016-01-28 16:16:2496 base::MessageLoop::current()->QuitWhenIdle();
[email protected]262f8bd2012-03-23 19:30:2797}
98
yhanada8909a542017-07-11 10:06:1999std::unique_ptr<keyboard::KeyboardUI> ShellDelegateImpl::CreateKeyboardUI() {
100 return base::MakeUnique<TestKeyboardUI>();
[email protected]86459e2c2013-04-10 13:39:24101}
102
kenobib7af62b2016-07-29 21:40:16103void ShellDelegateImpl::OpenUrlFromArc(const GURL& url) {}
yusukes0b08bdbb2016-03-30 21:39:54104
msw5138f3d2017-04-20 00:22:07105void ShellDelegateImpl::ShelfInit() {}
106
107void ShellDelegateImpl::ShelfShutdown() {}
[email protected]262f8bd2012-03-23 19:30:27108
msw0e91d932016-08-25 22:34:09109SystemTrayDelegate* ShellDelegateImpl::CreateSystemTrayDelegate() {
James Cookbb026732017-06-09 23:01:55110 return new SystemTrayDelegate;
111}
112
msw0e91d932016-08-25 22:34:09113std::unique_ptr<WallpaperDelegate>
114ShellDelegateImpl::CreateWallpaperDelegate() {
115 return base::MakeUnique<DefaultWallpaperDelegate>();
[email protected]262f8bd2012-03-23 19:30:27116}
[email protected]4d7ce4352012-07-13 06:56:06117
msw0e91d932016-08-25 22:34:09118AccessibilityDelegate* ShellDelegateImpl::CreateAccessibilityDelegate() {
[email protected]093b8d642014-04-03 20:59:28119 return new DefaultAccessibilityDelegate;
[email protected]f3ab6eff52013-10-24 03:29:38120}
121
jdufault0f4fa6e2016-08-05 19:13:59122std::unique_ptr<PaletteDelegate> ShellDelegateImpl::CreatePaletteDelegate() {
riceac9462d42016-08-22 02:40:28123 return base::MakeUnique<PaletteDelegateImpl>();
jdufault0f4fa6e2016-08-05 19:13:59124}
125
James Cook840177e2017-05-25 02:20:01126ui::MenuModel* ShellDelegateImpl::CreateContextMenu(Shelf* shelf,
jamescookda53c142016-06-08 23:38:56127 const ShelfItem* item) {
James Cook840177e2017-05-25 02:20:01128 return new ContextMenu(shelf);
[email protected]431552c2012-10-23 00:38:33129}
130
[email protected]99edff3e2014-01-31 18:20:36131GPUSupport* ShellDelegateImpl::CreateGPUSupport() {
132 // Real GPU support depends on src/content, so just use a stub.
133 return new GPUSupportStub;
134}
135
[email protected]ed95e022013-04-11 04:03:32136base::string16 ShellDelegateImpl::GetProductName() const {
137 return base::string16();
[email protected]5673bf52013-02-01 06:14:24138}
139
afakhrycd2bb98d2015-09-09 09:03:42140gfx::Image ShellDelegateImpl::GetDeprecatedAcceleratorImage() const {
141 return gfx::Image();
142}
143
afakhry15eb9282017-04-27 04:03:31144PrefService* ShellDelegateImpl::GetActiveUserPrefService() const {
145 return nullptr;
146}
147
warx4c8baedb2016-12-03 22:38:50148bool ShellDelegateImpl::IsTouchscreenEnabledInPrefs(
149 bool use_local_state) const {
150 return true;
151}
152
153void ShellDelegateImpl::SetTouchscreenEnabledInPrefs(bool enabled,
154 bool use_local_state) {}
155
156void ShellDelegateImpl::UpdateTouchscreenStatusFromPrefs() {}
157
Scott Violet17a61722017-06-19 17:54:31158#if defined(USE_OZONE)
159ui::InputDeviceControllerClient*
160ShellDelegateImpl::GetInputDeviceControllerClient() {
161 return nullptr;
162}
163#endif
164
[email protected]262f8bd2012-03-23 19:30:27165} // namespace shell
166} // namespace ash