| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/sysui/shell_delegate_mus.h" | 5 #include "ash/sysui/shell_delegate_mus.h" |
| 6 | 6 |
| 7 #include "ash/common/default_accessibility_delegate.h" | 7 #include "ash/common/default_accessibility_delegate.h" |
| 8 #include "ash/common/media_delegate.h" | 8 #include "ash/common/media_delegate.h" |
| 9 #include "ash/common/session/session_state_delegate.h" | 9 #include "ash/common/session/session_state_delegate.h" |
| 10 #include "ash/common/system/tray/default_system_tray_delegate.h" | 10 #include "ash/common/system/tray/default_system_tray_delegate.h" |
| 11 #include "ash/gpu_support_stub.h" | 11 #include "ash/gpu_support_stub.h" |
| 12 #include "ash/sysui/app_list_presenter_mus.h" | 12 #include "ash/sysui/app_list_presenter_mus.h" |
| 13 #include "ash/sysui/context_menu_mus.h" | 13 #include "ash/sysui/context_menu_mus.h" |
| 14 #include "ash/sysui/pointer_watcher_delegate_mus.h" | 14 #include "ash/sysui/pointer_watcher_delegate_mus.h" |
| 15 #include "ash/sysui/shelf_delegate_mus.h" | 15 #include "ash/sysui/shelf_delegate_mus.h" |
| 16 #include "ash/sysui/user_wallpaper_delegate_mus.h" | 16 #include "ash/sysui/user_wallpaper_delegate_mus.h" |
| 17 #include "base/memory/ptr_util.h" | 17 #include "base/memory/ptr_util.h" |
| 18 #include "base/strings/string16.h" | 18 #include "base/strings/string16.h" |
| 19 #include "components/user_manager/user_info_impl.h" | 19 #include "components/user_manager/user_info_impl.h" |
| 20 #include "services/shell/public/cpp/connector.h" |
| 21 #include "services/ui/public/interfaces/accessibility_manager.mojom.h" |
| 20 #include "ui/app_list/presenter/app_list_presenter.h" | 22 #include "ui/app_list/presenter/app_list_presenter.h" |
| 21 #include "ui/gfx/image/image.h" | 23 #include "ui/gfx/image/image.h" |
| 24 #include "ui/views/mus/window_manager_connection.h" |
| 22 | 25 |
| 23 namespace ash { | 26 namespace ash { |
| 24 namespace sysui { | 27 namespace sysui { |
| 25 | 28 |
| 26 namespace { | 29 namespace { |
| 27 | 30 |
| 31 class AccessibilityDelegateMus : public DefaultAccessibilityDelegate { |
| 32 public: |
| 33 AccessibilityDelegateMus() {} |
| 34 ~AccessibilityDelegateMus() override {} |
| 35 |
| 36 private: |
| 37 ui::mojom::AccessibilityManager* a11y_manager() { |
| 38 if (!a11y_manager_ptr_.is_bound()) { |
| 39 views::WindowManagerConnection::Get()->connector()->ConnectToInterface( |
| 40 "mojo:ui", &a11y_manager_ptr_); |
| 41 } |
| 42 return a11y_manager_ptr_.get(); |
| 43 } |
| 44 |
| 45 // DefaultAccessibilityDelegate: |
| 46 void ToggleHighContrast() override { |
| 47 DefaultAccessibilityDelegate::ToggleHighContrast(); |
| 48 a11y_manager()->SetHighContrastMode(IsHighContrastEnabled()); |
| 49 } |
| 50 |
| 51 ui::mojom::AccessibilityManagerPtr a11y_manager_ptr_; |
| 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(AccessibilityDelegateMus); |
| 54 }; |
| 55 |
| 28 class SessionStateDelegateStub : public SessionStateDelegate { | 56 class SessionStateDelegateStub : public SessionStateDelegate { |
| 29 public: | 57 public: |
| 30 SessionStateDelegateStub() | 58 SessionStateDelegateStub() |
| 31 : screen_locked_(false), user_info_(new user_manager::UserInfoImpl()) {} | 59 : screen_locked_(false), user_info_(new user_manager::UserInfoImpl()) {} |
| 32 | 60 |
| 33 ~SessionStateDelegateStub() override {} | 61 ~SessionStateDelegateStub() override {} |
| 34 | 62 |
| 35 // SessionStateDelegate: | 63 // SessionStateDelegate: |
| 36 int GetMaximumNumberOfLoggedInUsers() const override { return 3; } | 64 int GetMaximumNumberOfLoggedInUsers() const override { return 3; } |
| 37 int NumberOfLoggedInUsers() const override { | 65 int NumberOfLoggedInUsers() const override { |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 UserWallpaperDelegate* ShellDelegateMus::CreateUserWallpaperDelegate() { | 216 UserWallpaperDelegate* ShellDelegateMus::CreateUserWallpaperDelegate() { |
| 189 return new UserWallpaperDelegateMus(); | 217 return new UserWallpaperDelegateMus(); |
| 190 } | 218 } |
| 191 | 219 |
| 192 SessionStateDelegate* ShellDelegateMus::CreateSessionStateDelegate() { | 220 SessionStateDelegate* ShellDelegateMus::CreateSessionStateDelegate() { |
| 193 NOTIMPLEMENTED() << " Using a stub SessionStateDeleagte implementation"; | 221 NOTIMPLEMENTED() << " Using a stub SessionStateDeleagte implementation"; |
| 194 return new SessionStateDelegateStub; | 222 return new SessionStateDelegateStub; |
| 195 } | 223 } |
| 196 | 224 |
| 197 AccessibilityDelegate* ShellDelegateMus::CreateAccessibilityDelegate() { | 225 AccessibilityDelegate* ShellDelegateMus::CreateAccessibilityDelegate() { |
| 198 NOTIMPLEMENTED() << " Using the default AccessibilityDelegate implementation"; | 226 return new AccessibilityDelegateMus; |
| 199 return new DefaultAccessibilityDelegate; | |
| 200 } | 227 } |
| 201 | 228 |
| 202 NewWindowDelegate* ShellDelegateMus::CreateNewWindowDelegate() { | 229 NewWindowDelegate* ShellDelegateMus::CreateNewWindowDelegate() { |
| 203 NOTIMPLEMENTED(); | 230 NOTIMPLEMENTED(); |
| 204 return nullptr; | 231 return nullptr; |
| 205 } | 232 } |
| 206 | 233 |
| 207 MediaDelegate* ShellDelegateMus::CreateMediaDelegate() { | 234 MediaDelegate* ShellDelegateMus::CreateMediaDelegate() { |
| 208 NOTIMPLEMENTED() << " Using a stub MediaDelegate implementation"; | 235 NOTIMPLEMENTED() << " Using a stub MediaDelegate implementation"; |
| 209 return new MediaDelegateStub; | 236 return new MediaDelegateStub; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 229 return base::string16(); | 256 return base::string16(); |
| 230 } | 257 } |
| 231 | 258 |
| 232 gfx::Image ShellDelegateMus::GetDeprecatedAcceleratorImage() const { | 259 gfx::Image ShellDelegateMus::GetDeprecatedAcceleratorImage() const { |
| 233 NOTIMPLEMENTED(); | 260 NOTIMPLEMENTED(); |
| 234 return gfx::Image(); | 261 return gfx::Image(); |
| 235 } | 262 } |
| 236 | 263 |
| 237 } // namespace sysui | 264 } // namespace sysui |
| 238 } // namespace ash | 265 } // namespace ash |
| OLD | NEW |