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" | |
8 #include "base/strings/string16.h" | 7 #include "base/strings/string16.h" |
| 8 #include "components/proximity_auth/logging/logging.h" |
9 | 9 |
10 #if defined(OS_CHROMEOS) | 10 #if defined(OS_CHROMEOS) |
11 #include "chromeos/dbus/dbus_thread_manager.h" | 11 #include "chromeos/dbus/dbus_thread_manager.h" |
12 #include "chromeos/dbus/session_manager_client.h" | 12 #include "chromeos/dbus/session_manager_client.h" |
13 #endif | 13 #endif |
14 | 14 |
15 namespace proximity_auth { | 15 namespace proximity_auth { |
16 namespace { | 16 namespace { |
17 | 17 |
18 base::LazyInstance<ScreenlockBridge> g_screenlock_bridge_instance = | 18 base::LazyInstance<ScreenlockBridge> g_screenlock_bridge_instance = |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 return; | 124 return; |
125 | 125 |
126 // TODO(isherman): If |lock_handler| is null, then |lock_handler_| might have | 126 // TODO(isherman): If |lock_handler| is null, then |lock_handler_| might have |
127 // been freed. Cache the screen type rather than querying it below. | 127 // been freed. Cache the screen type rather than querying it below. |
128 LockHandler::ScreenType screen_type; | 128 LockHandler::ScreenType screen_type; |
129 if (lock_handler_) | 129 if (lock_handler_) |
130 screen_type = lock_handler_->GetScreenType(); | 130 screen_type = lock_handler_->GetScreenType(); |
131 else | 131 else |
132 screen_type = lock_handler->GetScreenType(); | 132 screen_type = lock_handler->GetScreenType(); |
133 | 133 |
| 134 focused_user_id_ = std::string(); |
134 lock_handler_ = lock_handler; | 135 lock_handler_ = lock_handler; |
135 if (lock_handler_) | 136 if (lock_handler_) |
136 FOR_EACH_OBSERVER(Observer, observers_, OnScreenDidLock(screen_type)); | 137 FOR_EACH_OBSERVER(Observer, observers_, OnScreenDidLock(screen_type)); |
137 else | 138 else |
138 FOR_EACH_OBSERVER(Observer, observers_, OnScreenDidUnlock(screen_type)); | 139 FOR_EACH_OBSERVER(Observer, observers_, OnScreenDidUnlock(screen_type)); |
139 } | 140 } |
140 | 141 |
141 void ScreenlockBridge::SetFocusedUser(const std::string& user_id) { | 142 void ScreenlockBridge::SetFocusedUser(const std::string& user_id) { |
142 if (user_id == focused_user_id_) | 143 if (user_id == focused_user_id_) |
143 return; | 144 return; |
| 145 PA_LOG(INFO) << "Focused user changed to " << user_id; |
144 focused_user_id_ = user_id; | 146 focused_user_id_ = user_id; |
145 FOR_EACH_OBSERVER(Observer, observers_, OnFocusedUserChanged(user_id)); | 147 FOR_EACH_OBSERVER(Observer, observers_, OnFocusedUserChanged(user_id)); |
146 } | 148 } |
147 | 149 |
148 bool ScreenlockBridge::IsLocked() const { | 150 bool ScreenlockBridge::IsLocked() const { |
149 return lock_handler_ != nullptr; | 151 return lock_handler_ != nullptr; |
150 } | 152 } |
151 | 153 |
152 void ScreenlockBridge::Lock() { | 154 void ScreenlockBridge::Lock() { |
153 #if defined(OS_CHROMEOS) | 155 #if defined(OS_CHROMEOS) |
(...skipping 18 matching lines...) Expand all Loading... |
172 observers_.RemoveObserver(observer); | 174 observers_.RemoveObserver(observer); |
173 } | 175 } |
174 | 176 |
175 ScreenlockBridge::ScreenlockBridge() : lock_handler_(nullptr) { | 177 ScreenlockBridge::ScreenlockBridge() : lock_handler_(nullptr) { |
176 } | 178 } |
177 | 179 |
178 ScreenlockBridge::~ScreenlockBridge() { | 180 ScreenlockBridge::~ScreenlockBridge() { |
179 } | 181 } |
180 | 182 |
181 } // namespace proximity_auth | 183 } // namespace proximity_auth |
OLD | NEW |