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 #ifndef COMPONENTS_PROXIMITY_AUTH_CONNECTION_H | 5 #ifndef COMPONENTS_PROXIMITY_AUTH_CONNECTION_H |
6 #define COMPONENTS_PROXIMITY_AUTH_CONNECTION_H | 6 #define COMPONENTS_PROXIMITY_AUTH_CONNECTION_H |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
78 virtual void SendMessageImpl(scoped_ptr<WireMessage> message) = 0; | 78 virtual void SendMessageImpl(scoped_ptr<WireMessage> message) = 0; |
79 | 79 |
80 // Deserializes the |recieved_bytes_| and returns the resulting WireMessage, | 80 // Deserializes the |recieved_bytes_| and returns the resulting WireMessage, |
81 // or NULL if the message is malformed. Sets |is_incomplete_message| to true | 81 // or NULL if the message is malformed. Sets |is_incomplete_message| to true |
82 // if the |serialized_message| does not have enough data to parse the header, | 82 // if the |serialized_message| does not have enough data to parse the header, |
83 // or if the message length encoded in the message header exceeds the size of | 83 // or if the message length encoded in the message header exceeds the size of |
84 // the |serialized_message|. Exposed for testing. | 84 // the |serialized_message|. Exposed for testing. |
85 virtual scoped_ptr<WireMessage> DeserializeWireMessage( | 85 virtual scoped_ptr<WireMessage> DeserializeWireMessage( |
86 bool* is_incomplete_message); | 86 bool* is_incomplete_message); |
87 | 87 |
88 // Exposed so it is possible to override DeserializeWireMessage in | |
89 // BluetoothLowEnergyConnection, while mantaining the same functionality. | |
90 // TODO(sacomoto): remove this when FakeWireMessage is not need anymore. | |
91 std::string received_bytes() { return received_bytes_; } | |
msarda
2015/05/05 11:56:15
s/std::string received_bytes()/const std::string&
sacomoto
2015/05/06 13:47:59
Done.
| |
92 | |
88 private: | 93 private: |
89 // The remote device corresponding to this connection. | 94 // The remote device corresponding to this connection. |
90 const RemoteDevice remote_device_; | 95 const RemoteDevice remote_device_; |
91 | 96 |
92 // The current status of the connection. | 97 // The current status of the connection. |
93 Status status_; | 98 Status status_; |
94 | 99 |
95 // The registered observers of the connection. | 100 // The registered observers of the connection. |
96 ObserverList<ConnectionObserver> observers_; | 101 ObserverList<ConnectionObserver> observers_; |
97 | 102 |
98 // A temporary buffer storing bytes received before a received message can be | 103 // A temporary buffer storing bytes received before a received message can be |
99 // fully constructed. | 104 // fully constructed. |
100 std::string received_bytes_; | 105 std::string received_bytes_; |
101 | 106 |
102 // Whether a message is currently in the process of being sent. | 107 // Whether a message is currently in the process of being sent. |
103 bool is_sending_message_; | 108 bool is_sending_message_; |
104 | 109 |
105 DISALLOW_COPY_AND_ASSIGN(Connection); | 110 DISALLOW_COPY_AND_ASSIGN(Connection); |
106 }; | 111 }; |
107 | 112 |
108 } // namespace proximity_auth | 113 } // namespace proximity_auth |
109 | 114 |
110 #endif // COMPONENTS_PROXIMITY_AUTH_CONNECTION_H | 115 #endif // COMPONENTS_PROXIMITY_AUTH_CONNECTION_H |
OLD | NEW |