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

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

Issue 2041233004: mash: Move //ash/session to //ash/common/session (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 6 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
« no previous file with comments | « ash/mus/bridge/wm_shell_mus.h ('k') | ash/root_window_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ash/common/session/session_state_delegate.h"
7 #include "ash/common/shell_window_ids.h" 8 #include "ash/common/shell_window_ids.h"
8 #include "ash/common/wm/window_resizer.h" 9 #include "ash/common/wm/window_resizer.h"
9 #include "ash/common/wm_activation_observer.h" 10 #include "ash/common/wm_activation_observer.h"
10 #include "ash/mus/bridge/wm_root_window_controller_mus.h" 11 #include "ash/mus/bridge/wm_root_window_controller_mus.h"
11 #include "ash/mus/bridge/wm_window_mus.h" 12 #include "ash/mus/bridge/wm_window_mus.h"
12 #include "ash/mus/container_ids.h" 13 #include "ash/mus/container_ids.h"
13 #include "ash/mus/drag_window_resizer.h" 14 #include "ash/mus/drag_window_resizer.h"
14 #include "ash/mus/root_window_controller.h" 15 #include "ash/mus/root_window_controller.h"
15 #include "base/memory/ptr_util.h" 16 #include "base/memory/ptr_util.h"
16 #include "components/mus/common/util.h" 17 #include "components/mus/common/util.h"
17 #include "components/mus/public/cpp/window.h" 18 #include "components/mus/public/cpp/window.h"
18 #include "components/mus/public/cpp/window_tree_client.h" 19 #include "components/mus/public/cpp/window_tree_client.h"
20 #include "components/user_manager/user_info_impl.h"
19 21
20 namespace ash { 22 namespace ash {
21 namespace mus { 23 namespace mus {
22 24
23 WmShellMus::WmShellMus(::mus::WindowTreeClient* client) : client_(client) { 25 namespace {
26
27 // TODO(jamescook): After ShellDelegate is ported to ash/common use
28 // ShellDelegate::CreateSessionStateDelegate() to construct the mus version
29 // of SessionStateDelegate.
30 class SessionStateDelegateStub : public SessionStateDelegate {
31 public:
32 SessionStateDelegateStub()
33 : screen_locked_(false), user_info_(new user_manager::UserInfoImpl()) {}
34
35 ~SessionStateDelegateStub() override {}
36
37 // SessionStateDelegate:
38 int GetMaximumNumberOfLoggedInUsers() const override { return 3; }
39 int NumberOfLoggedInUsers() const override {
40 // ash_shell has 2 users.
41 return 2;
42 }
43 bool IsActiveUserSessionStarted() const override { return true; }
44 bool CanLockScreen() const override { return true; }
45 bool IsScreenLocked() const override { return screen_locked_; }
46 bool ShouldLockScreenBeforeSuspending() const override { return false; }
47 void LockScreen() override {
48 screen_locked_ = true;
49 NOTIMPLEMENTED();
50 }
51 void UnlockScreen() override {
52 NOTIMPLEMENTED();
53 screen_locked_ = false;
54 }
55 bool IsUserSessionBlocked() const override { return false; }
56 SessionState GetSessionState() const override { return SESSION_STATE_ACTIVE; }
57 const user_manager::UserInfo* GetUserInfo(UserIndex index) const override {
58 return user_info_.get();
59 }
60 bool ShouldShowAvatar(WmWindow* window) const override {
61 NOTIMPLEMENTED();
62 return !user_info_->GetImage().isNull();
63 }
64 gfx::ImageSkia GetAvatarImageForWindow(WmWindow* window) const override {
65 NOTIMPLEMENTED();
66 return gfx::ImageSkia();
67 }
68 void SwitchActiveUser(const AccountId& account_id) override {}
69 void CycleActiveUser(CycleUser cycle_user) override {}
70 bool IsMultiProfileAllowedByPrimaryUserPolicy() const override {
71 return true;
72 }
73 void AddSessionStateObserver(ash::SessionStateObserver* observer) override {}
74 void RemoveSessionStateObserver(
75 ash::SessionStateObserver* observer) override {}
76
77 private:
78 bool screen_locked_;
79
80 // A pseudo user info.
81 std::unique_ptr<user_manager::UserInfo> user_info_;
82
83 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateStub);
84 };
85
86 } // namespace
87
88 WmShellMus::WmShellMus(::mus::WindowTreeClient* client)
89 : client_(client), session_state_delegate_(new SessionStateDelegateStub) {
24 client_->AddObserver(this); 90 client_->AddObserver(this);
25 WmShell::Set(this); 91 WmShell::Set(this);
26 } 92 }
27 93
28 WmShellMus::~WmShellMus() { 94 WmShellMus::~WmShellMus() {
29 RemoveClientObserver(); 95 RemoveClientObserver();
30 WmShell::Set(nullptr); 96 WmShell::Set(nullptr);
31 } 97 }
32 98
33 // static 99 // static
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 std::vector<WmWindow*> WmShellMus::GetMruWindowListIgnoreModals() { 168 std::vector<WmWindow*> WmShellMus::GetMruWindowListIgnoreModals() {
103 NOTIMPLEMENTED(); 169 NOTIMPLEMENTED();
104 return std::vector<WmWindow*>(); 170 return std::vector<WmWindow*>();
105 } 171 }
106 172
107 bool WmShellMus::IsForceMaximizeOnFirstRun() { 173 bool WmShellMus::IsForceMaximizeOnFirstRun() {
108 NOTIMPLEMENTED(); 174 NOTIMPLEMENTED();
109 return false; 175 return false;
110 } 176 }
111 177
112 bool WmShellMus::IsUserSessionBlocked() {
113 NOTIMPLEMENTED();
114 return false;
115 }
116
117 bool WmShellMus::IsScreenLocked() {
118 NOTIMPLEMENTED();
119 return false;
120 }
121
122 bool WmShellMus::CanShowWindowForUser(WmWindow* window) { 178 bool WmShellMus::CanShowWindowForUser(WmWindow* window) {
123 NOTIMPLEMENTED(); 179 NOTIMPLEMENTED();
124 return true; 180 return true;
125 } 181 }
126 182
127 void WmShellMus::LockCursor() { 183 void WmShellMus::LockCursor() {
128 NOTIMPLEMENTED(); 184 NOTIMPLEMENTED();
129 } 185 }
130 186
131 void WmShellMus::UnlockCursor() { 187 void WmShellMus::UnlockCursor() {
(...skipping 21 matching lines...) Expand all
153 bool WmShellMus::IsOverviewModeSelecting() { 209 bool WmShellMus::IsOverviewModeSelecting() {
154 NOTIMPLEMENTED(); 210 NOTIMPLEMENTED();
155 return false; 211 return false;
156 } 212 }
157 213
158 bool WmShellMus::IsOverviewModeRestoringMinimizedWindows() { 214 bool WmShellMus::IsOverviewModeRestoringMinimizedWindows() {
159 NOTIMPLEMENTED(); 215 NOTIMPLEMENTED();
160 return false; 216 return false;
161 } 217 }
162 218
219 SessionStateDelegate* WmShellMus::GetSessionStateDelegate() {
220 return session_state_delegate_.get();
221 }
222
163 void WmShellMus::AddActivationObserver(WmActivationObserver* observer) { 223 void WmShellMus::AddActivationObserver(WmActivationObserver* observer) {
164 activation_observers_.AddObserver(observer); 224 activation_observers_.AddObserver(observer);
165 } 225 }
166 226
167 void WmShellMus::RemoveActivationObserver(WmActivationObserver* observer) { 227 void WmShellMus::RemoveActivationObserver(WmActivationObserver* observer) {
168 activation_observers_.RemoveObserver(observer); 228 activation_observers_.RemoveObserver(observer);
169 } 229 }
170 230
171 void WmShellMus::AddDisplayObserver(WmDisplayObserver* observer) { 231 void WmShellMus::AddDisplayObserver(WmDisplayObserver* observer) {
172 NOTIMPLEMENTED(); 232 NOTIMPLEMENTED();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 OnWindowActivated(gained_active, lost_active)); 270 OnWindowActivated(gained_active, lost_active));
211 } 271 }
212 272
213 void WmShellMus::OnWillDestroyClient(::mus::WindowTreeClient* client) { 273 void WmShellMus::OnWillDestroyClient(::mus::WindowTreeClient* client) {
214 DCHECK_EQ(client, client_); 274 DCHECK_EQ(client, client_);
215 RemoveClientObserver(); 275 RemoveClientObserver();
216 } 276 }
217 277
218 } // namespace mus 278 } // namespace mus
219 } // namespace ash 279 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/bridge/wm_shell_mus.h ('k') | ash/root_window_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698