| 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/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 DCHECK(screenlock_bridge_); | 88 DCHECK(screenlock_bridge_); |
| 89 screenlock_bridge_->AddObserver(this); | 89 screenlock_bridge_->AddObserver(this); |
| 90 } | 90 } |
| 91 | 91 |
| 92 EasyUnlockScreenlockStateHandler::~EasyUnlockScreenlockStateHandler() { | 92 EasyUnlockScreenlockStateHandler::~EasyUnlockScreenlockStateHandler() { |
| 93 screenlock_bridge_->RemoveObserver(this); | 93 screenlock_bridge_->RemoveObserver(this); |
| 94 // Make sure the screenlock state set by this gets cleared. | 94 // Make sure the screenlock state set by this gets cleared. |
| 95 ChangeState(STATE_INACTIVE); | 95 ChangeState(STATE_INACTIVE); |
| 96 } | 96 } |
| 97 | 97 |
| 98 bool EasyUnlockScreenlockStateHandler::IsActive() const { |
| 99 return state_ != STATE_INACTIVE; |
| 100 } |
| 101 |
| 98 void EasyUnlockScreenlockStateHandler::ChangeState(State new_state) { | 102 void EasyUnlockScreenlockStateHandler::ChangeState(State new_state) { |
| 99 if (state_ == new_state) | 103 if (state_ == new_state) |
| 100 return; | 104 return; |
| 101 | 105 |
| 102 state_ = new_state; | 106 state_ = new_state; |
| 103 | 107 |
| 104 // If lock screen is not active or it forces offline password, just cache the | 108 // If lock screen is not active or it forces offline password, just cache the |
| 105 // current state. The screenlock state will get refreshed in |ScreenDidLock|. | 109 // current state. The screenlock state will get refreshed in |ScreenDidLock|. |
| 106 if (!screenlock_bridge_->IsLocked()) | 110 if (!screenlock_bridge_->IsLocked()) |
| 107 return; | 111 return; |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 IDS_EASY_UNLOCK_SCREENLOCK_USER_POD_AUTH_VALUE)); | 288 IDS_EASY_UNLOCK_SCREENLOCK_USER_POD_AUTH_VALUE)); |
| 285 } | 289 } |
| 286 } else if (screenlock_bridge_->lock_handler()->GetAuthType(user_email_) != | 290 } else if (screenlock_bridge_->lock_handler()->GetAuthType(user_email_) != |
| 287 ScreenlockBridge::LockHandler::OFFLINE_PASSWORD) { | 291 ScreenlockBridge::LockHandler::OFFLINE_PASSWORD) { |
| 288 screenlock_bridge_->lock_handler()->SetAuthType( | 292 screenlock_bridge_->lock_handler()->SetAuthType( |
| 289 user_email_, | 293 user_email_, |
| 290 ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, | 294 ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, |
| 291 base::string16()); | 295 base::string16()); |
| 292 } | 296 } |
| 293 } | 297 } |
| OLD | NEW |