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

Side by Side Diff: ash/common/test/test_system_tray_delegate.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 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/common/test/test_system_tray_delegate.h" 5 #include "ash/common/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_controller.h"
11 #include "ash/common/wm_shell.h" 11 #include "ash/common/wm_shell.h"
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 13
14 namespace ash { 14 namespace ash {
15 namespace test { 15 namespace test {
16 16
17 namespace { 17 namespace {
18 18
19 LoginStatus g_initial_status = LoginStatus::USER; 19 LoginStatus g_initial_status = LoginStatus::USER;
20 20
(...skipping 29 matching lines...) Expand all
50 50
51 LoginStatus TestSystemTrayDelegate::GetUserLoginStatus() const { 51 LoginStatus TestSystemTrayDelegate::GetUserLoginStatus() const {
52 // Initial login status has been changed for testing. 52 // Initial login status has been changed for testing.
53 if (g_initial_status != LoginStatus::USER && 53 if (g_initial_status != LoginStatus::USER &&
54 g_initial_status == login_status_) { 54 g_initial_status == login_status_) {
55 return login_status_; 55 return login_status_;
56 } 56 }
57 57
58 // At new user image screen manager->IsUserLoggedIn() would return true 58 // At new user image screen manager->IsUserLoggedIn() would return true
59 // but there's no browser session available yet so use SessionStarted(). 59 // but there's no browser session available yet so use SessionStarted().
60 SessionStateDelegate* delegate = WmShell::Get()->GetSessionStateDelegate(); 60 SessionController* controller = WmShell::Get()->session_controller();
61 61
62 if (!delegate->IsActiveUserSessionStarted()) 62 if (!controller->IsActiveUserSessionStarted())
63 return LoginStatus::NOT_LOGGED_IN; 63 return LoginStatus::NOT_LOGGED_IN;
64 if (delegate->IsScreenLocked()) 64 if (controller->IsScreenLocked())
65 return LoginStatus::LOCKED; 65 return LoginStatus::LOCKED;
66 return login_status_; 66 return login_status_;
67 } 67 }
68 68
69 bool TestSystemTrayDelegate::IsUserSupervised() const { 69 bool TestSystemTrayDelegate::IsUserSupervised() const {
70 return login_status_ == LoginStatus::SUPERVISED; 70 return login_status_ == LoginStatus::SUPERVISED;
71 } 71 }
72 72
73 bool TestSystemTrayDelegate::GetSessionStartTime( 73 bool TestSystemTrayDelegate::GetSessionStartTime(
74 base::TimeTicks* session_start_time) { 74 base::TimeTicks* session_start_time) {
(...skipping 25 matching lines...) Expand all
100 : old_status_(g_initial_status) { 100 : old_status_(g_initial_status) {
101 g_initial_status = new_status; 101 g_initial_status = new_status;
102 } 102 }
103 103
104 ScopedInitialLoginStatus::~ScopedInitialLoginStatus() { 104 ScopedInitialLoginStatus::~ScopedInitialLoginStatus() {
105 g_initial_status = old_status_; 105 g_initial_status = old_status_;
106 } 106 }
107 107
108 } // namespace test 108 } // namespace test
109 } // namespace ash 109 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698