Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(619)

Unified Diff: components/proximity_auth/remote_device_life_cycle_impl.cc

Issue 1372283002: Hook up ProximityAuthSystem in EasyUnlockService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth_connection
Patch Set: remove log Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/proximity_auth/remote_device_life_cycle_impl.cc
diff --git a/components/proximity_auth/remote_device_life_cycle_impl.cc b/components/proximity_auth/remote_device_life_cycle_impl.cc
index a9d2538b0eda6321cd2ac804bbf49dd8733adcff..d7d5508c09ed42754222837ce1a8f9776a431551 100644
--- a/components/proximity_auth/remote_device_life_cycle_impl.cc
+++ b/components/proximity_auth/remote_device_life_cycle_impl.cc
@@ -43,6 +43,7 @@ RemoteDeviceLifeCycleImpl::RemoteDeviceLifeCycleImpl(
: remote_device_(remote_device),
proximity_auth_client_(proximity_auth_client),
state_(RemoteDeviceLifeCycle::State::STOPPED),
+ observers_(base::ObserverList<Observer>::NOTIFY_EXISTING_ONLY),
bluetooth_throttler_(new BluetoothThrottlerImpl(
make_scoped_ptr(new base::DefaultTickClock()))),
weak_ptr_factory_(this) {}
@@ -73,9 +74,7 @@ void RemoteDeviceLifeCycleImpl::RemoveObserver(Observer* observer) {
scoped_ptr<ConnectionFinder>
RemoteDeviceLifeCycleImpl::CreateConnectionFinder() {
- // TODO(tengs): We should not rely on the assumption that an empty Bluetooth
- // address means that the device is BLE.
- if (remote_device_.bluetooth_address.empty()) {
+ if (remote_device_.bluetooth_type == RemoteDevice::BLUETOOTH_LE) {
return make_scoped_ptr(new BluetoothLowEnergyConnectionFinder(
remote_device_, kBLESmartLockServiceUUID,
BluetoothLowEnergyConnectionFinder::FinderStrategy::FIND_PAIRED_DEVICE,
@@ -126,6 +125,7 @@ void RemoteDeviceLifeCycleImpl::OnAuthenticationResult(
Authenticator::Result result,
scoped_ptr<SecureContext> secure_context) {
DCHECK(state_ == RemoteDeviceLifeCycle::State::AUTHENTICATING);
+ authenticator_.reset();
if (result != Authenticator::Result::SUCCESS) {
PA_LOG(WARNING) << "Waiting " << kAuthenticationRecoveryTimeSeconds
<< " seconds to retry after authentication failure.";
@@ -139,9 +139,8 @@ void RemoteDeviceLifeCycleImpl::OnAuthenticationResult(
}
// Create the MessengerImpl asynchronously. |messenger_| registers itself as
- // an
- // observer of |connection_|, so creating it synchronously would
- // trigger |OnSendComplete()| as an observer call for |messenger_|.
+ // an observer of |connection_|, so creating it synchronously would trigger
+ // |OnSendCompleted()| as an observer call for |messenger_|.
secure_context_ = secure_context.Pass();
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(&RemoteDeviceLifeCycleImpl::CreateMessenger,
@@ -160,6 +159,7 @@ void RemoteDeviceLifeCycleImpl::CreateMessenger() {
void RemoteDeviceLifeCycleImpl::OnDisconnected() {
DCHECK(state_ == RemoteDeviceLifeCycle::State::SECURE_CHANNEL_ESTABLISHED);
+ messenger_.reset();
FindConnection();
}

Powered by Google App Engine
This is Rietveld 408576698