[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 1 | // 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 Cook | b0bf8e8 | 2017-04-09 17:01:44 | [diff] [blame] | 7 | #include "ash/accessibility_delegate.h" |
8 | #include "ash/default_accessibility_delegate.h" | ||||
msw | 0e91d93 | 2016-08-25 22:34:09 | [diff] [blame] | 9 | #include "ash/default_wallpaper_delegate.h" |
James Cook | b0bf8e8 | 2017-04-09 17:01:44 | [diff] [blame] | 10 | #include "ash/gpu_support_stub.h" |
11 | #include "ash/palette_delegate.h" | ||||
jamescook | 8800b823 | 2016-10-19 12:46:27 | [diff] [blame] | 12 | #include "ash/public/cpp/shell_window_ids.h" |
jamescook | fd4ba1d | 2016-06-10 04:38:17 | [diff] [blame] | 13 | #include "ash/shell.h" |
[email protected] | 565f32fc0 | 2013-03-05 18:51:48 | [diff] [blame] | 14 | #include "ash/shell/context_menu.h" |
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 15 | #include "ash/shell/example_factory.h" |
[email protected] | b77236f7 | 2012-03-25 03:07:19 | [diff] [blame] | 16 | #include "ash/shell/toplevel_window.h" |
James Cook | bb02673 | 2017-06-09 23:01:55 | [diff] [blame] | 17 | #include "ash/system/tray/system_tray_delegate.h" |
ben | 974286a | 2015-10-10 00:45:12 | [diff] [blame] | 18 | #include "ash/test/test_keyboard_ui.h" |
James Cook | b0bf8e8 | 2017-04-09 17:01:44 | [diff] [blame] | 19 | #include "ash/wm/window_state.h" |
mfomitchev | 493ed60 | 2016-04-09 00:48:39 | [diff] [blame] | 20 | #include "base/memory/ptr_util.h" |
[email protected] | 9e3e635 | 2013-07-17 04:07:51 | [diff] [blame] | 21 | #include "base/message_loop/message_loop.h" |
[email protected] | 7009d9b | 2014-05-03 21:38:36 | [diff] [blame] | 22 | #include "base/strings/utf_string_conversions.h" |
[email protected] | d66eac4 | 2014-07-14 23:48:30 | [diff] [blame] | 23 | #include "components/user_manager/user_info_impl.h" |
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 24 | #include "ui/aura/window.h" |
afakhry | cd2bb98d | 2015-09-09 09:03:42 | [diff] [blame] | 25 | #include "ui/gfx/image/image.h" |
ben | 9307244 | 2015-10-05 19:14:32 | [diff] [blame] | 26 | #include "ui/gfx/image/image_skia.h" |
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 27 | |
28 | namespace ash { | ||||
29 | namespace shell { | ||||
[email protected] | 47686c4 | 2013-10-25 01:49:17 | [diff] [blame] | 30 | namespace { |
31 | |||||
jdufault | 0f4fa6e | 2016-08-05 19:13:59 | [diff] [blame] | 32 | class PaletteDelegateImpl : public PaletteDelegate { |
33 | public: | ||||
jdufault | 77dfb185 | 2016-08-22 18:46:30 | [diff] [blame] | 34 | PaletteDelegateImpl() {} |
35 | ~PaletteDelegateImpl() override {} | ||||
36 | |||||
37 | // PaletteDelegate: | ||||
jdufault | fbe81f6 | 2016-08-26 16:51:06 | [diff] [blame] | 38 | std::unique_ptr<EnableListenerSubscription> AddPaletteEnableListener( |
39 | const EnableListener& on_state_changed) override { | ||||
40 | on_state_changed.Run(false); | ||||
41 | return nullptr; | ||||
42 | } | ||||
jdufault | 77dfb185 | 2016-08-22 18:46:30 | [diff] [blame] | 43 | void CreateNote() override {} |
44 | bool HasNoteApp() override { return false; } | ||||
jdufault | d57fbda | 2016-08-26 00:18:01 | [diff] [blame] | 45 | bool ShouldAutoOpenPalette() override { return false; } |
jdufault | a0ff8862 | 2016-08-26 22:22:13 | [diff] [blame] | 46 | bool ShouldShowPalette() override { return false; } |
jdufault | e18aeb2 | 2016-08-24 00:46:35 | [diff] [blame] | 47 | void TakeScreenshot() override {} |
jdufault | e4546d22 | 2016-09-02 20:27:17 | [diff] [blame] | 48 | void TakePartialScreenshot(const base::Closure& done) override { |
49 | if (done) | ||||
50 | done.Run(); | ||||
51 | } | ||||
52 | void CancelPartialScreenshot() override {} | ||||
kaznacheev | 466e48c8 | 2017-04-20 22:35:24 | [diff] [blame] | 53 | bool IsMetalayerSupported() override { return false; } |
54 | void ShowMetalayer(const base::Closure& closed) override {} | ||||
55 | void HideMetalayer() override {} | ||||
jdufault | 0f4fa6e | 2016-08-05 19:13:59 | [diff] [blame] | 56 | |
57 | private: | ||||
58 | DISALLOW_COPY_AND_ASSIGN(PaletteDelegateImpl); | ||||
59 | }; | ||||
60 | |||||
[email protected] | 47686c4 | 2013-10-25 01:49:17 | [diff] [blame] | 61 | } // namespace |
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 62 | |
msw | fb83464 | 2017-01-04 22:50:05 | [diff] [blame] | 63 | ShellDelegateImpl::ShellDelegateImpl() {} |
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 64 | |
msw | c3cf79d | 2016-01-05 20:52:06 | [diff] [blame] | 65 | ShellDelegateImpl::~ShellDelegateImpl() {} |
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 66 | |
rockot | 400ea35b | 2016-10-15 19:15:32 | [diff] [blame] | 67 | ::service_manager::Connector* ShellDelegateImpl::GetShellConnector() const { |
jamescook | 2a6b869 | 2016-10-04 02:41:29 | [diff] [blame] | 68 | return nullptr; |
69 | } | ||||
70 | |||||
[email protected] | 5ecf612 | 2013-10-31 12:24:09 | [diff] [blame] | 71 | bool ShellDelegateImpl::IsIncognitoAllowed() const { |
72 | return true; | ||||
73 | } | ||||
74 | |||||
[email protected] | e718e6f | 2013-04-15 16:01:59 | [diff] [blame] | 75 | bool ShellDelegateImpl::IsMultiProfilesEnabled() const { |
76 | return false; | ||||
77 | } | ||||
78 | |||||
[email protected] | 565f32fc0 | 2013-03-05 18:51:48 | [diff] [blame] | 79 | bool ShellDelegateImpl::IsRunningInForcedAppMode() const { |
80 | return false; | ||||
81 | } | ||||
82 | |||||
varkha | d43f5524 | 2017-05-26 20:55:58 | [diff] [blame] | 83 | bool ShellDelegateImpl::CanShowWindowForUser(aura::Window* window) const { |
ben | 894584d | 2015-09-30 23:56:53 | [diff] [blame] | 84 | return true; |
85 | } | ||||
86 | |||||
peletskyi | da0bbb1 | 2015-04-08 17:11:04 | [diff] [blame] | 87 | bool ShellDelegateImpl::IsForceMaximizeOnFirstRun() const { |
88 | return false; | ||||
89 | } | ||||
90 | |||||
jamescook | b8dcef52 | 2016-06-25 14:42:55 | [diff] [blame] | 91 | void ShellDelegateImpl::PreInit() {} |
[email protected] | dcc99072 | 2013-03-24 16:35:20 | [diff] [blame] | 92 | |
jamescook | b8dcef52 | 2016-06-25 14:42:55 | [diff] [blame] | 93 | void ShellDelegateImpl::PreShutdown() {} |
[email protected] | 3528b7d | 2012-04-18 10:46:36 | [diff] [blame] | 94 | |
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 95 | void ShellDelegateImpl::Exit() { |
sadrul | d3af96a | 2016-01-28 16:16:24 | [diff] [blame] | 96 | base::MessageLoop::current()->QuitWhenIdle(); |
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 97 | } |
98 | |||||
yhanada | 8909a54 | 2017-07-11 10:06:19 | [diff] [blame^] | 99 | std::unique_ptr<keyboard::KeyboardUI> ShellDelegateImpl::CreateKeyboardUI() { |
100 | return base::MakeUnique<TestKeyboardUI>(); | ||||
[email protected] | 86459e2c | 2013-04-10 13:39:24 | [diff] [blame] | 101 | } |
102 | |||||
kenobi | b7af62b | 2016-07-29 21:40:16 | [diff] [blame] | 103 | void ShellDelegateImpl::OpenUrlFromArc(const GURL& url) {} |
yusukes | 0b08bdbb | 2016-03-30 21:39:54 | [diff] [blame] | 104 | |
msw | 5138f3d | 2017-04-20 00:22:07 | [diff] [blame] | 105 | void ShellDelegateImpl::ShelfInit() {} |
106 | |||||
107 | void ShellDelegateImpl::ShelfShutdown() {} | ||||
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 108 | |
msw | 0e91d93 | 2016-08-25 22:34:09 | [diff] [blame] | 109 | SystemTrayDelegate* ShellDelegateImpl::CreateSystemTrayDelegate() { |
James Cook | bb02673 | 2017-06-09 23:01:55 | [diff] [blame] | 110 | return new SystemTrayDelegate; |
111 | } | ||||
112 | |||||
msw | 0e91d93 | 2016-08-25 22:34:09 | [diff] [blame] | 113 | std::unique_ptr<WallpaperDelegate> |
114 | ShellDelegateImpl::CreateWallpaperDelegate() { | ||||
115 | return base::MakeUnique<DefaultWallpaperDelegate>(); | ||||
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 116 | } |
[email protected] | 4d7ce435 | 2012-07-13 06:56:06 | [diff] [blame] | 117 | |
msw | 0e91d93 | 2016-08-25 22:34:09 | [diff] [blame] | 118 | AccessibilityDelegate* ShellDelegateImpl::CreateAccessibilityDelegate() { |
[email protected] | 093b8d64 | 2014-04-03 20:59:28 | [diff] [blame] | 119 | return new DefaultAccessibilityDelegate; |
[email protected] | f3ab6eff5 | 2013-10-24 03:29:38 | [diff] [blame] | 120 | } |
121 | |||||
jdufault | 0f4fa6e | 2016-08-05 19:13:59 | [diff] [blame] | 122 | std::unique_ptr<PaletteDelegate> ShellDelegateImpl::CreatePaletteDelegate() { |
ricea | c9462d4 | 2016-08-22 02:40:28 | [diff] [blame] | 123 | return base::MakeUnique<PaletteDelegateImpl>(); |
jdufault | 0f4fa6e | 2016-08-05 19:13:59 | [diff] [blame] | 124 | } |
125 | |||||
James Cook | 840177e | 2017-05-25 02:20:01 | [diff] [blame] | 126 | ui::MenuModel* ShellDelegateImpl::CreateContextMenu(Shelf* shelf, |
jamescook | da53c14 | 2016-06-08 23:38:56 | [diff] [blame] | 127 | const ShelfItem* item) { |
James Cook | 840177e | 2017-05-25 02:20:01 | [diff] [blame] | 128 | return new ContextMenu(shelf); |
[email protected] | 431552c | 2012-10-23 00:38:33 | [diff] [blame] | 129 | } |
130 | |||||
[email protected] | 99edff3e | 2014-01-31 18:20:36 | [diff] [blame] | 131 | GPUSupport* ShellDelegateImpl::CreateGPUSupport() { |
132 | // Real GPU support depends on src/content, so just use a stub. | ||||
133 | return new GPUSupportStub; | ||||
134 | } | ||||
135 | |||||
[email protected] | ed95e02 | 2013-04-11 04:03:32 | [diff] [blame] | 136 | base::string16 ShellDelegateImpl::GetProductName() const { |
137 | return base::string16(); | ||||
[email protected] | 5673bf5 | 2013-02-01 06:14:24 | [diff] [blame] | 138 | } |
139 | |||||
afakhry | cd2bb98d | 2015-09-09 09:03:42 | [diff] [blame] | 140 | gfx::Image ShellDelegateImpl::GetDeprecatedAcceleratorImage() const { |
141 | return gfx::Image(); | ||||
142 | } | ||||
143 | |||||
afakhry | 15eb928 | 2017-04-27 04:03:31 | [diff] [blame] | 144 | PrefService* ShellDelegateImpl::GetActiveUserPrefService() const { |
145 | return nullptr; | ||||
146 | } | ||||
147 | |||||
warx | 4c8baedb | 2016-12-03 22:38:50 | [diff] [blame] | 148 | bool ShellDelegateImpl::IsTouchscreenEnabledInPrefs( |
149 | bool use_local_state) const { | ||||
150 | return true; | ||||
151 | } | ||||
152 | |||||
153 | void ShellDelegateImpl::SetTouchscreenEnabledInPrefs(bool enabled, | ||||
154 | bool use_local_state) {} | ||||
155 | |||||
156 | void ShellDelegateImpl::UpdateTouchscreenStatusFromPrefs() {} | ||||
157 | |||||
Scott Violet | 17a6172 | 2017-06-19 17:54:31 | [diff] [blame] | 158 | #if defined(USE_OZONE) |
159 | ui::InputDeviceControllerClient* | ||||
160 | ShellDelegateImpl::GetInputDeviceControllerClient() { | ||||
161 | return nullptr; | ||||
162 | } | ||||
163 | #endif | ||||
164 | |||||
[email protected] | 262f8bd | 2012-03-23 19:30:27 | [diff] [blame] | 165 | } // namespace shell |
166 | } // namespace ash |