Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: components/proximity_auth/connection.h

Issue 1251843002: Using WireMessage instead of FakeWireMessage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing notification issue Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/proximity_auth/ble/proximity_auth_ble_system.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 virtual void SendMessageImpl(scoped_ptr<WireMessage> message) = 0; 79 virtual void SendMessageImpl(scoped_ptr<WireMessage> message) = 0;
80 80
81 // Deserializes the |recieved_bytes_| and returns the resulting WireMessage, 81 // Deserializes the |recieved_bytes_| and returns the resulting WireMessage,
82 // or NULL if the message is malformed. Sets |is_incomplete_message| to true 82 // or NULL if the message is malformed. Sets |is_incomplete_message| to true
83 // if the |serialized_message| does not have enough data to parse the header, 83 // if the |serialized_message| does not have enough data to parse the header,
84 // or if the message length encoded in the message header exceeds the size of 84 // or if the message length encoded in the message header exceeds the size of
85 // the |serialized_message|. Exposed for testing. 85 // the |serialized_message|. Exposed for testing.
86 virtual scoped_ptr<WireMessage> DeserializeWireMessage( 86 virtual scoped_ptr<WireMessage> DeserializeWireMessage(
87 bool* is_incomplete_message); 87 bool* is_incomplete_message);
88 88
89 // Exposed so it is possible to override DeserializeWireMessage in
90 // BluetoothLowEnergyConnection class, while mantaining the same
91 // functionality.
92 // TODO(sacomoto): remove this when FakeWireMessage is not needed anymore.
93 const std::string& received_bytes() { return received_bytes_; }
94
95 private: 89 private:
96 // The remote device corresponding to this connection. 90 // The remote device corresponding to this connection.
97 const RemoteDevice remote_device_; 91 const RemoteDevice remote_device_;
98 92
99 // The current status of the connection. 93 // The current status of the connection.
100 Status status_; 94 Status status_;
101 95
102 // The registered observers of the connection. 96 // The registered observers of the connection.
103 base::ObserverList<ConnectionObserver> observers_; 97 base::ObserverList<ConnectionObserver> observers_;
104 98
105 // A temporary buffer storing bytes received before a received message can be 99 // A temporary buffer storing bytes received before a received message can be
106 // fully constructed. 100 // fully constructed.
107 std::string received_bytes_; 101 std::string received_bytes_;
108 102
109 // Whether a message is currently in the process of being sent. 103 // Whether a message is currently in the process of being sent.
110 bool is_sending_message_; 104 bool is_sending_message_;
111 105
112 DISALLOW_COPY_AND_ASSIGN(Connection); 106 DISALLOW_COPY_AND_ASSIGN(Connection);
113 }; 107 };
114 108
115 } // namespace proximity_auth 109 } // namespace proximity_auth
116 110
117 #endif // COMPONENTS_PROXIMITY_AUTH_CONNECTION_H 111 #endif // COMPONENTS_PROXIMITY_AUTH_CONNECTION_H
OLDNEW
« no previous file with comments | « components/proximity_auth/ble/proximity_auth_ble_system.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698