jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 1 | // 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 Cook | b0bf8e8 | 2017-04-09 17:01:44 | [diff] [blame] | 9 | #include "ash/gpu_support_stub.h" |
jamescook | 428f986f | 2016-07-15 19:13:25 | [diff] [blame] | 10 | #include "ash/mus/accessibility_delegate_mus.h" |
msw | 0e91d93 | 2016-08-25 22:34:09 | [diff] [blame] | 11 | #include "ash/mus/context_menu_mus.h" |
jamescook | 01bf23e7 | 2017-01-09 19:58:15 | [diff] [blame] | 12 | #include "ash/mus/system_tray_delegate_mus.h" |
msw | 7d03b206 | 2016-09-10 00:13:21 | [diff] [blame] | 13 | #include "ash/mus/wallpaper_delegate_mus.h" |
James Cook | b0bf8e8 | 2017-04-09 17:01:44 | [diff] [blame] | 14 | #include "ash/palette_delegate.h" |
| 15 | #include "ash/session/session_state_delegate.h" |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 16 | #include "base/memory/ptr_util.h" |
| 17 | #include "base/strings/string16.h" |
msw | ccb5d69 | 2016-08-17 20:37:48 | [diff] [blame] | 18 | #include "base/strings/string_util.h" |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 19 | #include "components/user_manager/user_info_impl.h" |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 20 | #include "ui/gfx/image/image.h" |
| 21 | |
| 22 | namespace ash { |
| 23 | namespace { |
| 24 | |
| 25 | class SessionStateDelegateStub : public SessionStateDelegate { |
| 26 | public: |
xiyuan | f1ff14d | 2017-03-20 20:28:14 | [diff] [blame] | 27 | SessionStateDelegateStub() : user_info_(new user_manager::UserInfoImpl()) {} |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 28 | |
| 29 | ~SessionStateDelegateStub() override {} |
| 30 | |
| 31 | // SessionStateDelegate: |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 32 | 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 | } |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 40 | |
| 41 | private: |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 42 | // A pseudo user info. |
| 43 | std::unique_ptr<user_manager::UserInfo> user_info_; |
| 44 | |
| 45 | DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateStub); |
| 46 | }; |
| 47 | |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 48 | } // namespace |
| 49 | |
msw | 0bc6a07 | 2017-02-14 16:33:38 | [diff] [blame] | 50 | ShellDelegateMus::ShellDelegateMus(service_manager::Connector* connector) |
| 51 | : connector_(connector) {} |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 52 | |
| 53 | ShellDelegateMus::~ShellDelegateMus() {} |
| 54 | |
rockot | 400ea35b | 2016-10-15 19:15:32 | [diff] [blame] | 55 | service_manager::Connector* ShellDelegateMus::GetShellConnector() const { |
jamescook | 2a6b869 | 2016-10-04 02:41:29 | [diff] [blame] | 56 | return connector_; |
| 57 | } |
| 58 | |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 59 | bool ShellDelegateMus::IsIncognitoAllowed() const { |
| 60 | NOTIMPLEMENTED(); |
| 61 | return false; |
| 62 | } |
| 63 | |
| 64 | bool ShellDelegateMus::IsMultiProfilesEnabled() const { |
| 65 | NOTIMPLEMENTED(); |
| 66 | return false; |
| 67 | } |
| 68 | |
| 69 | bool ShellDelegateMus::IsRunningInForcedAppMode() const { |
| 70 | NOTIMPLEMENTED(); |
| 71 | return false; |
| 72 | } |
| 73 | |
| 74 | bool ShellDelegateMus::CanShowWindowForUser(WmWindow* window) const { |
| 75 | NOTIMPLEMENTED(); |
| 76 | return true; |
| 77 | } |
| 78 | |
| 79 | bool ShellDelegateMus::IsForceMaximizeOnFirstRun() const { |
| 80 | NOTIMPLEMENTED(); |
| 81 | return false; |
| 82 | } |
| 83 | |
| 84 | void ShellDelegateMus::PreInit() { |
| 85 | NOTIMPLEMENTED(); |
| 86 | } |
| 87 | |
| 88 | void ShellDelegateMus::PreShutdown() { |
| 89 | NOTIMPLEMENTED(); |
| 90 | } |
| 91 | |
| 92 | void ShellDelegateMus::Exit() { |
| 93 | NOTIMPLEMENTED(); |
| 94 | } |
| 95 | |
| 96 | keyboard::KeyboardUI* ShellDelegateMus::CreateKeyboardUI() { |
| 97 | NOTIMPLEMENTED(); |
| 98 | return nullptr; |
| 99 | } |
| 100 | |
kenobi | b7af62b | 2016-07-29 21:40:16 | [diff] [blame] | 101 | void ShellDelegateMus::OpenUrlFromArc(const GURL& url) { |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 102 | NOTIMPLEMENTED(); |
| 103 | } |
| 104 | |
msw | 5138f3d | 2017-04-20 00:22:07 | [diff] [blame] | 105 | void ShellDelegateMus::ShelfInit() { |
| 106 | NOTIMPLEMENTED(); |
| 107 | } |
| 108 | |
| 109 | void ShellDelegateMus::ShelfShutdown() { |
| 110 | NOTIMPLEMENTED(); |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 111 | } |
| 112 | |
| 113 | SystemTrayDelegate* ShellDelegateMus::CreateSystemTrayDelegate() { |
jamescook | 2a6b869 | 2016-10-04 02:41:29 | [diff] [blame] | 114 | return new SystemTrayDelegateMus(); |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 115 | } |
| 116 | |
msw | 0e91d93 | 2016-08-25 22:34:09 | [diff] [blame] | 117 | std::unique_ptr<WallpaperDelegate> ShellDelegateMus::CreateWallpaperDelegate() { |
msw | c691bf1 | 2016-10-19 17:05:39 | [diff] [blame] | 118 | return base::MakeUnique<WallpaperDelegateMus>(); |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 119 | } |
| 120 | |
| 121 | SessionStateDelegate* ShellDelegateMus::CreateSessionStateDelegate() { |
sky | 1eb7caa | 2016-09-16 00:02:46 | [diff] [blame] | 122 | // TODO: http://crbug.com/647416. |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 123 | NOTIMPLEMENTED() << " Using a stub SessionStateDeleagte implementation"; |
| 124 | return new SessionStateDelegateStub; |
| 125 | } |
| 126 | |
| 127 | AccessibilityDelegate* ShellDelegateMus::CreateAccessibilityDelegate() { |
jamescook | 428f986f | 2016-07-15 19:13:25 | [diff] [blame] | 128 | return new AccessibilityDelegateMus(connector_); |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 129 | } |
| 130 | |
jdufault | 0f4fa6e | 2016-08-05 19:13:59 | [diff] [blame] | 131 | std::unique_ptr<PaletteDelegate> ShellDelegateMus::CreatePaletteDelegate() { |
sky | 1eb7caa | 2016-09-16 00:02:46 | [diff] [blame] | 132 | // TODO: http://crbug.com/647417. |
jdufault | 0f4fa6e | 2016-08-05 19:13:59 | [diff] [blame] | 133 | NOTIMPLEMENTED(); |
| 134 | return nullptr; |
| 135 | } |
| 136 | |
James Cook | 840177e | 2017-05-25 02:20:01 | [diff] [blame^] | 137 | ui::MenuModel* ShellDelegateMus::CreateContextMenu(Shelf* shelf, |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 138 | const ShelfItem* item) { |
James Cook | 840177e | 2017-05-25 02:20:01 | [diff] [blame^] | 139 | return new ContextMenuMus(shelf); |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 140 | } |
| 141 | |
| 142 | GPUSupport* ShellDelegateMus::CreateGPUSupport() { |
sky | 1eb7caa | 2016-09-16 00:02:46 | [diff] [blame] | 143 | // TODO: http://crbug.com/647421. |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 144 | NOTIMPLEMENTED() << " Using a stub GPUSupport implementation"; |
| 145 | return new GPUSupportStub(); |
| 146 | } |
| 147 | |
| 148 | base::string16 ShellDelegateMus::GetProductName() const { |
| 149 | NOTIMPLEMENTED(); |
| 150 | return base::string16(); |
| 151 | } |
| 152 | |
| 153 | gfx::Image ShellDelegateMus::GetDeprecatedAcceleratorImage() const { |
| 154 | NOTIMPLEMENTED(); |
| 155 | return gfx::Image(); |
| 156 | } |
| 157 | |
afakhry | 15eb928 | 2017-04-27 04:03:31 | [diff] [blame] | 158 | PrefService* 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 | |
warx | 4c8baedb | 2016-12-03 22:38:50 | [diff] [blame] | 166 | bool ShellDelegateMus::IsTouchscreenEnabledInPrefs(bool use_local_state) const { |
| 167 | NOTIMPLEMENTED(); |
| 168 | return true; |
| 169 | } |
| 170 | |
| 171 | void ShellDelegateMus::SetTouchscreenEnabledInPrefs(bool enabled, |
| 172 | bool use_local_state) { |
| 173 | NOTIMPLEMENTED(); |
| 174 | } |
| 175 | |
| 176 | void ShellDelegateMus::UpdateTouchscreenStatusFromPrefs() { |
| 177 | NOTIMPLEMENTED(); |
| 178 | } |
| 179 | |
jamescook | 3337573 | 2016-07-14 22:09:28 | [diff] [blame] | 180 | } // namespace ash |