Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: ash/mus/bridge/wm_shell_mus.cc

Issue 2734933004: ash: Use SessionController instead of SessionStateDelegate (Closed)
Patch Set: rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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;
James Cook 2017/03/17 17:14:36 Hooray, mash will be happier with this change!
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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 } 354 }
391 355
392 void WmShellMus::CreatePrimaryHost() {} 356 void WmShellMus::CreatePrimaryHost() {}
393 357
394 void WmShellMus::InitHosts(const ShellInitParams& init_params) { 358 void WmShellMus::InitHosts(const ShellInitParams& init_params) {
395 window_manager_->CreatePrimaryRootWindowController( 359 window_manager_->CreatePrimaryRootWindowController(
396 base::WrapUnique(init_params.primary_window_tree_host)); 360 base::WrapUnique(init_params.primary_window_tree_host));
397 } 361 }
398 } // namespace mus 362 } // namespace mus
399 } // namespace ash 363 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698