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 "components/proximity_auth/connection.h" | 5 #include "components/proximity_auth/connection.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "components/proximity_auth/connection_observer.h" | 10 #include "components/proximity_auth/connection_observer.h" |
11 #include "components/proximity_auth/wire_message.h" | 11 #include "components/proximity_auth/wire_message.h" |
12 | 12 |
13 namespace proximity_auth { | 13 namespace proximity_auth { |
14 | 14 |
15 Connection::Connection(const RemoteDevice& remote_device) | 15 Connection::Connection(const cryptauth::RemoteDevice& remote_device) |
16 : remote_device_(remote_device), | 16 : remote_device_(remote_device), |
17 status_(DISCONNECTED), | 17 status_(DISCONNECTED), |
18 is_sending_message_(false) { | 18 is_sending_message_(false) {} |
19 } | |
20 | 19 |
21 Connection::~Connection() { | 20 Connection::~Connection() { |
22 } | 21 } |
23 | 22 |
24 bool Connection::IsConnected() const { | 23 bool Connection::IsConnected() const { |
25 return status_ == CONNECTED; | 24 return status_ == CONNECTED; |
26 } | 25 } |
27 | 26 |
28 void Connection::SendMessage(std::unique_ptr<WireMessage> message) { | 27 void Connection::SendMessage(std::unique_ptr<WireMessage> message) { |
29 if (!IsConnected()) { | 28 if (!IsConnected()) { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 // |received_bytes_| buffer. | 97 // |received_bytes_| buffer. |
99 received_bytes_.clear(); | 98 received_bytes_.clear(); |
100 } | 99 } |
101 | 100 |
102 std::unique_ptr<WireMessage> Connection::DeserializeWireMessage( | 101 std::unique_ptr<WireMessage> Connection::DeserializeWireMessage( |
103 bool* is_incomplete_message) { | 102 bool* is_incomplete_message) { |
104 return WireMessage::Deserialize(received_bytes_, is_incomplete_message); | 103 return WireMessage::Deserialize(received_bytes_, is_incomplete_message); |
105 } | 104 } |
106 | 105 |
107 } // namespace proximity_auth | 106 } // namespace proximity_auth |
OLD | NEW |