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_screenlock_state_handler.h" | 5 #include "chrome/browser/signin/easy_unlock_screenlock_state_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/chromeos/chromeos_utils.h" | 10 #include "chrome/browser/chromeos/chromeos_utils.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 if (state_ == new_state) | 112 if (state_ == new_state) |
113 return; | 113 return; |
114 | 114 |
115 state_ = new_state; | 115 state_ = new_state; |
116 | 116 |
117 // If lock screen is not active or it forces offline password, just cache the | 117 // If lock screen is not active or it forces offline password, just cache the |
118 // current state. The screenlock state will get refreshed in |ScreenDidLock|. | 118 // current state. The screenlock state will get refreshed in |ScreenDidLock|. |
119 if (!screenlock_bridge_->IsLocked()) | 119 if (!screenlock_bridge_->IsLocked()) |
120 return; | 120 return; |
121 | 121 |
| 122 // Do nothing when auth type is online. |
| 123 if (screenlock_bridge_->lock_handler()->GetAuthType(user_email_) == |
| 124 ScreenlockBridge::LockHandler::ONLINE_SIGN_IN) { |
| 125 return; |
| 126 } |
| 127 |
122 // No hardlock UI for trial run. | 128 // No hardlock UI for trial run. |
123 if (!is_trial_run_ && hardlock_state_ != NO_HARDLOCK) { | 129 if (!is_trial_run_ && hardlock_state_ != NO_HARDLOCK) { |
124 ShowHardlockUI(); | 130 ShowHardlockUI(); |
125 return; | 131 return; |
126 } | 132 } |
127 | 133 |
128 UpdateScreenlockAuthType(); | 134 UpdateScreenlockAuthType(); |
129 | 135 |
130 ScreenlockBridge::UserPodCustomIcon icon = GetIconForState(state_); | 136 ScreenlockBridge::UserPodCustomIcon icon = GetIconForState(state_); |
131 | 137 |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 #endif | 312 #endif |
307 } | 313 } |
308 | 314 |
309 void EasyUnlockScreenlockStateHandler::UpdateScreenlockAuthType() { | 315 void EasyUnlockScreenlockStateHandler::UpdateScreenlockAuthType() { |
310 if (!is_trial_run_ && hardlock_state_ != NO_HARDLOCK) | 316 if (!is_trial_run_ && hardlock_state_ != NO_HARDLOCK) |
311 return; | 317 return; |
312 | 318 |
313 // Do not override online signin. | 319 // Do not override online signin. |
314 const ScreenlockBridge::LockHandler::AuthType existing_auth_type = | 320 const ScreenlockBridge::LockHandler::AuthType existing_auth_type = |
315 screenlock_bridge_->lock_handler()->GetAuthType(user_email_); | 321 screenlock_bridge_->lock_handler()->GetAuthType(user_email_); |
316 if (existing_auth_type == ScreenlockBridge::LockHandler::ONLINE_SIGN_IN) | 322 DCHECK_NE(ScreenlockBridge::LockHandler::ONLINE_SIGN_IN, existing_auth_type); |
317 return; | |
318 | 323 |
319 if (state_ == STATE_AUTHENTICATED) { | 324 if (state_ == STATE_AUTHENTICATED) { |
320 if (existing_auth_type != ScreenlockBridge::LockHandler::USER_CLICK) { | 325 if (existing_auth_type != ScreenlockBridge::LockHandler::USER_CLICK) { |
321 screenlock_bridge_->lock_handler()->SetAuthType( | 326 screenlock_bridge_->lock_handler()->SetAuthType( |
322 user_email_, | 327 user_email_, |
323 ScreenlockBridge::LockHandler::USER_CLICK, | 328 ScreenlockBridge::LockHandler::USER_CLICK, |
324 l10n_util::GetStringUTF16( | 329 l10n_util::GetStringUTF16( |
325 IDS_EASY_UNLOCK_SCREENLOCK_USER_POD_AUTH_VALUE)); | 330 IDS_EASY_UNLOCK_SCREENLOCK_USER_POD_AUTH_VALUE)); |
326 } | 331 } |
327 } else if (existing_auth_type != | 332 } else if (existing_auth_type != |
328 ScreenlockBridge::LockHandler::OFFLINE_PASSWORD) { | 333 ScreenlockBridge::LockHandler::OFFLINE_PASSWORD) { |
329 screenlock_bridge_->lock_handler()->SetAuthType( | 334 screenlock_bridge_->lock_handler()->SetAuthType( |
330 user_email_, | 335 user_email_, |
331 ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, | 336 ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, |
332 base::string16()); | 337 base::string16()); |
333 } | 338 } |
334 } | 339 } |
OLD | NEW |