Index: ash/mus/bridge/wm_shell_mus.cc |
diff --git a/ash/mus/bridge/wm_shell_mus.cc b/ash/mus/bridge/wm_shell_mus.cc |
index dc0c299e59838c4160d6d0a95107fa0345818203..effc0ec58b469c140938b8fbf46d539c35b902a7 100644 |
--- a/ash/mus/bridge/wm_shell_mus.cc |
+++ b/ash/mus/bridge/wm_shell_mus.cc |
@@ -4,6 +4,7 @@ |
#include "ash/mus/bridge/wm_shell_mus.h" |
+#include "ash/common/session/session_state_delegate.h" |
#include "ash/common/shell_window_ids.h" |
#include "ash/common/wm/window_resizer.h" |
#include "ash/common/wm_activation_observer.h" |
@@ -16,11 +17,76 @@ |
#include "components/mus/common/util.h" |
#include "components/mus/public/cpp/window.h" |
#include "components/mus/public/cpp/window_tree_client.h" |
+#include "components/user_manager/user_info_impl.h" |
namespace ash { |
namespace mus { |
-WmShellMus::WmShellMus(::mus::WindowTreeClient* client) : client_(client) { |
+namespace { |
+ |
+// TODO(jamescook): After ShellDelegate is ported to ash/common use |
+// ShellDelegate::CreateSessionStateDelegate() to construct the mus version |
+// of SessionStateDelegate. |
+class SessionStateDelegateStub : public SessionStateDelegate { |
+ public: |
+ SessionStateDelegateStub() |
+ : screen_locked_(false), user_info_(new user_manager::UserInfoImpl()) {} |
+ |
+ ~SessionStateDelegateStub() override {} |
+ |
+ // SessionStateDelegate: |
+ int GetMaximumNumberOfLoggedInUsers() const override { return 3; } |
+ int NumberOfLoggedInUsers() const override { |
+ // ash_shell has 2 users. |
+ return 2; |
+ } |
+ bool IsActiveUserSessionStarted() const override { return true; } |
+ bool CanLockScreen() const override { return true; } |
+ bool IsScreenLocked() const override { return screen_locked_; } |
+ bool ShouldLockScreenBeforeSuspending() const override { return false; } |
+ void LockScreen() override { |
+ screen_locked_ = true; |
+ NOTIMPLEMENTED(); |
+ } |
+ void UnlockScreen() override { |
+ NOTIMPLEMENTED(); |
+ screen_locked_ = false; |
+ } |
+ bool IsUserSessionBlocked() const override { return false; } |
+ SessionState GetSessionState() const override { return SESSION_STATE_ACTIVE; } |
+ const user_manager::UserInfo* GetUserInfo(UserIndex index) const override { |
+ return user_info_.get(); |
+ } |
+ bool ShouldShowAvatar(WmWindow* window) const override { |
+ NOTIMPLEMENTED(); |
+ return !user_info_->GetImage().isNull(); |
+ } |
+ gfx::ImageSkia GetAvatarImageForWindow(WmWindow* window) const override { |
+ NOTIMPLEMENTED(); |
+ return gfx::ImageSkia(); |
+ } |
+ void SwitchActiveUser(const AccountId& account_id) override {} |
+ void CycleActiveUser(CycleUser cycle_user) override {} |
+ bool IsMultiProfileAllowedByPrimaryUserPolicy() const override { |
+ return true; |
+ } |
+ void AddSessionStateObserver(ash::SessionStateObserver* observer) override {} |
+ void RemoveSessionStateObserver( |
+ ash::SessionStateObserver* observer) override {} |
+ |
+ private: |
+ bool screen_locked_; |
+ |
+ // A pseudo user info. |
+ std::unique_ptr<user_manager::UserInfo> user_info_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateStub); |
+}; |
+ |
+} // namespace |
+ |
+WmShellMus::WmShellMus(::mus::WindowTreeClient* client) |
+ : client_(client), session_state_delegate_(new SessionStateDelegateStub) { |
client_->AddObserver(this); |
WmShell::Set(this); |
} |
@@ -109,16 +175,6 @@ bool WmShellMus::IsForceMaximizeOnFirstRun() { |
return false; |
} |
-bool WmShellMus::IsUserSessionBlocked() { |
- NOTIMPLEMENTED(); |
- return false; |
-} |
- |
-bool WmShellMus::IsScreenLocked() { |
- NOTIMPLEMENTED(); |
- return false; |
-} |
- |
bool WmShellMus::CanShowWindowForUser(WmWindow* window) { |
NOTIMPLEMENTED(); |
return true; |
@@ -160,6 +216,10 @@ bool WmShellMus::IsOverviewModeRestoringMinimizedWindows() { |
return false; |
} |
+SessionStateDelegate* WmShellMus::GetSessionStateDelegate() { |
+ return session_state_delegate_.get(); |
+} |
+ |
void WmShellMus::AddActivationObserver(WmActivationObserver* observer) { |
activation_observers_.AddObserver(observer); |
} |