OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/test/test_session_state_delegate.h" | 5 #include "ash/test/test_session_state_delegate.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 void TestSessionStateDelegate::UnlockScreen() { | 85 void TestSessionStateDelegate::UnlockScreen() { |
86 screen_locked_ = false; | 86 screen_locked_ = false; |
87 } | 87 } |
88 | 88 |
89 bool TestSessionStateDelegate::IsUserSessionBlocked() const { | 89 bool TestSessionStateDelegate::IsUserSessionBlocked() const { |
90 return !IsActiveUserSessionStarted() || IsScreenLocked() || | 90 return !IsActiveUserSessionStarted() || IsScreenLocked() || |
91 user_adding_screen_running_; | 91 user_adding_screen_running_; |
92 } | 92 } |
93 | 93 |
| 94 SessionStateDelegate::SessionState TestSessionStateDelegate::GetSessionState() |
| 95 const { |
| 96 if (user_adding_screen_running_) |
| 97 return STATE_LOGIN_SECONDARY; |
| 98 |
| 99 if (IsScreenLocked()) |
| 100 return STATE_LOCK; |
| 101 |
| 102 // Assuming that if session is not active we're at login. |
| 103 return IsActiveUserSessionStarted() ? STATE_SESSION : STATE_LOGIN_PRIMARY; |
| 104 } |
| 105 |
94 void TestSessionStateDelegate::SetHasActiveUser(bool has_active_user) { | 106 void TestSessionStateDelegate::SetHasActiveUser(bool has_active_user) { |
95 has_active_user_ = has_active_user; | 107 has_active_user_ = has_active_user; |
96 if (!has_active_user) | 108 if (!has_active_user) |
97 active_user_session_started_ = false; | 109 active_user_session_started_ = false; |
98 else | 110 else |
99 Shell::GetInstance()->ShowShelf(); | 111 Shell::GetInstance()->ShowShelf(); |
100 } | 112 } |
101 | 113 |
102 void TestSessionStateDelegate::SetActiveUserSessionStarted( | 114 void TestSessionStateDelegate::SetActiveUserSessionStarted( |
103 bool active_user_session_started) { | 115 bool active_user_session_started) { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 void TestSessionStateDelegate::AddSessionStateObserver( | 183 void TestSessionStateDelegate::AddSessionStateObserver( |
172 SessionStateObserver* observer) { | 184 SessionStateObserver* observer) { |
173 } | 185 } |
174 | 186 |
175 void TestSessionStateDelegate::RemoveSessionStateObserver( | 187 void TestSessionStateDelegate::RemoveSessionStateObserver( |
176 SessionStateObserver* observer) { | 188 SessionStateObserver* observer) { |
177 } | 189 } |
178 | 190 |
179 } // namespace test | 191 } // namespace test |
180 } // namespace ash | 192 } // namespace ash |
OLD | NEW |