-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move AttributionAggregationKeys to components/attribution_reporting
In preparation for moving all related JSON parsing to that directory. Bug: 1379009 Change-Id: Ic03f0b1419ac34d57d59c475c75e456e3660952a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4001889 Reviewed-by: Nan Lin <linnan@chromium.org> Reviewed-by: Alex Moshchuk <alexmos@chromium.org> Quick-Run: Andrew Paseltiner <apaseltiner@chromium.org> Commit-Queue: Andrew Paseltiner <apaseltiner@chromium.org> Cr-Commit-Position: refs/heads/main@{#1067673}
- Loading branch information
Andrew Paseltiner
authored and
Chromium LUCI CQ
committed
Nov 4, 2022
1 parent
8e3088a
commit a652a71
Showing
26 changed files
with
201 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// Copyright 2022 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef COMPONENTS_ATTRIBUTION_REPORTING_AGGREGATION_KEYS_H_ | ||
#define COMPONENTS_ATTRIBUTION_REPORTING_AGGREGATION_KEYS_H_ | ||
|
||
#include <string> | ||
|
||
#include "base/component_export.h" | ||
#include "base/containers/flat_map.h" | ||
#include "base/types/expected.h" | ||
#include "components/attribution_reporting/source_registration_error.mojom-forward.h" | ||
#include "third_party/abseil-cpp/absl/numeric/int128.h" | ||
#include "third_party/abseil-cpp/absl/types/optional.h" | ||
|
||
namespace base { | ||
class Value; | ||
} // namespace base | ||
|
||
namespace attribution_reporting { | ||
|
||
class COMPONENT_EXPORT(ATTRIBUTION_REPORTING) AggregationKeys { | ||
public: | ||
using Keys = base::flat_map<std::string, absl::uint128>; | ||
|
||
// Returns `absl::nullopt` if `keys` is invalid. | ||
static absl::optional<AggregationKeys> FromKeys(Keys keys); | ||
|
||
static base::expected<AggregationKeys, mojom::SourceRegistrationError> | ||
FromJSON(const base::Value*); | ||
|
||
AggregationKeys(); | ||
~AggregationKeys(); | ||
|
||
AggregationKeys(const AggregationKeys&); | ||
AggregationKeys(AggregationKeys&&); | ||
|
||
AggregationKeys& operator=(const AggregationKeys&); | ||
AggregationKeys& operator=(AggregationKeys&&); | ||
|
||
const Keys& keys() const { return keys_; } | ||
|
||
private: | ||
explicit AggregationKeys(Keys keys); | ||
|
||
Keys keys_; | ||
}; | ||
|
||
} // namespace attribution_reporting | ||
|
||
#endif // COMPONENTS_ATTRIBUTION_REPORTING_AGGREGATION_KEYS_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright 2022 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "components/attribution_reporting/test_utils.h" | ||
|
||
#include <ostream> | ||
|
||
#include "components/attribution_reporting/aggregation_keys.h" | ||
|
||
namespace attribution_reporting { | ||
|
||
bool operator==(const AggregationKeys& a, const AggregationKeys& b) { | ||
return a.keys() == b.keys(); | ||
} | ||
|
||
std::ostream& operator<<(std::ostream& out, | ||
const AggregationKeys& aggregation_keys) { | ||
out << "{"; | ||
|
||
const char* separator = ""; | ||
for (const auto& [key_id, key] : aggregation_keys.keys()) { | ||
out << separator << key_id << ":" << key; | ||
separator = ", "; | ||
} | ||
return out << "}"; | ||
} | ||
|
||
} // namespace attribution_reporting |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright 2022 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef COMPONENTS_ATTRIBUTION_REPORTING_TEST_UTILS_H_ | ||
#define COMPONENTS_ATTRIBUTION_REPORTING_TEST_UTILS_H_ | ||
|
||
#include <ostream> | ||
|
||
namespace attribution_reporting { | ||
|
||
class AggregationKeys; | ||
|
||
bool operator==(const AggregationKeys&, const AggregationKeys&); | ||
|
||
std::ostream& operator<<(std::ostream&, const AggregationKeys&); | ||
|
||
} // namespace attribution_reporting | ||
|
||
#endif // COMPONENTS_ATTRIBUTION_REPORTING_TEST_UTILS_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 0 additions & 53 deletions
53
content/browser/attribution_reporting/attribution_aggregation_keys.h
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.