OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/proximity_auth/remote_device_life_cycle_impl.h" | 5 #include "components/proximity_auth/remote_device_life_cycle_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/thread_task_runner_handle.h" | 9 #include "base/thread_task_runner_handle.h" |
10 #include "base/time/default_tick_clock.h" | 10 #include "base/time/default_tick_clock.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 nullptr, bluetooth_throttler_.get(), 3)); | 82 nullptr, bluetooth_throttler_.get(), 3)); |
83 } else { | 83 } else { |
84 return make_scoped_ptr(new BluetoothConnectionFinder( | 84 return make_scoped_ptr(new BluetoothConnectionFinder( |
85 remote_device_, device::BluetoothUUID(kClassicBluetoothServiceUUID), | 85 remote_device_, device::BluetoothUUID(kClassicBluetoothServiceUUID), |
86 base::TimeDelta::FromSeconds(3))); | 86 base::TimeDelta::FromSeconds(3))); |
87 } | 87 } |
88 } | 88 } |
89 | 89 |
90 scoped_ptr<Authenticator> RemoteDeviceLifeCycleImpl::CreateAuthenticator() { | 90 scoped_ptr<Authenticator> RemoteDeviceLifeCycleImpl::CreateAuthenticator() { |
91 return make_scoped_ptr(new DeviceToDeviceAuthenticator( | 91 return make_scoped_ptr(new DeviceToDeviceAuthenticator( |
92 connection_.get(), proximity_auth_client_->GetAccountId(), | 92 connection_.get(), remote_device_.user_id, |
93 proximity_auth_client_->CreateSecureMessageDelegate())); | 93 proximity_auth_client_->CreateSecureMessageDelegate())); |
94 } | 94 } |
95 | 95 |
96 void RemoteDeviceLifeCycleImpl::TransitionToState( | 96 void RemoteDeviceLifeCycleImpl::TransitionToState( |
97 RemoteDeviceLifeCycle::State new_state) { | 97 RemoteDeviceLifeCycle::State new_state) { |
98 PA_LOG(INFO) << "Life cycle transition: " << static_cast<int>(state_) | 98 PA_LOG(INFO) << "Life cycle transition: " << static_cast<int>(state_) |
99 << " => " << static_cast<int>(new_state); | 99 << " => " << static_cast<int>(new_state); |
100 RemoteDeviceLifeCycle::State old_state = state_; | 100 RemoteDeviceLifeCycle::State old_state = state_; |
101 state_ = new_state; | 101 state_ = new_state; |
102 FOR_EACH_OBSERVER(Observer, observers_, | 102 FOR_EACH_OBSERVER(Observer, observers_, |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 | 157 |
158 TransitionToState(RemoteDeviceLifeCycle::State::SECURE_CHANNEL_ESTABLISHED); | 158 TransitionToState(RemoteDeviceLifeCycle::State::SECURE_CHANNEL_ESTABLISHED); |
159 } | 159 } |
160 | 160 |
161 void RemoteDeviceLifeCycleImpl::OnDisconnected() { | 161 void RemoteDeviceLifeCycleImpl::OnDisconnected() { |
162 DCHECK(state_ == RemoteDeviceLifeCycle::State::SECURE_CHANNEL_ESTABLISHED); | 162 DCHECK(state_ == RemoteDeviceLifeCycle::State::SECURE_CHANNEL_ESTABLISHED); |
163 FindConnection(); | 163 FindConnection(); |
164 } | 164 } |
165 | 165 |
166 } // namespace proximity_auth | 166 } // namespace proximity_auth |
OLD | NEW |