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> |
| 8 |
7 #include "base/logging.h" | 9 #include "base/logging.h" |
8 #include "components/proximity_auth/connection_observer.h" | 10 #include "components/proximity_auth/connection_observer.h" |
9 #include "components/proximity_auth/wire_message.h" | 11 #include "components/proximity_auth/wire_message.h" |
10 | 12 |
11 namespace proximity_auth { | 13 namespace proximity_auth { |
12 | 14 |
13 Connection::Connection(const RemoteDevice& remote_device) | 15 Connection::Connection(const RemoteDevice& remote_device) |
14 : remote_device_(remote_device), | 16 : remote_device_(remote_device), |
15 status_(DISCONNECTED), | 17 status_(DISCONNECTED), |
16 is_sending_message_(false) { | 18 is_sending_message_(false) { |
(...skipping 11 matching lines...) Expand all Loading... |
28 VLOG(1) << "Cannot send message when disconnected."; | 30 VLOG(1) << "Cannot send message when disconnected."; |
29 return; | 31 return; |
30 } | 32 } |
31 | 33 |
32 if (is_sending_message_) { | 34 if (is_sending_message_) { |
33 VLOG(1) << "Another message is currently in progress."; | 35 VLOG(1) << "Another message is currently in progress."; |
34 return; | 36 return; |
35 } | 37 } |
36 | 38 |
37 is_sending_message_ = true; | 39 is_sending_message_ = true; |
38 SendMessageImpl(message.Pass()); | 40 SendMessageImpl(std::move(message)); |
39 } | 41 } |
40 | 42 |
41 void Connection::AddObserver(ConnectionObserver* observer) { | 43 void Connection::AddObserver(ConnectionObserver* observer) { |
42 observers_.AddObserver(observer); | 44 observers_.AddObserver(observer); |
43 } | 45 } |
44 | 46 |
45 void Connection::RemoveObserver(ConnectionObserver* observer) { | 47 void Connection::RemoveObserver(ConnectionObserver* observer) { |
46 observers_.RemoveObserver(observer); | 48 observers_.RemoveObserver(observer); |
47 } | 49 } |
48 | 50 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // |received_bytes_| buffer. | 98 // |received_bytes_| buffer. |
97 received_bytes_.clear(); | 99 received_bytes_.clear(); |
98 } | 100 } |
99 | 101 |
100 scoped_ptr<WireMessage> Connection::DeserializeWireMessage( | 102 scoped_ptr<WireMessage> Connection::DeserializeWireMessage( |
101 bool* is_incomplete_message) { | 103 bool* is_incomplete_message) { |
102 return WireMessage::Deserialize(received_bytes_, is_incomplete_message); | 104 return WireMessage::Deserialize(received_bytes_, is_incomplete_message); |
103 } | 105 } |
104 | 106 |
105 } // namespace proximity_auth | 107 } // namespace proximity_auth |
OLD | NEW |