| 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_auth_attempt.h" | 5 #include "chrome/browser/signin/easy_unlock_auth_attempt.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "chrome/browser/signin/easy_unlock_app_manager.h" | 10 #include "chrome/browser/signin/easy_unlock_app_manager.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 proximity_auth::ScreenlockBridge::Get()->lock_handler()->GetAuthType( | 111 proximity_auth::ScreenlockBridge::Get()->lock_handler()->GetAuthType( |
| 112 user_id_); | 112 user_id_); |
| 113 | 113 |
| 114 if (auth_type != proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK) { | 114 if (auth_type != proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK) { |
| 115 Cancel(user_id_); | 115 Cancel(user_id_); |
| 116 return false; | 116 return false; |
| 117 } | 117 } |
| 118 | 118 |
| 119 state_ = STATE_RUNNING; | 119 state_ = STATE_RUNNING; |
| 120 | 120 |
| 121 // We need this workaround for ProximityAuthBleSystem, which is already | 121 if (!app_manager_->SendAuthAttemptEvent()) { |
| 122 // notified in EasyUnlockService. No notification is sent when only the | |
| 123 // |kEnableBluetoothLowEnergyDiscovery| flag is set, and | |
| 124 // |app_manager_->SendAuthAttemptEvent()| returns false. As a result, the auth | |
| 125 // attempt will always fail. | |
| 126 // TODO(sacomoto): Remove this when it's not needed anymore. | |
| 127 if (!app_manager_->SendAuthAttemptEvent() && | |
| 128 !base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 129 proximity_auth::switches::kEnableBluetoothLowEnergyDiscovery)) { | |
| 130 Cancel(user_id_); | 122 Cancel(user_id_); |
| 131 return false; | 123 return false; |
| 132 } | 124 } |
| 133 | 125 |
| 134 return true; | 126 return true; |
| 135 } | 127 } |
| 136 | 128 |
| 137 void EasyUnlockAuthAttempt::FinalizeUnlock(const std::string& user_id, | 129 void EasyUnlockAuthAttempt::FinalizeUnlock(const std::string& user_id, |
| 138 bool success) { | 130 bool success) { |
| 139 if (state_ != STATE_RUNNING || user_id != user_id_) | 131 if (state_ != STATE_RUNNING || user_id != user_id_) |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 state_ = STATE_DONE; | 176 state_ = STATE_DONE; |
| 185 } | 177 } |
| 186 | 178 |
| 187 void EasyUnlockAuthAttempt::Cancel(const std::string& user_id) { | 179 void EasyUnlockAuthAttempt::Cancel(const std::string& user_id) { |
| 188 state_ = STATE_DONE; | 180 state_ = STATE_DONE; |
| 189 | 181 |
| 190 const bool kFailure = false; | 182 const bool kFailure = false; |
| 191 finalized_callback_.Run(type_, kFailure, user_id, std::string(), | 183 finalized_callback_.Run(type_, kFailure, user_id, std::string(), |
| 192 std::string()); | 184 std::string()); |
| 193 } | 185 } |
| OLD | NEW |