| 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/device_to_device_authenticator.h" | 5 #include "components/proximity_auth/device_to_device_authenticator.h" |
| 6 | 6 |
| 7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
| 8 #include "base/timer/timer.h" | 8 #include "base/timer/timer.h" |
| 9 #include "components/proximity_auth/connection.h" | 9 #include "components/proximity_auth/connection.h" |
| 10 #include "components/proximity_auth/cryptauth/secure_message_delegate.h" | 10 #include "components/proximity_auth/cryptauth/secure_message_delegate.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 // Create the [Hello] message to send to the remote device. | 82 // Create the [Hello] message to send to the remote device. |
| 83 state_ = State::SENDING_HELLO; | 83 state_ = State::SENDING_HELLO; |
| 84 DeviceToDeviceInitiatorOperations::CreateHelloMessage( | 84 DeviceToDeviceInitiatorOperations::CreateHelloMessage( |
| 85 public_key, connection_->remote_device().persistent_symmetric_key, | 85 public_key, connection_->remote_device().persistent_symmetric_key, |
| 86 secure_message_delegate_.get(), | 86 secure_message_delegate_.get(), |
| 87 base::Bind(&DeviceToDeviceAuthenticator::OnHelloMessageCreated, | 87 base::Bind(&DeviceToDeviceAuthenticator::OnHelloMessageCreated, |
| 88 weak_ptr_factory_.GetWeakPtr())); | 88 weak_ptr_factory_.GetWeakPtr())); |
| 89 } | 89 } |
| 90 | 90 |
| 91 scoped_ptr<base::Timer> DeviceToDeviceAuthenticator::CreateTimer() { | 91 scoped_ptr<base::Timer> DeviceToDeviceAuthenticator::CreateTimer() { |
| 92 return make_scoped_ptr(new base::OneShotTimer<DeviceToDeviceAuthenticator>()); | 92 return make_scoped_ptr(new base::OneShotTimer()); |
| 93 } | 93 } |
| 94 | 94 |
| 95 void DeviceToDeviceAuthenticator::OnHelloMessageCreated( | 95 void DeviceToDeviceAuthenticator::OnHelloMessageCreated( |
| 96 const std::string& message) { | 96 const std::string& message) { |
| 97 DCHECK(state_ == State::SENDING_HELLO); | 97 DCHECK(state_ == State::SENDING_HELLO); |
| 98 if (message.empty()) { | 98 if (message.empty()) { |
| 99 Fail("Failed to create [Hello]"); | 99 Fail("Failed to create [Hello]"); |
| 100 return; | 100 return; |
| 101 } | 101 } |
| 102 | 102 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 Succeed(); | 227 Succeed(); |
| 228 else | 228 else |
| 229 Fail("Failed to send [Initiator Auth]"); | 229 Fail("Failed to send [Initiator Auth]"); |
| 230 } else if (!success && state_ == State::SENT_HELLO) { | 230 } else if (!success && state_ == State::SENT_HELLO) { |
| 231 DCHECK(message.payload() == hello_message_); | 231 DCHECK(message.payload() == hello_message_); |
| 232 Fail("Failed to send [Hello]"); | 232 Fail("Failed to send [Hello]"); |
| 233 } | 233 } |
| 234 } | 234 } |
| 235 | 235 |
| 236 } // namespace proximity_auth | 236 } // namespace proximity_auth |
| OLD | NEW |