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

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

Issue 2560713002: Move RemoteDevice from //components/proximity_auth to //components/cryptauth so that it can be easi… (Closed)
Patch Set: Add cryptauth dependency. Created 4 years 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
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 #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
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
OLDNEW
« no previous file with comments | « components/proximity_auth/connection.h ('k') | components/proximity_auth/connection_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698