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

Side by Side Diff: chromeos/components/tether/ble_advertiser.h

Issue 2951303002: [CrOS Tether] Move LocalDeviceDataProvider from //chromeos/components/tether to //components/crypta… (Closed)
Patch Set: Rebased. Created 3 years, 6 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 | « chromeos/components/tether/BUILD.gn ('k') | chromeos/components/tether/ble_advertiser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef CHROMEOS_COMPONENTS_TETHER_BLE_ADVERTISER_H_ 5 #ifndef CHROMEOS_COMPONENTS_TETHER_BLE_ADVERTISER_H_
6 #define CHROMEOS_COMPONENTS_TETHER_BLE_ADVERTISER_H_ 6 #define CHROMEOS_COMPONENTS_TETHER_BLE_ADVERTISER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "components/cryptauth/foreground_eid_generator.h" 12 #include "components/cryptauth/foreground_eid_generator.h"
13 #include "components/cryptauth/remote_device.h" 13 #include "components/cryptauth/remote_device.h"
14 #include "device/bluetooth/bluetooth_adapter.h" 14 #include "device/bluetooth/bluetooth_adapter.h"
15 #include "device/bluetooth/bluetooth_advertisement.h" 15 #include "device/bluetooth/bluetooth_advertisement.h"
16 16
17 namespace cryptauth { 17 namespace cryptauth {
18 class LocalDeviceDataProvider;
18 class RemoteBeaconSeedFetcher; 19 class RemoteBeaconSeedFetcher;
19 } 20 }
20 21
21 namespace chromeos { 22 namespace chromeos {
22 23
23 namespace tether { 24 namespace tether {
24 25
25 class LocalDeviceDataProvider;
26
27 // Advertises to a given device. When StartAdvertisingToDevice() is called, a 26 // Advertises to a given device. When StartAdvertisingToDevice() is called, a
28 // device-specific EID value is computed deterministically and is set as the 27 // device-specific EID value is computed deterministically and is set as the
29 // service data of the advertisement. If that device is nearby and scanning, 28 // service data of the advertisement. If that device is nearby and scanning,
30 // the device will have the same service data and will be able to pick up the 29 // the device will have the same service data and will be able to pick up the
31 // advertisement. 30 // advertisement.
32 class BleAdvertiser { 31 class BleAdvertiser {
33 public: 32 public:
34 BleAdvertiser( 33 BleAdvertiser(
35 scoped_refptr<device::BluetoothAdapter> adapter, 34 scoped_refptr<device::BluetoothAdapter> adapter,
36 const LocalDeviceDataProvider* local_device_data_provider, 35 const cryptauth::LocalDeviceDataProvider* local_device_data_provider,
37 const cryptauth::RemoteBeaconSeedFetcher* remote_beacon_seed_fetcher); 36 const cryptauth::RemoteBeaconSeedFetcher* remote_beacon_seed_fetcher);
38 virtual ~BleAdvertiser(); 37 virtual ~BleAdvertiser();
39 38
40 virtual bool StartAdvertisingToDevice( 39 virtual bool StartAdvertisingToDevice(
41 const cryptauth::RemoteDevice& remote_device); 40 const cryptauth::RemoteDevice& remote_device);
42 virtual bool StopAdvertisingToDevice( 41 virtual bool StopAdvertisingToDevice(
43 const cryptauth::RemoteDevice& remote_device); 42 const cryptauth::RemoteDevice& remote_device);
44 43
45 private: 44 private:
46 friend class BleAdvertiserTest; 45 friend class BleAdvertiserTest;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 87
89 base::WeakPtrFactory<IndividualAdvertisement> weak_ptr_factory_; 88 base::WeakPtrFactory<IndividualAdvertisement> weak_ptr_factory_;
90 89
91 DISALLOW_COPY_AND_ASSIGN(IndividualAdvertisement); 90 DISALLOW_COPY_AND_ASSIGN(IndividualAdvertisement);
92 }; 91 };
93 92
94 BleAdvertiser( 93 BleAdvertiser(
95 scoped_refptr<device::BluetoothAdapter> adapter, 94 scoped_refptr<device::BluetoothAdapter> adapter,
96 std::unique_ptr<cryptauth::ForegroundEidGenerator> eid_generator, 95 std::unique_ptr<cryptauth::ForegroundEidGenerator> eid_generator,
97 const cryptauth::RemoteBeaconSeedFetcher* remote_beacon_seed_fetcher, 96 const cryptauth::RemoteBeaconSeedFetcher* remote_beacon_seed_fetcher,
98 const LocalDeviceDataProvider* local_device_data_provider); 97 const cryptauth::LocalDeviceDataProvider* local_device_data_provider);
99 98
100 scoped_refptr<device::BluetoothAdapter> adapter_; 99 scoped_refptr<device::BluetoothAdapter> adapter_;
101 100
102 std::unique_ptr<cryptauth::ForegroundEidGenerator> eid_generator_; 101 std::unique_ptr<cryptauth::ForegroundEidGenerator> eid_generator_;
103 // Not owned by this instance and must outlive it. 102 // Not owned by this instance and must outlive it.
104 const cryptauth::RemoteBeaconSeedFetcher* remote_beacon_seed_fetcher_; 103 const cryptauth::RemoteBeaconSeedFetcher* remote_beacon_seed_fetcher_;
105 const LocalDeviceDataProvider* local_device_data_provider_; 104 const cryptauth::LocalDeviceDataProvider* local_device_data_provider_;
106 105
107 std::map<std::string, std::unique_ptr<IndividualAdvertisement>> 106 std::map<std::string, std::unique_ptr<IndividualAdvertisement>>
108 device_id_to_advertisement_map_; 107 device_id_to_advertisement_map_;
109 108
110 DISALLOW_COPY_AND_ASSIGN(BleAdvertiser); 109 DISALLOW_COPY_AND_ASSIGN(BleAdvertiser);
111 }; 110 };
112 111
113 } // namespace tether 112 } // namespace tether
114 113
115 } // namespace chromeos 114 } // namespace chromeos
116 115
117 #endif // CHROMEOS_COMPONENTS_TETHER_BLE_ADVERTISER_H_ 116 #endif // CHROMEOS_COMPONENTS_TETHER_BLE_ADVERTISER_H_
OLDNEW
« no previous file with comments | « chromeos/components/tether/BUILD.gn ('k') | chromeos/components/tether/ble_advertiser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698