Chromium Code Reviews| 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/mus/bridge/wm_shell_mus.h" | 5 #include "ash/mus/bridge/wm_shell_mus.h" |
| 6 | 6 |
| 7 #include "ash/common/default_accessibility_delegate.h" | 7 #include "ash/common/default_accessibility_delegate.h" |
| 8 #include "ash/common/display/display_info.h" | 8 #include "ash/common/display/display_info.h" |
| 9 #include "ash/common/session/session_state_delegate.h" | 9 #include "ash/common/session/session_state_delegate.h" |
| 10 #include "ash/common/shell_observer.h" | 10 #include "ash/common/shell_observer.h" |
| 11 #include "ash/common/shell_window_ids.h" | 11 #include "ash/common/shell_window_ids.h" |
| 12 #include "ash/common/system/tray/default_system_tray_delegate.h" | 12 #include "ash/common/system/tray/default_system_tray_delegate.h" |
| 13 #include "ash/common/wm/maximize_mode/maximize_mode_event_handler.h" | 13 #include "ash/common/wm/maximize_mode/maximize_mode_event_handler.h" |
| 14 #include "ash/common/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard .h" | 14 #include "ash/common/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard .h" |
| 15 #include "ash/common/wm/mru_window_tracker.h" | 15 #include "ash/common/wm/mru_window_tracker.h" |
| 16 #include "ash/common/wm/window_resizer.h" | 16 #include "ash/common/wm/window_resizer.h" |
| 17 #include "ash/common/wm_activation_observer.h" | 17 #include "ash/common/wm_activation_observer.h" |
| 18 #include "ash/mus/bridge/wm_root_window_controller_mus.h" | 18 #include "ash/mus/bridge/wm_root_window_controller_mus.h" |
| 19 #include "ash/mus/bridge/wm_window_mus.h" | 19 #include "ash/mus/bridge/wm_window_mus.h" |
| 20 #include "ash/mus/container_ids.h" | 20 #include "ash/mus/container_ids.h" |
| 21 #include "ash/mus/drag_window_resizer.h" | 21 #include "ash/mus/drag_window_resizer.h" |
| 22 #include "ash/mus/root_window_controller.h" | 22 #include "ash/mus/root_window_controller.h" |
| 23 #include "base/memory/ptr_util.h" | 23 #include "base/memory/ptr_util.h" |
| 24 #include "components/user_manager/user_info_impl.h" | 24 #include "components/user_manager/user_info_impl.h" |
| 25 #include "services/shell/public/cpp/connector.h" | |
| 25 #include "services/ui/common/util.h" | 26 #include "services/ui/common/util.h" |
| 26 #include "services/ui/public/cpp/window.h" | 27 #include "services/ui/public/cpp/window.h" |
| 27 #include "services/ui/public/cpp/window_tree_client.h" | 28 #include "services/ui/public/cpp/window_tree_client.h" |
| 29 #include "services/ui/public/interfaces/accessibility_manager.mojom.h" | |
| 28 | 30 |
| 29 namespace ash { | 31 namespace ash { |
| 30 namespace mus { | 32 namespace mus { |
| 31 | 33 |
| 32 namespace { | 34 namespace { |
| 33 | 35 |
| 34 // TODO(jamescook): After ShellDelegate is ported to ash/common use | 36 // TODO(jamescook): After ShellDelegate is ported to ash/common use |
| 35 // ShellDelegate::CreateSessionStateDelegate() to construct the mus version | 37 // ShellDelegate::CreateSessionStateDelegate() to construct the mus version |
| 36 // of SessionStateDelegate. | 38 // of SessionStateDelegate. |
| 37 class SessionStateDelegateStub : public SessionStateDelegate { | 39 class SessionStateDelegateStub : public SessionStateDelegate { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 83 | 85 |
| 84 private: | 86 private: |
| 85 bool screen_locked_; | 87 bool screen_locked_; |
| 86 | 88 |
| 87 // A pseudo user info. | 89 // A pseudo user info. |
| 88 std::unique_ptr<user_manager::UserInfo> user_info_; | 90 std::unique_ptr<user_manager::UserInfo> user_info_; |
| 89 | 91 |
| 90 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateStub); | 92 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateStub); |
| 91 }; | 93 }; |
| 92 | 94 |
| 95 class AccessibilityDelegateMus : public DefaultAccessibilityDelegate { | |
| 96 public: | |
| 97 explicit AccessibilityDelegateMus(shell::Connector* connector) | |
| 98 : connector_(connector) {} | |
| 99 ~AccessibilityDelegateMus() override {} | |
| 100 | |
| 101 private: | |
| 102 ui::mojom::AccessibilityManager* accessibility_manager() { | |
|
msw
2016/07/12 18:30:09
nit: GetAccessibilityManager? Or ConnectToInterfac
sadrul
2016/07/13 01:01:22
Done (changed to GetAccessibilityManager())
| |
| 103 if (!accessibility_manager_ptr_.is_bound()) | |
| 104 connector_->ConnectToInterface("mojo:ui", &accessibility_manager_ptr_); | |
| 105 return accessibility_manager_ptr_.get(); | |
| 106 } | |
| 107 | |
| 108 // DefaultAccessibilityDelegate: | |
| 109 void ToggleHighContrast() override { | |
| 110 DefaultAccessibilityDelegate::ToggleHighContrast(); | |
| 111 accessibility_manager()->SetHighContrastMode(IsHighContrastEnabled()); | |
| 112 } | |
| 113 | |
| 114 ui::mojom::AccessibilityManagerPtr accessibility_manager_ptr_; | |
| 115 shell::Connector* connector_; | |
| 116 | |
| 117 DISALLOW_COPY_AND_ASSIGN(AccessibilityDelegateMus); | |
| 118 }; | |
| 119 | |
| 93 } // namespace | 120 } // namespace |
| 94 | 121 |
| 95 WmShellMus::WmShellMus(ShellDelegate* delegate, ::ui::WindowTreeClient* client) | 122 WmShellMus::WmShellMus(ShellDelegate* delegate, |
| 123 ::ui::WindowTreeClient* client, | |
| 124 shell::Connector* connector) | |
| 96 : WmShell(delegate), | 125 : WmShell(delegate), |
| 97 client_(client), | 126 client_(client), |
| 127 connector_(connector), | |
| 98 session_state_delegate_(new SessionStateDelegateStub) { | 128 session_state_delegate_(new SessionStateDelegateStub) { |
| 99 client_->AddObserver(this); | 129 client_->AddObserver(this); |
| 100 WmShell::Set(this); | 130 WmShell::Set(this); |
| 101 | 131 |
| 102 CreateMaximizeModeController(); | 132 CreateMaximizeModeController(); |
| 103 | 133 |
| 104 CreateMruWindowTracker(); | 134 CreateMruWindowTracker(); |
| 105 | 135 |
| 106 accessibility_delegate_.reset(new DefaultAccessibilityDelegate); | 136 accessibility_delegate_.reset(new AccessibilityDelegateMus(connector_)); |
| 107 SetSystemTrayDelegate(base::WrapUnique(new DefaultSystemTrayDelegate)); | 137 SetSystemTrayDelegate(base::WrapUnique(new DefaultSystemTrayDelegate)); |
| 108 } | 138 } |
| 109 | 139 |
| 110 WmShellMus::~WmShellMus() { | 140 WmShellMus::~WmShellMus() { |
| 111 // This order mirrors that of Shell. | 141 // This order mirrors that of Shell. |
| 112 | 142 |
| 113 // Destroy maximize mode controller early on since it has some observers which | 143 // Destroy maximize mode controller early on since it has some observers which |
| 114 // need to be removed. | 144 // need to be removed. |
| 115 DeleteMaximizeModeController(); | 145 DeleteMaximizeModeController(); |
| 116 DeleteSystemTrayDelegate(); | 146 DeleteSystemTrayDelegate(); |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 330 OnWindowActivated(gained_active, lost_active)); | 360 OnWindowActivated(gained_active, lost_active)); |
| 331 } | 361 } |
| 332 | 362 |
| 333 void WmShellMus::OnDidDestroyClient(::ui::WindowTreeClient* client) { | 363 void WmShellMus::OnDidDestroyClient(::ui::WindowTreeClient* client) { |
| 334 DCHECK_EQ(client, client_); | 364 DCHECK_EQ(client, client_); |
| 335 RemoveClientObserver(); | 365 RemoveClientObserver(); |
| 336 } | 366 } |
| 337 | 367 |
| 338 } // namespace mus | 368 } // namespace mus |
| 339 } // namespace ash | 369 } // namespace ash |
| OLD | NEW |