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

Side by Side Diff: components/proximity_auth/remote_device_life_cycle_impl.cc

Issue 1356943004: Add RemoteDeviceLoader to create RemoteDevice from CryptAuth data. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@webui
Patch Set: move RemoteDevice creation in tests to util function Created 5 years, 2 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 unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « components/proximity_auth/remote_device.cc ('k') | components/proximity_auth/remote_device_life_cycle_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698