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

Side by Side Diff: components/cryptauth/ble/bluetooth_low_energy_weave_client_connection.cc

Issue 2697763002: [CrOS Tether]: Create BleConnectionManager, which manages secure connections between the current de… (Closed)
Patch Set: Created 3 years, 10 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/cryptauth/ble/bluetooth_low_energy_weave_client_connection. h" 5 #include "components/cryptauth/ble/bluetooth_low_energy_weave_client_connection. h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 25 matching lines...) Expand all
36 const int kMaxNumberOfRetryAttempts = 2; 36 const int kMaxNumberOfRetryAttempts = 2;
37 37
38 } // namespace 38 } // namespace
39 39
40 // static 40 // static
41 std::shared_ptr<BluetoothLowEnergyWeaveClientConnection::Factory> 41 std::shared_ptr<BluetoothLowEnergyWeaveClientConnection::Factory>
42 BluetoothLowEnergyWeaveClientConnection::Factory::factory_instance_ = 42 BluetoothLowEnergyWeaveClientConnection::Factory::factory_instance_ =
43 nullptr; 43 nullptr;
44 44
45 // static 45 // static
46 std::unique_ptr<BluetoothLowEnergyWeaveClientConnection> 46 std::unique_ptr<Connection>
Ryan Hansberry 2017/02/14 18:27:28 Why did you change this? It doesn't really make se
Kyle Horimoto 2017/02/14 22:54:46 We need the factory to return |FakeConnection|s in
Ryan Hansberry 2017/02/16 19:29:35 Oh man, lame. If Connection had a factory that thi
47 BluetoothLowEnergyWeaveClientConnection::Factory::NewInstance( 47 BluetoothLowEnergyWeaveClientConnection::Factory::NewInstance(
48 const RemoteDevice& remote_device, 48 const RemoteDevice& remote_device,
49 const std::string& device_address, 49 const std::string& device_address,
50 scoped_refptr<device::BluetoothAdapter> adapter, 50 scoped_refptr<device::BluetoothAdapter> adapter,
51 const device::BluetoothUUID remote_service_uuid, 51 const device::BluetoothUUID remote_service_uuid,
52 BluetoothThrottler* bluetooth_throttler) { 52 BluetoothThrottler* bluetooth_throttler) {
53 if (!factory_instance_) { 53 if (!factory_instance_) {
54 factory_instance_.reset(new Factory()); 54 factory_instance_.reset(new Factory());
55 } 55 }
56 return factory_instance_->BuildInstance( 56 return factory_instance_->BuildInstance(
57 remote_device, 57 remote_device,
58 device_address, 58 device_address,
59 adapter, 59 adapter,
60 remote_service_uuid, 60 remote_service_uuid,
61 bluetooth_throttler); 61 bluetooth_throttler);
62 } 62 }
63 63
64 // static 64 // static
65 void BluetoothLowEnergyWeaveClientConnection::Factory::SetInstanceForTesting( 65 void BluetoothLowEnergyWeaveClientConnection::Factory::SetInstanceForTesting(
66 std::shared_ptr<Factory> factory) { 66 std::shared_ptr<Factory> factory) {
67 factory_instance_ = factory; 67 factory_instance_ = factory;
68 } 68 }
69 69
70 std::unique_ptr<BluetoothLowEnergyWeaveClientConnection> 70 std::unique_ptr<Connection>
71 BluetoothLowEnergyWeaveClientConnection::Factory::BuildInstance( 71 BluetoothLowEnergyWeaveClientConnection::Factory::BuildInstance(
72 const RemoteDevice& remote_device, 72 const RemoteDevice& remote_device,
73 const std::string& device_address, 73 const std::string& device_address,
74 scoped_refptr<device::BluetoothAdapter> adapter, 74 scoped_refptr<device::BluetoothAdapter> adapter,
75 const device::BluetoothUUID remote_service_uuid, 75 const device::BluetoothUUID remote_service_uuid,
76 BluetoothThrottler* bluetooth_throttler) { 76 BluetoothThrottler* bluetooth_throttler) {
77 return base::MakeUnique<BluetoothLowEnergyWeaveClientConnection>( 77 return base::MakeUnique<BluetoothLowEnergyWeaveClientConnection>(
78 remote_device, device_address, adapter, remote_service_uuid, 78 remote_device, device_address, adapter, remote_service_uuid,
79 bluetooth_throttler); 79 bluetooth_throttler);
80 } 80 }
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 number_of_failed_attempts(0) {} 666 number_of_failed_attempts(0) {}
667 667
668 BluetoothLowEnergyWeaveClientConnection::WriteRequest::WriteRequest( 668 BluetoothLowEnergyWeaveClientConnection::WriteRequest::WriteRequest(
669 const WriteRequest& other) = default; 669 const WriteRequest& other) = default;
670 670
671 BluetoothLowEnergyWeaveClientConnection::WriteRequest::~WriteRequest() {} 671 BluetoothLowEnergyWeaveClientConnection::WriteRequest::~WriteRequest() {}
672 672
673 } // namespace weave 673 } // namespace weave
674 674
675 } // namespace cryptauth 675 } // namespace cryptauth
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698