OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/proximity_auth/screenlock_bridge.h" | 5 #include "components/proximity_auth/screenlock_bridge.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
9 | 9 |
10 #if defined(OS_CHROMEOS) | 10 #if defined(OS_CHROMEOS) |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 FOR_EACH_OBSERVER(Observer, observers_, OnScreenDidUnlock(screen_type)); | 138 FOR_EACH_OBSERVER(Observer, observers_, OnScreenDidUnlock(screen_type)); |
139 } | 139 } |
140 | 140 |
141 void ScreenlockBridge::SetFocusedUser(const std::string& user_id) { | 141 void ScreenlockBridge::SetFocusedUser(const std::string& user_id) { |
142 if (user_id == focused_user_id_) | 142 if (user_id == focused_user_id_) |
143 return; | 143 return; |
144 focused_user_id_ = user_id; | 144 focused_user_id_ = user_id; |
145 FOR_EACH_OBSERVER(Observer, observers_, OnFocusedUserChanged(user_id)); | 145 FOR_EACH_OBSERVER(Observer, observers_, OnFocusedUserChanged(user_id)); |
146 } | 146 } |
147 | 147 |
| 148 std::string ScreenlockBridge::GetFocusedUser() { |
| 149 return focused_user_id_; |
| 150 } |
| 151 |
148 bool ScreenlockBridge::IsLocked() const { | 152 bool ScreenlockBridge::IsLocked() const { |
149 return lock_handler_ != nullptr; | 153 return lock_handler_ != nullptr; |
150 } | 154 } |
151 | 155 |
152 void ScreenlockBridge::Lock() { | 156 void ScreenlockBridge::Lock() { |
153 #if defined(OS_CHROMEOS) | 157 #if defined(OS_CHROMEOS) |
154 chromeos::SessionManagerClient* session_manager = | 158 chromeos::SessionManagerClient* session_manager = |
155 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(); | 159 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(); |
156 session_manager->RequestLockScreen(); | 160 session_manager->RequestLockScreen(); |
157 #else | 161 #else |
(...skipping 14 matching lines...) Expand all Loading... |
172 observers_.RemoveObserver(observer); | 176 observers_.RemoveObserver(observer); |
173 } | 177 } |
174 | 178 |
175 ScreenlockBridge::ScreenlockBridge() : lock_handler_(nullptr) { | 179 ScreenlockBridge::ScreenlockBridge() : lock_handler_(nullptr) { |
176 } | 180 } |
177 | 181 |
178 ScreenlockBridge::~ScreenlockBridge() { | 182 ScreenlockBridge::~ScreenlockBridge() { |
179 } | 183 } |
180 | 184 |
181 } // namespace proximity_auth | 185 } // namespace proximity_auth |
OLD | NEW |