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 "base/logging.h" | 7 #include "base/logging.h" |
8 #include "components/proximity_auth/connection_observer.h" | 8 #include "components/proximity_auth/connection_observer.h" |
9 #include "components/proximity_auth/wire_message.h" | 9 #include "components/proximity_auth/wire_message.h" |
10 | 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 } | 47 } |
48 | 48 |
49 void Connection::SetStatus(Status status) { | 49 void Connection::SetStatus(Status status) { |
50 if (status_ == status) | 50 if (status_ == status) |
51 return; | 51 return; |
52 | 52 |
53 received_bytes_.clear(); | 53 received_bytes_.clear(); |
54 | 54 |
55 Status old_status = status_; | 55 Status old_status = status_; |
56 status_ = status; | 56 status_ = status; |
57 FOR_EACH_OBSERVER(ConnectionObserver, | 57 FOR_EACH_OBSERVER(ConnectionObserver, observers_, |
58 observers_, | 58 OnConnectionStatusChanged(this, old_status, status_)); |
59 OnConnectionStatusChanged(*this, old_status, status_)); | |
60 } | 59 } |
61 | 60 |
62 void Connection::OnDidSendMessage(const WireMessage& message, bool success) { | 61 void Connection::OnDidSendMessage(const WireMessage& message, bool success) { |
63 if (!is_sending_message_) { | 62 if (!is_sending_message_) { |
64 VLOG(1) << "Send completed, but no message in progress."; | 63 VLOG(1) << "Send completed, but no message in progress."; |
65 return; | 64 return; |
66 } | 65 } |
67 | 66 |
68 is_sending_message_ = false; | 67 is_sending_message_ = false; |
69 FOR_EACH_OBSERVER( | 68 FOR_EACH_OBSERVER( |
(...skipping 23 matching lines...) Expand all Loading... |
93 // |received_bytes_| buffer. | 92 // |received_bytes_| buffer. |
94 received_bytes_.clear(); | 93 received_bytes_.clear(); |
95 } | 94 } |
96 | 95 |
97 scoped_ptr<WireMessage> Connection::DeserializeWireMessage( | 96 scoped_ptr<WireMessage> Connection::DeserializeWireMessage( |
98 bool* is_incomplete_message) { | 97 bool* is_incomplete_message) { |
99 return WireMessage::Deserialize(received_bytes_, is_incomplete_message); | 98 return WireMessage::Deserialize(received_bytes_, is_incomplete_message); |
100 } | 99 } |
101 | 100 |
102 } // namespace proximity_auth | 101 } // namespace proximity_auth |
OLD | NEW |