[floc] change the API return type to Promise<InterestCohort>
Create InterestCohort mojom struct to hold the interest cohort to be
sent in IPC. Create InterestCohort dictionary IDL and use it as the
promise resolved type.
This aligns with the spec:
https://wicg.github.io/floc/#dictdef-interestcohort
Bug: 1175637
Change-Id: I1f604e7ae8d8954b836c6c58766c5be14e2d39d7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2681445
Reviewed-by: Daniel Cheng <[email protected]>
Reviewed-by: Josh Karlin <[email protected]>
Reviewed-by: Avi Drissman <[email protected]>
Commit-Queue: Yao Xiao <[email protected]>
Cr-Commit-Position: refs/heads/master@{#857262}
diff --git a/components/federated_learning/floc_id.h b/components/federated_learning/floc_id.h
index 1c9c2c2b..e0451d6 100644
--- a/components/federated_learning/floc_id.h
+++ b/components/federated_learning/floc_id.h
@@ -9,6 +9,7 @@
#include "base/time/time.h"
#include "base/version.h"
#include "components/prefs/prefs_export.h"
+#include "third_party/blink/public/mojom/federated_learning/floc.mojom-forward.h"
#include <stdint.h>
@@ -54,10 +55,11 @@
// fresh profile prefs.
bool IsValid() const;
- // Dot-separated string of floc, finch config version, and sorting-lsh
- // version. This is the format to be exposed to the JS API. Precondition:
- // |id_| must be valid.
- std::string ToStringForJsApi() const;
+ // Get the blink::mojom::InterestCohort representation of this floc, with
+ // interest_cohort.id being "<id>" and interest_cohort.version being
+ // "chrome.<finch_config_version>.<sorting_lsh_version>". This is the format
+ // to be exposed to the JS API. Precondition: |id_| must be valid.
+ blink::mojom::InterestCohortPtr ToInterestCohortForJsApi() const;
// Returns the internal uint64_t number. Precondition: |id_| must be valid.
uint64_t ToUint64() const;