| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/common/accelerators/accelerator_controller.h" | 9 #include "ash/common/accelerators/accelerator_controller.h" |
| 10 #include "ash/common/key_event_watcher.h" | 10 #include "ash/common/key_event_watcher.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 namespace ash { | 47 namespace ash { |
| 48 namespace mus { | 48 namespace mus { |
| 49 | 49 |
| 50 namespace { | 50 namespace { |
| 51 | 51 |
| 52 // TODO(jamescook): After ShellDelegate is ported to ash/common use | 52 // TODO(jamescook): After ShellDelegate is ported to ash/common use |
| 53 // ShellDelegate::CreateSessionStateDelegate() to construct the mus version | 53 // ShellDelegate::CreateSessionStateDelegate() to construct the mus version |
| 54 // of SessionStateDelegate. | 54 // of SessionStateDelegate. |
| 55 class SessionStateDelegateStub : public SessionStateDelegate { | 55 class SessionStateDelegateStub : public SessionStateDelegate { |
| 56 public: | 56 public: |
| 57 SessionStateDelegateStub() | 57 SessionStateDelegateStub() : user_info_(new user_manager::UserInfoImpl()) {} |
| 58 : screen_locked_(false), user_info_(new user_manager::UserInfoImpl()) {} | |
| 59 | 58 |
| 60 ~SessionStateDelegateStub() override {} | 59 ~SessionStateDelegateStub() override {} |
| 61 | 60 |
| 62 // SessionStateDelegate: | 61 // SessionStateDelegate: |
| 63 int GetMaximumNumberOfLoggedInUsers() const override { return 3; } | |
| 64 int NumberOfLoggedInUsers() const override { return 1; } | |
| 65 bool IsActiveUserSessionStarted() const override { return true; } | |
| 66 bool CanLockScreen() const override { | |
| 67 // The Chrome OS session_manager process currently rejects screen-lock | |
| 68 // requests due to no user being logged in. | |
| 69 return false; | |
| 70 } | |
| 71 bool IsScreenLocked() const override { return screen_locked_; } | |
| 72 bool ShouldLockScreenAutomatically() const override { return false; } | |
| 73 void LockScreen() override { | |
| 74 screen_locked_ = true; | |
| 75 NOTIMPLEMENTED(); | |
| 76 } | |
| 77 void UnlockScreen() override { | |
| 78 NOTIMPLEMENTED(); | |
| 79 screen_locked_ = false; | |
| 80 } | |
| 81 bool IsUserSessionBlocked() const override { return false; } | |
| 82 session_manager::SessionState GetSessionState() const override { | |
| 83 return session_manager::SessionState::ACTIVE; | |
| 84 } | |
| 85 const user_manager::UserInfo* GetUserInfo(UserIndex index) const override { | |
| 86 return user_info_.get(); | |
| 87 } | |
| 88 bool ShouldShowAvatar(WmWindow* window) const override { | 62 bool ShouldShowAvatar(WmWindow* window) const override { |
| 89 NOTIMPLEMENTED(); | 63 NOTIMPLEMENTED(); |
| 90 return !user_info_->GetImage().isNull(); | 64 return !user_info_->GetImage().isNull(); |
| 91 } | 65 } |
| 92 gfx::ImageSkia GetAvatarImageForWindow(WmWindow* window) const override { | 66 gfx::ImageSkia GetAvatarImageForWindow(WmWindow* window) const override { |
| 93 NOTIMPLEMENTED(); | 67 NOTIMPLEMENTED(); |
| 94 return gfx::ImageSkia(); | 68 return gfx::ImageSkia(); |
| 95 } | 69 } |
| 96 void SwitchActiveUser(const AccountId& account_id) override {} | |
| 97 void CycleActiveUser(CycleUserDirection direction) override {} | |
| 98 bool IsMultiProfileAllowedByPrimaryUserPolicy() const override { | |
| 99 return true; | |
| 100 } | |
| 101 void AddSessionStateObserver(ash::SessionStateObserver* observer) override {} | |
| 102 void RemoveSessionStateObserver( | |
| 103 ash::SessionStateObserver* observer) override {} | |
| 104 | 70 |
| 105 private: | 71 private: |
| 106 bool screen_locked_; | |
| 107 | |
| 108 // A pseudo user info. | 72 // A pseudo user info. |
| 109 std::unique_ptr<user_manager::UserInfo> user_info_; | 73 std::unique_ptr<user_manager::UserInfo> user_info_; |
| 110 | 74 |
| 111 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateStub); | 75 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateStub); |
| 112 }; | 76 }; |
| 113 | 77 |
| 114 } // namespace | 78 } // namespace |
| 115 | 79 |
| 116 WmShellMus::WmShellMus( | 80 WmShellMus::WmShellMus( |
| 117 WmWindow* primary_root_window, | 81 WmWindow* primary_root_window, |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 accelerator_controller_registrar_ = | 363 accelerator_controller_registrar_ = |
| 400 base ::MakeUnique<AcceleratorControllerRegistrar>( | 364 base ::MakeUnique<AcceleratorControllerRegistrar>( |
| 401 window_manager_, accelerator_namespace_id); | 365 window_manager_, accelerator_namespace_id); |
| 402 return base::MakeUnique<AcceleratorController>( | 366 return base::MakeUnique<AcceleratorController>( |
| 403 accelerator_controller_delegate_.get(), | 367 accelerator_controller_delegate_.get(), |
| 404 accelerator_controller_registrar_.get()); | 368 accelerator_controller_registrar_.get()); |
| 405 } | 369 } |
| 406 | 370 |
| 407 } // namespace mus | 371 } // namespace mus |
| 408 } // namespace ash | 372 } // namespace ash |
| OLD | NEW |