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/copresence_sockets/public/copresence_peer.h" | 5 #include "components/copresence_sockets/public/copresence_peer.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 base::RandGenerator(UINT16_MAX), | 34 base::RandGenerator(UINT16_MAX), |
35 base::RandGenerator(static_cast<uint64>(UINT16_MAX) + UINT32_MAX))); | 35 base::RandGenerator(static_cast<uint64>(UINT16_MAX) + UINT32_MAX))); |
36 } | 36 } |
37 | 37 |
38 // This class will confirm pairing for a device that is expecting a pairing | 38 // This class will confirm pairing for a device that is expecting a pairing |
39 // confirmation. | 39 // confirmation. |
40 class DefaultApprovalDelegate | 40 class DefaultApprovalDelegate |
41 : public device::BluetoothDevice::PairingDelegate { | 41 : public device::BluetoothDevice::PairingDelegate { |
42 public: | 42 public: |
43 DefaultApprovalDelegate() {} | 43 DefaultApprovalDelegate() {} |
44 virtual ~DefaultApprovalDelegate() {} | 44 ~DefaultApprovalDelegate() override {} |
45 | 45 |
46 // device::BluetoothDevice::PairingDelegate overrides: | 46 // device::BluetoothDevice::PairingDelegate overrides: |
47 virtual void RequestPinCode(device::BluetoothDevice* device) override {} | 47 void RequestPinCode(device::BluetoothDevice* device) override {} |
48 virtual void RequestPasskey(device::BluetoothDevice* device) override {} | 48 void RequestPasskey(device::BluetoothDevice* device) override {} |
49 virtual void DisplayPinCode(device::BluetoothDevice* device, | 49 void DisplayPinCode(device::BluetoothDevice* device, |
50 const std::string& pincode) override {} | 50 const std::string& pincode) override {} |
51 virtual void DisplayPasskey(device::BluetoothDevice* device, | 51 void DisplayPasskey(device::BluetoothDevice* device, |
52 uint32 passkey) override {} | 52 uint32 passkey) override {} |
53 virtual void KeysEntered(device::BluetoothDevice* device, | 53 void KeysEntered(device::BluetoothDevice* device, uint32 entered) override {} |
54 uint32 entered) override {} | 54 void ConfirmPasskey(device::BluetoothDevice* device, |
55 virtual void ConfirmPasskey(device::BluetoothDevice* device, | 55 uint32 passkey) override {} |
56 uint32 passkey) override {} | 56 void AuthorizePairing(device::BluetoothDevice* device) override { |
57 virtual void AuthorizePairing(device::BluetoothDevice* device) override { | |
58 if (device->ExpectingConfirmation()) | 57 if (device->ExpectingConfirmation()) |
59 device->ConfirmPairing(); | 58 device->ConfirmPairing(); |
60 } | 59 } |
61 }; | 60 }; |
62 | 61 |
63 } // namespace | 62 } // namespace |
64 | 63 |
65 namespace copresence_sockets { | 64 namespace copresence_sockets { |
66 | 65 |
67 CopresencePeer::CopresencePeer(const CreatePeerCallback& create_callback, | 66 CopresencePeer::CopresencePeer(const CreatePeerCallback& create_callback, |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 if (!socket.get()) | 147 if (!socket.get()) |
149 return; | 148 return; |
150 accept_callback_.Run(make_scoped_ptr(new CopresenceSocketBluetooth(socket))); | 149 accept_callback_.Run(make_scoped_ptr(new CopresenceSocketBluetooth(socket))); |
151 } | 150 } |
152 | 151 |
153 void CopresencePeer::OnAcceptError(const std::string& message) { | 152 void CopresencePeer::OnAcceptError(const std::string& message) { |
154 LOG(WARNING) << "Couldn't accept Bluetooth connection: " << message; | 153 LOG(WARNING) << "Couldn't accept Bluetooth connection: " << message; |
155 } | 154 } |
156 | 155 |
157 } // namespace copresence_sockets | 156 } // namespace copresence_sockets |
OLD | NEW |