| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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_system_tray_delegate.h" | 5 #include "ash/test/test_system_tray_delegate.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "ash/common/login_status.h" | 9 #include "ash/common/login_status.h" |
| 10 #include "ash/common/session/session_state_delegate.h" | 10 #include "ash/common/session/session_state_delegate.h" |
| 11 #include "ash/common/wm_shell.h" |
| 11 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 12 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
| 13 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 14 | 15 |
| 15 namespace ash { | 16 namespace ash { |
| 16 namespace test { | 17 namespace test { |
| 17 | 18 |
| 18 namespace { | 19 namespace { |
| 19 | 20 |
| 20 bool g_system_update_required = false; | 21 bool g_system_update_required = false; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 57 |
| 57 LoginStatus TestSystemTrayDelegate::GetUserLoginStatus() const { | 58 LoginStatus TestSystemTrayDelegate::GetUserLoginStatus() const { |
| 58 // Initial login status has been changed for testing. | 59 // Initial login status has been changed for testing. |
| 59 if (g_initial_status != LoginStatus::USER && | 60 if (g_initial_status != LoginStatus::USER && |
| 60 g_initial_status == login_status_) { | 61 g_initial_status == login_status_) { |
| 61 return login_status_; | 62 return login_status_; |
| 62 } | 63 } |
| 63 | 64 |
| 64 // At new user image screen manager->IsUserLoggedIn() would return true | 65 // At new user image screen manager->IsUserLoggedIn() would return true |
| 65 // but there's no browser session available yet so use SessionStarted(). | 66 // but there's no browser session available yet so use SessionStarted(). |
| 66 SessionStateDelegate* delegate = | 67 SessionStateDelegate* delegate = WmShell::Get()->GetSessionStateDelegate(); |
| 67 Shell::GetInstance()->session_state_delegate(); | |
| 68 | 68 |
| 69 if (!delegate->IsActiveUserSessionStarted()) | 69 if (!delegate->IsActiveUserSessionStarted()) |
| 70 return LoginStatus::NOT_LOGGED_IN; | 70 return LoginStatus::NOT_LOGGED_IN; |
| 71 if (delegate->IsScreenLocked()) | 71 if (delegate->IsScreenLocked()) |
| 72 return LoginStatus::LOCKED; | 72 return LoginStatus::LOCKED; |
| 73 return login_status_; | 73 return login_status_; |
| 74 } | 74 } |
| 75 | 75 |
| 76 bool TestSystemTrayDelegate::IsUserSupervised() const { | 76 bool TestSystemTrayDelegate::IsUserSupervised() const { |
| 77 return login_status_ == LoginStatus::SUPERVISED; | 77 return login_status_ == LoginStatus::SUPERVISED; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 103 *session_length_limit = session_length_limit_; | 103 *session_length_limit = session_length_limit_; |
| 104 return session_length_limit_set_; | 104 return session_length_limit_set_; |
| 105 } | 105 } |
| 106 | 106 |
| 107 void TestSystemTrayDelegate::SignOut() { | 107 void TestSystemTrayDelegate::SignOut() { |
| 108 base::MessageLoop::current()->QuitWhenIdle(); | 108 base::MessageLoop::current()->QuitWhenIdle(); |
| 109 } | 109 } |
| 110 | 110 |
| 111 } // namespace test | 111 } // namespace test |
| 112 } // namespace ash | 112 } // namespace ash |
| OLD | NEW |