| Index: components/cryptauth/foreground_eid_generator.h
|
| diff --git a/components/cryptauth/foreground_eid_generator.h b/components/cryptauth/foreground_eid_generator.h
|
| index 8068078c5e05f9df29c4a3d19645ac0dc30ae9e6..aa7fe24aa493a3be62de8e7ad22fc007a569fd99 100644
|
| --- a/components/cryptauth/foreground_eid_generator.h
|
| +++ b/components/cryptauth/foreground_eid_generator.h
|
| @@ -12,6 +12,7 @@
|
| #include "base/gtest_prod_util.h"
|
| #include "base/macros.h"
|
| #include "base/time/clock.h"
|
| +#include "components/cryptauth/eid_data_with_timestamp.h"
|
|
|
| namespace cryptauth {
|
|
|
| @@ -40,22 +41,6 @@ struct RemoteDevice;
|
| // See go/proximity-auth-ble-advertising.
|
| class ForegroundEidGenerator {
|
| public:
|
| - // Stores EID-related data and timestamps at which time this data becomes
|
| - // active or inactive.
|
| - struct DataWithTimestamp {
|
| - DataWithTimestamp(const std::string& data,
|
| - const int64_t start_timestamp_ms,
|
| - const int64_t end_timestamp_ms);
|
| - DataWithTimestamp(const DataWithTimestamp& other);
|
| -
|
| - bool ContainsTime(const int64_t timestamp_ms) const;
|
| - std::string DataInHex() const;
|
| -
|
| - const std::string data;
|
| - const int64_t start_timestamp_ms;
|
| - const int64_t end_timestamp_ms;
|
| - };
|
| -
|
| // Data for both a current and adjacent EID. The current EID *must* be
|
| // supplied, but adjacent data may be null. Each EID consists of a 2-byte EID
|
| // value paired with the timestamp at which time this value becomes active or
|
| @@ -63,15 +48,15 @@ class ForegroundEidGenerator {
|
| struct EidData {
|
| enum AdjacentDataType { NONE, PAST, FUTURE };
|
|
|
| - EidData(const DataWithTimestamp current_data,
|
| - std::unique_ptr<DataWithTimestamp> adjacent_data);
|
| + EidData(const EidDataWithTimestamp current_data,
|
| + std::unique_ptr<EidDataWithTimestamp> adjacent_data);
|
| ~EidData();
|
|
|
| AdjacentDataType GetAdjacentDataType() const;
|
| std::string DataInHex() const;
|
|
|
| - const DataWithTimestamp current_data;
|
| - const std::unique_ptr<DataWithTimestamp> adjacent_data;
|
| + const EidDataWithTimestamp current_data;
|
| + const std::unique_ptr<EidDataWithTimestamp> adjacent_data;
|
| };
|
|
|
| // The flag used to denote that a Bluetooth 4.0 device has sent an
|
| @@ -84,8 +69,8 @@ class ForegroundEidGenerator {
|
| virtual ~ForegroundEidGenerator();
|
|
|
| // Generates EID data for the given EID seeds to be used as a background scan
|
| - // filter. In the normal case, two DataWithTimestamp values are returned, one
|
| - // for each EID seed rotation period. If data has not been synced from the
|
| + // filter. In the normal case, two EidDataWithTimestamp values are returned,
|
| + // one for each EID seed rotation period. If data has not been synced from the
|
| // backend recently and EID seeds are unavailable, nullptr is returned.
|
| virtual std::unique_ptr<EidData> GenerateBackgroundScanFilter(
|
| const std::vector<BeaconSeed>& scanning_device_beacon_seeds) const;
|
| @@ -93,7 +78,7 @@ class ForegroundEidGenerator {
|
| // Generates advertisement data for the given EID seeds. If data has not been
|
| // synced from the back-end recently and EID seeds are unavailable, nullptr is
|
| // returned.
|
| - virtual std::unique_ptr<DataWithTimestamp> GenerateAdvertisement(
|
| + virtual std::unique_ptr<EidDataWithTimestamp> GenerateAdvertisement(
|
| const std::string& advertising_device_public_key,
|
| const std::vector<BeaconSeed>& scanning_device_beacon_seeds) const;
|
|
|
| @@ -125,18 +110,18 @@ class ForegroundEidGenerator {
|
| ForegroundEidGenerator(std::unique_ptr<RawEidGenerator> raw_eid_generator,
|
| std::unique_ptr<base::Clock> clock);
|
|
|
| - std::unique_ptr<DataWithTimestamp> GenerateAdvertisement(
|
| + std::unique_ptr<EidDataWithTimestamp> GenerateAdvertisement(
|
| const std::string& advertising_device_public_key,
|
| const std::vector<BeaconSeed>& scanning_device_beacon_seeds,
|
| const int64_t start_of_period_timestamp_ms,
|
| const int64_t end_of_period_timestamp_ms) const;
|
|
|
| - std::unique_ptr<DataWithTimestamp> GenerateEidDataWithTimestamp(
|
| + std::unique_ptr<EidDataWithTimestamp> GenerateEidEidDataWithTimestamp(
|
| const std::vector<BeaconSeed>& scanning_device_beacon_seeds,
|
| const int64_t start_of_period_timestamp_ms,
|
| const int64_t end_of_period_timestamp_ms) const;
|
|
|
| - std::unique_ptr<DataWithTimestamp> GenerateEidDataWithTimestamp(
|
| + std::unique_ptr<EidDataWithTimestamp> GenerateEidEidDataWithTimestamp(
|
| const std::vector<BeaconSeed>& scanning_device_beacon_seeds,
|
| const int64_t start_of_period_timestamp_ms,
|
| const int64_t end_of_period_timestamp_ms,
|
|
|