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 "chrome/browser/ui/ash/session_state_delegate_chromeos.h" | 5 #include "chrome/browser/ui/ash/session_state_delegate_chromeos.h" |
6 | 6 |
7 #include "ash/session_state_observer.h" | 7 #include "ash/session_state_observer.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "chrome/browser/chromeos/login/screen_locker.h" | 9 #include "chrome/browser/chromeos/login/screen_locker.h" |
10 #include "chrome/browser/chromeos/login/user.h" | 10 #include "chrome/browser/chromeos/login/user.h" |
| 11 #include "chrome/browser/chromeos/login/user_adding_screen.h" |
11 #include "chrome/browser/chromeos/login/user_manager.h" | 12 #include "chrome/browser/chromeos/login/user_manager.h" |
12 #include "chromeos/dbus/dbus_thread_manager.h" | 13 #include "chromeos/dbus/dbus_thread_manager.h" |
13 #include "chromeos/dbus/session_manager_client.h" | 14 #include "chromeos/dbus/session_manager_client.h" |
14 | 15 |
15 SessionStateDelegateChromeos::SessionStateDelegateChromeos() { | 16 SessionStateDelegateChromeos::SessionStateDelegateChromeos() { |
16 chromeos::UserManager::Get()->AddSessionStateObserver(this); | 17 chromeos::UserManager::Get()->AddSessionStateObserver(this); |
17 } | 18 } |
18 | 19 |
19 SessionStateDelegateChromeos::~SessionStateDelegateChromeos() { | 20 SessionStateDelegateChromeos::~SessionStateDelegateChromeos() { |
20 } | 21 } |
(...skipping 26 matching lines...) Expand all Loading... |
47 VLOG(1) << "Requesting screen lock from SessionStateDelegate"; | 48 VLOG(1) << "Requesting screen lock from SessionStateDelegate"; |
48 chromeos::DBusThreadManager::Get()->GetSessionManagerClient()-> | 49 chromeos::DBusThreadManager::Get()->GetSessionManagerClient()-> |
49 RequestLockScreen(); | 50 RequestLockScreen(); |
50 } | 51 } |
51 | 52 |
52 void SessionStateDelegateChromeos::UnlockScreen() { | 53 void SessionStateDelegateChromeos::UnlockScreen() { |
53 // This is used only for testing thus far. | 54 // This is used only for testing thus far. |
54 NOTIMPLEMENTED(); | 55 NOTIMPLEMENTED(); |
55 } | 56 } |
56 | 57 |
| 58 bool SessionStateDelegateChromeos::IsUserSessionBlocked() const { |
| 59 return !IsActiveUserSessionStarted() || IsScreenLocked() || |
| 60 chromeos::UserAddingScreen::Get()->IsRunning(); |
| 61 } |
| 62 |
57 const base::string16 SessionStateDelegateChromeos::GetUserDisplayName( | 63 const base::string16 SessionStateDelegateChromeos::GetUserDisplayName( |
58 ash::MultiProfileIndex index) const { | 64 ash::MultiProfileIndex index) const { |
59 DCHECK_LT(index, NumberOfLoggedInUsers()); | 65 DCHECK_LT(index, NumberOfLoggedInUsers()); |
60 return chromeos::UserManager::Get()-> | 66 return chromeos::UserManager::Get()-> |
61 GetLRULoggedInUsers()[index]->display_name(); | 67 GetLRULoggedInUsers()[index]->display_name(); |
62 } | 68 } |
63 | 69 |
64 const std::string SessionStateDelegateChromeos::GetUserEmail( | 70 const std::string SessionStateDelegateChromeos::GetUserEmail( |
65 ash::MultiProfileIndex index) const { | 71 ash::MultiProfileIndex index) const { |
66 DCHECK_LT(index, NumberOfLoggedInUsers()); | 72 DCHECK_LT(index, NumberOfLoggedInUsers()); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 ash::SessionStateObserver* observer) { | 104 ash::SessionStateObserver* observer) { |
99 session_state_observer_list_.RemoveObserver(observer); | 105 session_state_observer_list_.RemoveObserver(observer); |
100 } | 106 } |
101 | 107 |
102 void SessionStateDelegateChromeos::ActiveUserChanged( | 108 void SessionStateDelegateChromeos::ActiveUserChanged( |
103 const chromeos::User* active_user) { | 109 const chromeos::User* active_user) { |
104 FOR_EACH_OBSERVER(ash::SessionStateObserver, | 110 FOR_EACH_OBSERVER(ash::SessionStateObserver, |
105 session_state_observer_list_, | 111 session_state_observer_list_, |
106 ActiveUserChanged(active_user->email())); | 112 ActiveUserChanged(active_user->email())); |
107 } | 113 } |
OLD | NEW |