| 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" |
| 11 #include "chrome/browser/signin/easy_unlock_metrics.h" | 11 #include "chrome/browser/signin/easy_unlock_metrics.h" |
| 12 #include "chrome/grit/generated_resources.h" | 12 #include "chrome/grit/generated_resources.h" |
| 13 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 ScreenlockBridge::UserPodCustomIcon GetIconForState( | 17 proximity_auth::ScreenlockBridge::UserPodCustomIcon GetIconForState( |
| 18 EasyUnlockScreenlockStateHandler::State state) { | 18 EasyUnlockScreenlockStateHandler::State state) { |
| 19 switch (state) { | 19 switch (state) { |
| 20 case EasyUnlockScreenlockStateHandler::STATE_NO_BLUETOOTH: | 20 case EasyUnlockScreenlockStateHandler::STATE_NO_BLUETOOTH: |
| 21 case EasyUnlockScreenlockStateHandler::STATE_NO_PHONE: | 21 case EasyUnlockScreenlockStateHandler::STATE_NO_PHONE: |
| 22 case EasyUnlockScreenlockStateHandler::STATE_PHONE_NOT_AUTHENTICATED: | 22 case EasyUnlockScreenlockStateHandler::STATE_PHONE_NOT_AUTHENTICATED: |
| 23 case EasyUnlockScreenlockStateHandler::STATE_PHONE_LOCKED: | 23 case EasyUnlockScreenlockStateHandler::STATE_PHONE_LOCKED: |
| 24 case EasyUnlockScreenlockStateHandler::STATE_PHONE_UNLOCKABLE: | 24 case EasyUnlockScreenlockStateHandler::STATE_PHONE_UNLOCKABLE: |
| 25 case EasyUnlockScreenlockStateHandler::STATE_PHONE_UNSUPPORTED: | 25 case EasyUnlockScreenlockStateHandler::STATE_PHONE_UNSUPPORTED: |
| 26 case EasyUnlockScreenlockStateHandler::STATE_RSSI_TOO_LOW: | 26 case EasyUnlockScreenlockStateHandler::STATE_RSSI_TOO_LOW: |
| 27 return ScreenlockBridge::USER_POD_CUSTOM_ICON_LOCKED; | 27 return proximity_auth::ScreenlockBridge::USER_POD_CUSTOM_ICON_LOCKED; |
| 28 case EasyUnlockScreenlockStateHandler::STATE_TX_POWER_TOO_HIGH: | 28 case EasyUnlockScreenlockStateHandler::STATE_TX_POWER_TOO_HIGH: |
| 29 case EasyUnlockScreenlockStateHandler:: | 29 case EasyUnlockScreenlockStateHandler:: |
| 30 STATE_PHONE_LOCKED_AND_TX_POWER_TOO_HIGH: | 30 STATE_PHONE_LOCKED_AND_TX_POWER_TOO_HIGH: |
| 31 // TODO(isherman): This icon is currently identical to the regular locked | 31 // TODO(isherman): This icon is currently identical to the regular locked |
| 32 // icon. Once the reduced proximity range flag is removed, consider | 32 // icon. Once the reduced proximity range flag is removed, consider |
| 33 // deleting the redundant icon. | 33 // deleting the redundant icon. |
| 34 return ScreenlockBridge::USER_POD_CUSTOM_ICON_LOCKED_WITH_PROXIMITY_HINT; | 34 return proximity_auth::ScreenlockBridge:: |
| 35 USER_POD_CUSTOM_ICON_LOCKED_WITH_PROXIMITY_HINT; |
| 35 case EasyUnlockScreenlockStateHandler::STATE_BLUETOOTH_CONNECTING: | 36 case EasyUnlockScreenlockStateHandler::STATE_BLUETOOTH_CONNECTING: |
| 36 return ScreenlockBridge::USER_POD_CUSTOM_ICON_SPINNER; | 37 return proximity_auth::ScreenlockBridge::USER_POD_CUSTOM_ICON_SPINNER; |
| 37 case EasyUnlockScreenlockStateHandler::STATE_AUTHENTICATED: | 38 case EasyUnlockScreenlockStateHandler::STATE_AUTHENTICATED: |
| 38 return ScreenlockBridge::USER_POD_CUSTOM_ICON_UNLOCKED; | 39 return proximity_auth::ScreenlockBridge::USER_POD_CUSTOM_ICON_UNLOCKED; |
| 39 default: | 40 default: |
| 40 return ScreenlockBridge::USER_POD_CUSTOM_ICON_NONE; | 41 return proximity_auth::ScreenlockBridge::USER_POD_CUSTOM_ICON_NONE; |
| 41 } | 42 } |
| 42 } | 43 } |
| 43 | 44 |
| 44 bool HardlockOnClick(EasyUnlockScreenlockStateHandler::State state) { | 45 bool HardlockOnClick(EasyUnlockScreenlockStateHandler::State state) { |
| 45 return state != EasyUnlockScreenlockStateHandler::STATE_INACTIVE; | 46 return state != EasyUnlockScreenlockStateHandler::STATE_INACTIVE; |
| 46 } | 47 } |
| 47 | 48 |
| 48 size_t GetTooltipResourceId(EasyUnlockScreenlockStateHandler::State state) { | 49 size_t GetTooltipResourceId(EasyUnlockScreenlockStateHandler::State state) { |
| 49 switch (state) { | 50 switch (state) { |
| 50 case EasyUnlockScreenlockStateHandler::STATE_NO_BLUETOOTH: | 51 case EasyUnlockScreenlockStateHandler::STATE_NO_BLUETOOTH: |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 87 |
| 87 // Returns true iff the |state| corresponds to a locked remote device. | 88 // Returns true iff the |state| corresponds to a locked remote device. |
| 88 bool IsLockedState(EasyUnlockScreenlockStateHandler::State state) { | 89 bool IsLockedState(EasyUnlockScreenlockStateHandler::State state) { |
| 89 return (state == EasyUnlockScreenlockStateHandler::STATE_PHONE_LOCKED || | 90 return (state == EasyUnlockScreenlockStateHandler::STATE_PHONE_LOCKED || |
| 90 state == EasyUnlockScreenlockStateHandler:: | 91 state == EasyUnlockScreenlockStateHandler:: |
| 91 STATE_PHONE_LOCKED_AND_TX_POWER_TOO_HIGH); | 92 STATE_PHONE_LOCKED_AND_TX_POWER_TOO_HIGH); |
| 92 } | 93 } |
| 93 | 94 |
| 94 } // namespace | 95 } // namespace |
| 95 | 96 |
| 96 | |
| 97 EasyUnlockScreenlockStateHandler::EasyUnlockScreenlockStateHandler( | 97 EasyUnlockScreenlockStateHandler::EasyUnlockScreenlockStateHandler( |
| 98 const std::string& user_email, | 98 const std::string& user_email, |
| 99 HardlockState initial_hardlock_state, | 99 HardlockState initial_hardlock_state, |
| 100 ScreenlockBridge* screenlock_bridge) | 100 proximity_auth::ScreenlockBridge* screenlock_bridge) |
| 101 : state_(STATE_INACTIVE), | 101 : state_(STATE_INACTIVE), |
| 102 user_email_(user_email), | 102 user_email_(user_email), |
| 103 screenlock_bridge_(screenlock_bridge), | 103 screenlock_bridge_(screenlock_bridge), |
| 104 hardlock_state_(initial_hardlock_state), | 104 hardlock_state_(initial_hardlock_state), |
| 105 hardlock_ui_shown_(false), | 105 hardlock_ui_shown_(false), |
| 106 is_trial_run_(false), | 106 is_trial_run_(false), |
| 107 did_see_locked_phone_(false) { | 107 did_see_locked_phone_(false) { |
| 108 DCHECK(screenlock_bridge_); | 108 DCHECK(screenlock_bridge_); |
| 109 screenlock_bridge_->AddObserver(this); | 109 screenlock_bridge_->AddObserver(this); |
| 110 } | 110 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 133 | 133 |
| 134 state_ = new_state; | 134 state_ = new_state; |
| 135 | 135 |
| 136 // If lock screen is not active or it forces offline password, just cache the | 136 // If lock screen is not active or it forces offline password, just cache the |
| 137 // current state. The screenlock state will get refreshed in |ScreenDidLock|. | 137 // current state. The screenlock state will get refreshed in |ScreenDidLock|. |
| 138 if (!screenlock_bridge_->IsLocked()) | 138 if (!screenlock_bridge_->IsLocked()) |
| 139 return; | 139 return; |
| 140 | 140 |
| 141 // Do nothing when auth type is online. | 141 // Do nothing when auth type is online. |
| 142 if (screenlock_bridge_->lock_handler()->GetAuthType(user_email_) == | 142 if (screenlock_bridge_->lock_handler()->GetAuthType(user_email_) == |
| 143 ScreenlockBridge::LockHandler::ONLINE_SIGN_IN) { | 143 proximity_auth::ScreenlockBridge::LockHandler::ONLINE_SIGN_IN) { |
| 144 return; | 144 return; |
| 145 } | 145 } |
| 146 | 146 |
| 147 if (IsLockedState(state_)) | 147 if (IsLockedState(state_)) |
| 148 did_see_locked_phone_ = true; | 148 did_see_locked_phone_ = true; |
| 149 | 149 |
| 150 // No hardlock UI for trial run. | 150 // No hardlock UI for trial run. |
| 151 if (!is_trial_run_ && hardlock_state_ != NO_HARDLOCK) { | 151 if (!is_trial_run_ && hardlock_state_ != NO_HARDLOCK) { |
| 152 ShowHardlockUI(); | 152 ShowHardlockUI(); |
| 153 return; | 153 return; |
| 154 } | 154 } |
| 155 | 155 |
| 156 UpdateScreenlockAuthType(); | 156 UpdateScreenlockAuthType(); |
| 157 | 157 |
| 158 ScreenlockBridge::UserPodCustomIcon icon = GetIconForState(state_); | 158 proximity_auth::ScreenlockBridge::UserPodCustomIcon icon = |
| 159 GetIconForState(state_); |
| 159 | 160 |
| 160 if (icon == ScreenlockBridge::USER_POD_CUSTOM_ICON_NONE) { | 161 if (icon == proximity_auth::ScreenlockBridge::USER_POD_CUSTOM_ICON_NONE) { |
| 161 screenlock_bridge_->lock_handler()->HideUserPodCustomIcon(user_email_); | 162 screenlock_bridge_->lock_handler()->HideUserPodCustomIcon(user_email_); |
| 162 return; | 163 return; |
| 163 } | 164 } |
| 164 | 165 |
| 165 ScreenlockBridge::UserPodCustomIconOptions icon_options; | 166 proximity_auth::ScreenlockBridge::UserPodCustomIconOptions icon_options; |
| 166 icon_options.SetIcon(icon); | 167 icon_options.SetIcon(icon); |
| 167 | 168 |
| 168 // Don't hardlock on trial run. | 169 // Don't hardlock on trial run. |
| 169 if (is_trial_run_) | 170 if (is_trial_run_) |
| 170 icon_options.SetTrialRun(); | 171 icon_options.SetTrialRun(); |
| 171 else if (HardlockOnClick(state_)) | 172 else if (HardlockOnClick(state_)) |
| 172 icon_options.SetHardlockOnClick(); | 173 icon_options.SetHardlockOnClick(); |
| 173 | 174 |
| 174 UpdateTooltipOptions(&icon_options); | 175 UpdateTooltipOptions(&icon_options); |
| 175 | 176 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 RecordEasyUnlockTrialRunEvent(EASY_UNLOCK_TRIAL_RUN_EVENT_LAUNCHED); | 216 RecordEasyUnlockTrialRunEvent(EASY_UNLOCK_TRIAL_RUN_EVENT_LAUNCHED); |
| 216 } | 217 } |
| 217 | 218 |
| 218 void EasyUnlockScreenlockStateHandler::RecordClickOnLockIcon() { | 219 void EasyUnlockScreenlockStateHandler::RecordClickOnLockIcon() { |
| 219 if (!is_trial_run_) | 220 if (!is_trial_run_) |
| 220 return; | 221 return; |
| 221 RecordEasyUnlockTrialRunEvent(EASY_UNLOCK_TRIAL_RUN_EVENT_CLICKED_LOCK_ICON); | 222 RecordEasyUnlockTrialRunEvent(EASY_UNLOCK_TRIAL_RUN_EVENT_CLICKED_LOCK_ICON); |
| 222 } | 223 } |
| 223 | 224 |
| 224 void EasyUnlockScreenlockStateHandler::OnScreenDidLock( | 225 void EasyUnlockScreenlockStateHandler::OnScreenDidLock( |
| 225 ScreenlockBridge::LockHandler::ScreenType screen_type) { | 226 proximity_auth::ScreenlockBridge::LockHandler::ScreenType screen_type) { |
| 226 did_see_locked_phone_ = IsLockedState(state_); | 227 did_see_locked_phone_ = IsLockedState(state_); |
| 227 RefreshScreenlockState(); | 228 RefreshScreenlockState(); |
| 228 } | 229 } |
| 229 | 230 |
| 230 void EasyUnlockScreenlockStateHandler::OnScreenDidUnlock( | 231 void EasyUnlockScreenlockStateHandler::OnScreenDidUnlock( |
| 231 ScreenlockBridge::LockHandler::ScreenType screen_type) { | 232 proximity_auth::ScreenlockBridge::LockHandler::ScreenType screen_type) { |
| 232 if (hardlock_state_ == LOGIN_FAILED) | 233 if (hardlock_state_ == LOGIN_FAILED) |
| 233 hardlock_state_ = NO_HARDLOCK; | 234 hardlock_state_ = NO_HARDLOCK; |
| 234 hardlock_ui_shown_ = false; | 235 hardlock_ui_shown_ = false; |
| 235 is_trial_run_ = false; | 236 is_trial_run_ = false; |
| 236 | 237 |
| 237 // Upon a successful unlock event, record whether the user's phone was locked | 238 // Upon a successful unlock event, record whether the user's phone was locked |
| 238 // at any point while the lock screen was up. | 239 // at any point while the lock screen was up. |
| 239 if (state_ == STATE_AUTHENTICATED) | 240 if (state_ == STATE_AUTHENTICATED) |
| 240 RecordEasyUnlockDidUserManuallyUnlockPhone(did_see_locked_phone_); | 241 RecordEasyUnlockDidUserManuallyUnlockPhone(did_see_locked_phone_); |
| 241 did_see_locked_phone_ = false; | 242 did_see_locked_phone_ = false; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 252 ChangeState(last_state); | 253 ChangeState(last_state); |
| 253 } | 254 } |
| 254 | 255 |
| 255 void EasyUnlockScreenlockStateHandler::ShowHardlockUI() { | 256 void EasyUnlockScreenlockStateHandler::ShowHardlockUI() { |
| 256 DCHECK(hardlock_state_ != NO_HARDLOCK); | 257 DCHECK(hardlock_state_ != NO_HARDLOCK); |
| 257 | 258 |
| 258 if (!screenlock_bridge_->IsLocked()) | 259 if (!screenlock_bridge_->IsLocked()) |
| 259 return; | 260 return; |
| 260 | 261 |
| 261 // Do not override online signin. | 262 // Do not override online signin. |
| 262 const ScreenlockBridge::LockHandler::AuthType existing_auth_type = | 263 const proximity_auth::ScreenlockBridge::LockHandler::AuthType |
| 263 screenlock_bridge_->lock_handler()->GetAuthType(user_email_); | 264 existing_auth_type = |
| 264 if (existing_auth_type == ScreenlockBridge::LockHandler::ONLINE_SIGN_IN) | 265 screenlock_bridge_->lock_handler()->GetAuthType(user_email_); |
| 266 if (existing_auth_type == |
| 267 proximity_auth::ScreenlockBridge::LockHandler::ONLINE_SIGN_IN) |
| 265 return; | 268 return; |
| 266 | 269 |
| 267 if (existing_auth_type != ScreenlockBridge::LockHandler::OFFLINE_PASSWORD) { | 270 if (existing_auth_type != |
| 271 proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD) { |
| 268 screenlock_bridge_->lock_handler()->SetAuthType( | 272 screenlock_bridge_->lock_handler()->SetAuthType( |
| 269 user_email_, | 273 user_email_, |
| 270 ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, | 274 proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, |
| 271 base::string16()); | 275 base::string16()); |
| 272 } | 276 } |
| 273 | 277 |
| 274 if (hardlock_state_ == NO_PAIRING) { | 278 if (hardlock_state_ == NO_PAIRING) { |
| 275 screenlock_bridge_->lock_handler()->HideUserPodCustomIcon(user_email_); | 279 screenlock_bridge_->lock_handler()->HideUserPodCustomIcon(user_email_); |
| 276 hardlock_ui_shown_ = false; | 280 hardlock_ui_shown_ = false; |
| 277 return; | 281 return; |
| 278 } | 282 } |
| 279 | 283 |
| 280 if (hardlock_ui_shown_) | 284 if (hardlock_ui_shown_) |
| 281 return; | 285 return; |
| 282 | 286 |
| 283 ScreenlockBridge::UserPodCustomIconOptions icon_options; | 287 proximity_auth::ScreenlockBridge::UserPodCustomIconOptions icon_options; |
| 284 if (hardlock_state_ == LOGIN_FAILED) { | 288 if (hardlock_state_ == LOGIN_FAILED) { |
| 285 icon_options.SetIcon(ScreenlockBridge::USER_POD_CUSTOM_ICON_LOCKED); | 289 icon_options.SetIcon( |
| 290 proximity_auth::ScreenlockBridge::USER_POD_CUSTOM_ICON_LOCKED); |
| 286 } else if (hardlock_state_ == PAIRING_CHANGED || | 291 } else if (hardlock_state_ == PAIRING_CHANGED || |
| 287 hardlock_state_ == PAIRING_ADDED) { | 292 hardlock_state_ == PAIRING_ADDED) { |
| 293 icon_options.SetIcon(proximity_auth::ScreenlockBridge:: |
| 294 USER_POD_CUSTOM_ICON_LOCKED_TO_BE_ACTIVATED); |
| 295 } else { |
| 288 icon_options.SetIcon( | 296 icon_options.SetIcon( |
| 289 ScreenlockBridge::USER_POD_CUSTOM_ICON_LOCKED_TO_BE_ACTIVATED); | 297 proximity_auth::ScreenlockBridge::USER_POD_CUSTOM_ICON_HARDLOCKED); |
| 290 } else { | |
| 291 icon_options.SetIcon(ScreenlockBridge::USER_POD_CUSTOM_ICON_HARDLOCKED); | |
| 292 } | 298 } |
| 293 | 299 |
| 294 base::string16 device_name = GetDeviceName(); | 300 base::string16 device_name = GetDeviceName(); |
| 295 base::string16 tooltip; | 301 base::string16 tooltip; |
| 296 if (hardlock_state_ == USER_HARDLOCK) { | 302 if (hardlock_state_ == USER_HARDLOCK) { |
| 297 tooltip = l10n_util::GetStringFUTF16( | 303 tooltip = l10n_util::GetStringFUTF16( |
| 298 IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_HARDLOCK_USER, device_name); | 304 IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_HARDLOCK_USER, device_name); |
| 299 } else if (hardlock_state_ == PAIRING_CHANGED) { | 305 } else if (hardlock_state_ == PAIRING_CHANGED) { |
| 300 tooltip = l10n_util::GetStringUTF16( | 306 tooltip = l10n_util::GetStringUTF16( |
| 301 IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_HARDLOCK_PAIRING_CHANGED); | 307 IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_HARDLOCK_PAIRING_CHANGED); |
| 302 } else if (hardlock_state_ == PAIRING_ADDED) { | 308 } else if (hardlock_state_ == PAIRING_ADDED) { |
| 303 tooltip = l10n_util::GetStringFUTF16( | 309 tooltip = l10n_util::GetStringFUTF16( |
| 304 IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_HARDLOCK_PAIRING_ADDED, device_name, | 310 IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_HARDLOCK_PAIRING_ADDED, device_name, |
| 305 device_name); | 311 device_name); |
| 306 } else if (hardlock_state_ == LOGIN_FAILED) { | 312 } else if (hardlock_state_ == LOGIN_FAILED) { |
| 307 tooltip = l10n_util::GetStringUTF16( | 313 tooltip = l10n_util::GetStringUTF16( |
| 308 IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_LOGIN_FAILURE); | 314 IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_LOGIN_FAILURE); |
| 309 } else { | 315 } else { |
| 310 LOG(ERROR) << "Unknown hardlock state " << hardlock_state_; | 316 LOG(ERROR) << "Unknown hardlock state " << hardlock_state_; |
| 311 } | 317 } |
| 312 icon_options.SetTooltip(tooltip, true /* autoshow */); | 318 icon_options.SetTooltip(tooltip, true /* autoshow */); |
| 313 | 319 |
| 314 screenlock_bridge_->lock_handler()->ShowUserPodCustomIcon(user_email_, | 320 screenlock_bridge_->lock_handler()->ShowUserPodCustomIcon(user_email_, |
| 315 icon_options); | 321 icon_options); |
| 316 hardlock_ui_shown_ = true; | 322 hardlock_ui_shown_ = true; |
| 317 } | 323 } |
| 318 | 324 |
| 319 void EasyUnlockScreenlockStateHandler::UpdateTooltipOptions( | 325 void EasyUnlockScreenlockStateHandler::UpdateTooltipOptions( |
| 320 ScreenlockBridge::UserPodCustomIconOptions* icon_options) { | 326 proximity_auth::ScreenlockBridge::UserPodCustomIconOptions* icon_options) { |
| 321 size_t resource_id = 0; | 327 size_t resource_id = 0; |
| 322 base::string16 device_name; | 328 base::string16 device_name; |
| 323 if (is_trial_run_ && state_ == STATE_AUTHENTICATED) { | 329 if (is_trial_run_ && state_ == STATE_AUTHENTICATED) { |
| 324 resource_id = IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_INITIAL_AUTHENTICATED; | 330 resource_id = IDS_EASY_UNLOCK_SCREENLOCK_TOOLTIP_INITIAL_AUTHENTICATED; |
| 325 } else { | 331 } else { |
| 326 resource_id = GetTooltipResourceId(state_); | 332 resource_id = GetTooltipResourceId(state_); |
| 327 if (TooltipContainsDeviceType(state_)) | 333 if (TooltipContainsDeviceType(state_)) |
| 328 device_name = GetDeviceName(); | 334 device_name = GetDeviceName(); |
| 329 } | 335 } |
| 330 | 336 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 353 // TODO(tbarzic): Figure out the name for non Chrome OS case. | 359 // TODO(tbarzic): Figure out the name for non Chrome OS case. |
| 354 return base::ASCIIToUTF16("Chrome"); | 360 return base::ASCIIToUTF16("Chrome"); |
| 355 #endif | 361 #endif |
| 356 } | 362 } |
| 357 | 363 |
| 358 void EasyUnlockScreenlockStateHandler::UpdateScreenlockAuthType() { | 364 void EasyUnlockScreenlockStateHandler::UpdateScreenlockAuthType() { |
| 359 if (!is_trial_run_ && hardlock_state_ != NO_HARDLOCK) | 365 if (!is_trial_run_ && hardlock_state_ != NO_HARDLOCK) |
| 360 return; | 366 return; |
| 361 | 367 |
| 362 // Do not override online signin. | 368 // Do not override online signin. |
| 363 const ScreenlockBridge::LockHandler::AuthType existing_auth_type = | 369 const proximity_auth::ScreenlockBridge::LockHandler::AuthType |
| 364 screenlock_bridge_->lock_handler()->GetAuthType(user_email_); | 370 existing_auth_type = |
| 365 DCHECK_NE(ScreenlockBridge::LockHandler::ONLINE_SIGN_IN, existing_auth_type); | 371 screenlock_bridge_->lock_handler()->GetAuthType(user_email_); |
| 372 DCHECK_NE(proximity_auth::ScreenlockBridge::LockHandler::ONLINE_SIGN_IN, |
| 373 existing_auth_type); |
| 366 | 374 |
| 367 if (state_ == STATE_AUTHENTICATED) { | 375 if (state_ == STATE_AUTHENTICATED) { |
| 368 if (existing_auth_type != ScreenlockBridge::LockHandler::USER_CLICK) { | 376 if (existing_auth_type != |
| 377 proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK) { |
| 369 screenlock_bridge_->lock_handler()->SetAuthType( | 378 screenlock_bridge_->lock_handler()->SetAuthType( |
| 370 user_email_, | 379 user_email_, |
| 371 ScreenlockBridge::LockHandler::USER_CLICK, | 380 proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK, |
| 372 l10n_util::GetStringUTF16( | 381 l10n_util::GetStringUTF16( |
| 373 IDS_EASY_UNLOCK_SCREENLOCK_USER_POD_AUTH_VALUE)); | 382 IDS_EASY_UNLOCK_SCREENLOCK_USER_POD_AUTH_VALUE)); |
| 374 } | 383 } |
| 375 } else if (existing_auth_type != | 384 } else if (existing_auth_type != |
| 376 ScreenlockBridge::LockHandler::OFFLINE_PASSWORD) { | 385 proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD) { |
| 377 screenlock_bridge_->lock_handler()->SetAuthType( | 386 screenlock_bridge_->lock_handler()->SetAuthType( |
| 378 user_email_, | 387 user_email_, |
| 379 ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, | 388 proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, |
| 380 base::string16()); | 389 base::string16()); |
| 381 } | 390 } |
| 382 } | 391 } |
| OLD | NEW |