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 "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/system/user/login_status.h" | 8 #include "ash/system/user/login_status.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 | 11 |
12 namespace ash { | 12 namespace ash { |
13 namespace test { | 13 namespace test { |
14 | 14 |
15 TestSessionStateDelegate::TestSessionStateDelegate() | 15 TestSessionStateDelegate::TestSessionStateDelegate() |
16 : has_active_user_(false), | 16 : has_active_user_(false), |
17 active_user_session_started_(false), | 17 active_user_session_started_(false), |
18 can_lock_screen_(true), | 18 can_lock_screen_(true), |
19 screen_locked_(false), | 19 screen_locked_(false), |
| 20 user_adding_screen_running_(false), |
20 logged_in_users_(1) { | 21 logged_in_users_(1) { |
21 } | 22 } |
22 | 23 |
23 TestSessionStateDelegate::~TestSessionStateDelegate() { | 24 TestSessionStateDelegate::~TestSessionStateDelegate() { |
24 } | 25 } |
25 | 26 |
26 int TestSessionStateDelegate::GetMaximumNumberOfLoggedInUsers() const { | 27 int TestSessionStateDelegate::GetMaximumNumberOfLoggedInUsers() const { |
27 return 3; | 28 return 3; |
28 } | 29 } |
29 | 30 |
(...skipping 16 matching lines...) Expand all Loading... |
46 | 47 |
47 void TestSessionStateDelegate::LockScreen() { | 48 void TestSessionStateDelegate::LockScreen() { |
48 if (CanLockScreen()) | 49 if (CanLockScreen()) |
49 screen_locked_ = true; | 50 screen_locked_ = true; |
50 } | 51 } |
51 | 52 |
52 void TestSessionStateDelegate::UnlockScreen() { | 53 void TestSessionStateDelegate::UnlockScreen() { |
53 screen_locked_ = false; | 54 screen_locked_ = false; |
54 } | 55 } |
55 | 56 |
| 57 bool TestSessionStateDelegate::IsUserSessionBlocked() const { |
| 58 return !IsActiveUserSessionStarted() || IsScreenLocked() || |
| 59 user_adding_screen_running_; |
| 60 } |
| 61 |
56 void TestSessionStateDelegate::SetHasActiveUser(bool has_active_user) { | 62 void TestSessionStateDelegate::SetHasActiveUser(bool has_active_user) { |
57 has_active_user_ = has_active_user; | 63 has_active_user_ = has_active_user; |
58 if (!has_active_user) | 64 if (!has_active_user) |
59 active_user_session_started_ = false; | 65 active_user_session_started_ = false; |
60 else | 66 else |
61 Shell::GetInstance()->ShowLauncher(); | 67 Shell::GetInstance()->ShowLauncher(); |
62 } | 68 } |
63 | 69 |
64 void TestSessionStateDelegate::SetActiveUserSessionStarted( | 70 void TestSessionStateDelegate::SetActiveUserSessionStarted( |
65 bool active_user_session_started) { | 71 bool active_user_session_started) { |
66 active_user_session_started_ = active_user_session_started; | 72 active_user_session_started_ = active_user_session_started; |
67 if (active_user_session_started) { | 73 if (active_user_session_started) { |
68 has_active_user_ = true; | 74 has_active_user_ = true; |
69 Shell::GetInstance()->CreateLauncher(); | 75 Shell::GetInstance()->CreateLauncher(); |
70 Shell::GetInstance()->UpdateAfterLoginStatusChange( | 76 Shell::GetInstance()->UpdateAfterLoginStatusChange( |
71 user::LOGGED_IN_USER); | 77 user::LOGGED_IN_USER); |
72 } | 78 } |
73 } | 79 } |
74 | 80 |
75 void TestSessionStateDelegate::SetCanLockScreen(bool can_lock_screen) { | 81 void TestSessionStateDelegate::SetCanLockScreen(bool can_lock_screen) { |
76 can_lock_screen_ = can_lock_screen; | 82 can_lock_screen_ = can_lock_screen; |
77 } | 83 } |
78 | 84 |
| 85 void TestSessionStateDelegate::SetUserAddingScreenRunning( |
| 86 bool user_adding_screen_running) { |
| 87 user_adding_screen_running_ = user_adding_screen_running; |
| 88 } |
| 89 |
79 const base::string16 TestSessionStateDelegate::GetUserDisplayName( | 90 const base::string16 TestSessionStateDelegate::GetUserDisplayName( |
80 MultiProfileIndex index) const { | 91 MultiProfileIndex index) const { |
81 return UTF8ToUTF16("Über tray Über tray Über tray Über tray"); | 92 return UTF8ToUTF16("Über tray Über tray Über tray Über tray"); |
82 } | 93 } |
83 | 94 |
84 const std::string TestSessionStateDelegate::GetUserEmail( | 95 const std::string TestSessionStateDelegate::GetUserEmail( |
85 MultiProfileIndex index) const { | 96 MultiProfileIndex index) const { |
86 switch (index) { | 97 switch (index) { |
87 case 0: return "first@tray"; | 98 case 0: return "first@tray"; |
88 case 1: return "second@tray"; | 99 case 1: return "second@tray"; |
(...skipping 17 matching lines...) Expand all Loading... |
106 void TestSessionStateDelegate::AddSessionStateObserver( | 117 void TestSessionStateDelegate::AddSessionStateObserver( |
107 SessionStateObserver* observer) { | 118 SessionStateObserver* observer) { |
108 } | 119 } |
109 | 120 |
110 void TestSessionStateDelegate::RemoveSessionStateObserver( | 121 void TestSessionStateDelegate::RemoveSessionStateObserver( |
111 SessionStateObserver* observer) { | 122 SessionStateObserver* observer) { |
112 } | 123 } |
113 | 124 |
114 } // namespace test | 125 } // namespace test |
115 } // namespace ash | 126 } // namespace ash |
OLD | NEW |