blob: 74944cd8f035573dc5d9d39b3c376853eaac7043 [file] [log] [blame]
Nan Linf3bfc362022-12-06 21:50:391// Copyright 2022 The Chromium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "components/aggregation_service/parsing_utils.h"
6
Andrew Paseltiner66decaf2022-12-07 20:41:247#include <string>
8
Nan Linf3bfc362022-12-06 21:50:399#include "components/aggregation_service/aggregation_service.mojom.h"
10#include "third_party/abseil-cpp/absl/types/optional.h"
11
12namespace aggregation_service {
13
Andrew Paseltiner66decaf2022-12-07 20:41:2414namespace {
15constexpr char kAwsCloud[] = "aws-cloud";
16} // namespace
17
Nan Linf3bfc362022-12-06 21:50:3918absl::optional<mojom::AggregationCoordinator> ParseAggregationCoordinator(
19 const std::string& str) {
Andrew Paseltiner66decaf2022-12-07 20:41:2420 if (str == kAwsCloud)
Nan Linf3bfc362022-12-06 21:50:3921 return mojom::AggregationCoordinator::kAwsCloud;
22
23 return absl::nullopt;
24}
25
Andrew Paseltiner66decaf2022-12-07 20:41:2426std::string SerializeAggregationCoordinator(
27 mojom::AggregationCoordinator coordinator) {
28 switch (coordinator) {
29 case mojom::AggregationCoordinator::kAwsCloud:
30 return kAwsCloud;
31 }
32}
33
Nan Linf3bfc362022-12-06 21:50:3934} // namespace aggregation_service