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 "chrome/browser/signin/easy_unlock_service_signin_chromeos.h" | 5 #include "chrome/browser/signin/easy_unlock_service_signin_chromeos.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 return data->devices[device_index].wrapped_secret; | 170 return data->devices[device_index].wrapped_secret; |
171 } | 171 } |
172 | 172 |
173 void EasyUnlockServiceSignin::InitializeInternal() { | 173 void EasyUnlockServiceSignin::InitializeInternal() { |
174 if (chromeos::LoginState::Get()->IsUserLoggedIn()) | 174 if (chromeos::LoginState::Get()->IsUserLoggedIn()) |
175 return; | 175 return; |
176 | 176 |
177 service_active_ = true; | 177 service_active_ = true; |
178 | 178 |
179 chromeos::LoginState::Get()->AddObserver(this); | 179 chromeos::LoginState::Get()->AddObserver(this); |
180 ScreenlockBridge* screenlock_bridge = ScreenlockBridge::Get(); | 180 SigninScreenBridge* signin_screen_bridge = SigninScreenBridge::Get(); |
181 screenlock_bridge->AddObserver(this); | 181 signin_screen_bridge->AddObserver(this); |
182 if (!screenlock_bridge->focused_user_id().empty()) | 182 if (!signin_screen_bridge->focused_user_id().empty()) |
183 OnFocusedUserChanged(screenlock_bridge->focused_user_id()); | 183 OnFocusedUserChanged(signin_screen_bridge->focused_user_id()); |
184 } | 184 } |
185 | 185 |
186 void EasyUnlockServiceSignin::ShutdownInternal() { | 186 void EasyUnlockServiceSignin::ShutdownInternal() { |
187 if (!service_active_) | 187 if (!service_active_) |
188 return; | 188 return; |
189 service_active_ = false; | 189 service_active_ = false; |
190 | 190 |
191 weak_ptr_factory_.InvalidateWeakPtrs(); | 191 weak_ptr_factory_.InvalidateWeakPtrs(); |
192 ScreenlockBridge::Get()->RemoveObserver(this); | 192 SigninScreenBridge::Get()->RemoveObserver(this); |
193 chromeos::LoginState::Get()->RemoveObserver(this); | 193 chromeos::LoginState::Get()->RemoveObserver(this); |
194 STLDeleteContainerPairSecondPointers(user_data_.begin(), user_data_.end()); | 194 STLDeleteContainerPairSecondPointers(user_data_.begin(), user_data_.end()); |
195 user_data_.clear(); | 195 user_data_.clear(); |
196 } | 196 } |
197 | 197 |
198 bool EasyUnlockServiceSignin::IsAllowedInternal() { | 198 bool EasyUnlockServiceSignin::IsAllowedInternal() { |
199 return service_active_ && | 199 return service_active_ && |
200 !user_id_.empty() && | 200 !user_id_.empty() && |
201 !chromeos::LoginState::Get()->IsUserLoggedIn(); | 201 !chromeos::LoginState::Get()->IsUserLoggedIn(); |
202 } | 202 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 return NULL; | 283 return NULL; |
284 | 284 |
285 std::map<std::string, UserData*>::const_iterator it = | 285 std::map<std::string, UserData*>::const_iterator it = |
286 user_data_.find(user_id_); | 286 user_data_.find(user_id_); |
287 if (it == user_data_.end()) | 287 if (it == user_data_.end()) |
288 return NULL; | 288 return NULL; |
289 if (it->second->state != USER_DATA_STATE_LOADED) | 289 if (it->second->state != USER_DATA_STATE_LOADED) |
290 return NULL; | 290 return NULL; |
291 return it->second; | 291 return it->second; |
292 } | 292 } |
OLD | NEW |