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

Unified Diff: components/cryptauth/data_with_timestamp.h

Issue 2847233003: [EasyUnlock] Move DataWithTimestamp out of ForegroundEidGenerator so it can be shared. (Closed)
Patch Set: fixes Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: components/cryptauth/data_with_timestamp.h
diff --git a/components/cryptauth/data_with_timestamp.h b/components/cryptauth/data_with_timestamp.h
new file mode 100644
index 0000000000000000000000000000000000000000..f4e36a671bc2d19516a559376b7b6b28a2de244e
--- /dev/null
+++ b/components/cryptauth/data_with_timestamp.h
@@ -0,0 +1,43 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_CRYPTAUTH_BLE_DATA_WITH_TIMESTAMP_H_
+#define COMPONENTS_CRYPTAUTH_BLE_DATA_WITH_TIMESTAMP_H_
+
+#include <string>
+#include <vector>
+
+namespace cryptauth {
+
+// 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);
+
+ // Helper function to convert a vector of DataWithTimestamp objects to a human
+ // readable debug string.
+ static std::string ToDebugString(
+ const std::vector<DataWithTimestamp>& data_with_timestamps);
+
+ bool ContainsTime(const int64_t timestamp_ms) const;
+ std::string DataInHex() const;
+
+ bool operator==(const DataWithTimestamp& other) const;
+
+ // The data valid for a given time period.
+ const std::string data;
+
+ // The start time for which the data is valid, inclusive.
+ const int64_t start_timestamp_ms;
+
+ // The end time for which the data is valid, exclusive.
+ const int64_t end_timestamp_ms;
+};
+
+} // namespace
+
+#endif // COMPONENTS_CRYPTAUTH_BLE_DATA_WITH_TIMESTAMP_H_
« no previous file with comments | « components/cryptauth/background_eid_generator_unittest.cc ('k') | components/cryptauth/data_with_timestamp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698