forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename AttributionAggregatableSources to AttributionAggregatableSource
Also renamed the "sources" field to "keys" to make it clear that a single event encodes many keys, rather than many different sources. Also renamed the data structures on browser side. Bug: 1293037 Change-Id: Ic11bd8223be082f2f1faafaee69ae7f77d896353 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3507811 Reviewed-by: John Delaney <johnidel@chromium.org> Reviewed-by: Andrew Paseltiner <apaseltiner@chromium.org> Reviewed-by: Robert Sesek <rsesek@chromium.org> Reviewed-by: Nico Weber <thakis@chromium.org> Commit-Queue: Nan Lin <linnan@chromium.org> Cr-Commit-Position: refs/heads/main@{#980815}
- Loading branch information
1 parent
0507d15
commit df06231
Showing
27 changed files
with
298 additions
and
303 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
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
52 changes: 52 additions & 0 deletions
52
content/browser/attribution_reporting/attribution_aggregatable_source.cc
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. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "content/browser/attribution_reporting/attribution_aggregatable_source.h" | ||
|
||
#include <utility> | ||
|
||
#include "base/ranges/algorithm.h" | ||
#include "third_party/abseil-cpp/absl/types/optional.h" | ||
#include "third_party/blink/public/common/attribution_reporting/constants.h" | ||
|
||
namespace content { | ||
|
||
// static | ||
absl::optional<AttributionAggregatableSource> | ||
AttributionAggregatableSource::Create( | ||
proto::AttributionAggregatableSource proto) { | ||
bool is_valid = | ||
proto.keys().size() <= | ||
blink::kMaxAttributionAggregatableKeysPerSourceOrTrigger && | ||
base::ranges::all_of(proto.keys(), [](const auto& key) { | ||
return key.first.size() <= | ||
blink::kMaxBytesPerAttributionAggregatableKeyId && | ||
key.second.has_high_bits() && key.second.has_low_bits(); | ||
}); | ||
return is_valid ? absl::make_optional( | ||
AttributionAggregatableSource(std::move(proto))) | ||
: absl::nullopt; | ||
} | ||
|
||
AttributionAggregatableSource::AttributionAggregatableSource( | ||
proto::AttributionAggregatableSource proto) | ||
: proto_(std::move(proto)) {} | ||
|
||
AttributionAggregatableSource::AttributionAggregatableSource() = default; | ||
|
||
AttributionAggregatableSource::~AttributionAggregatableSource() = default; | ||
|
||
AttributionAggregatableSource::AttributionAggregatableSource( | ||
const AttributionAggregatableSource&) = default; | ||
|
||
AttributionAggregatableSource::AttributionAggregatableSource( | ||
AttributionAggregatableSource&&) = default; | ||
|
||
AttributionAggregatableSource& AttributionAggregatableSource::operator=( | ||
const AttributionAggregatableSource&) = default; | ||
|
||
AttributionAggregatableSource& AttributionAggregatableSource::operator=( | ||
AttributionAggregatableSource&&) = default; | ||
|
||
} // namespace content |
42 changes: 42 additions & 0 deletions
42
content/browser/attribution_reporting/attribution_aggregatable_source.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,42 @@ | ||
// Copyright 2022 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 CONTENT_BROWSER_ATTRIBUTION_REPORTING_ATTRIBUTION_AGGREGATABLE_SOURCE_H_ | ||
#define CONTENT_BROWSER_ATTRIBUTION_REPORTING_ATTRIBUTION_AGGREGATABLE_SOURCE_H_ | ||
|
||
#include "content/browser/attribution_reporting/attribution_reporting.pb.h" | ||
#include "content/common/content_export.h" | ||
#include "third_party/abseil-cpp/absl/types/optional.h" | ||
|
||
namespace content { | ||
|
||
// This is a wrapper of `proto::AttributionAggregatableSource`. | ||
class CONTENT_EXPORT AttributionAggregatableSource { | ||
public: | ||
// Returns `absl::nullopt` if `proto` is invalid. | ||
static absl::optional<AttributionAggregatableSource> Create( | ||
proto::AttributionAggregatableSource proto); | ||
|
||
AttributionAggregatableSource(); | ||
~AttributionAggregatableSource(); | ||
|
||
AttributionAggregatableSource(const AttributionAggregatableSource&); | ||
AttributionAggregatableSource(AttributionAggregatableSource&&); | ||
|
||
AttributionAggregatableSource& operator=( | ||
const AttributionAggregatableSource&); | ||
AttributionAggregatableSource& operator=(AttributionAggregatableSource&&); | ||
|
||
const proto::AttributionAggregatableSource& proto() const { return proto_; } | ||
|
||
private: | ||
explicit AttributionAggregatableSource( | ||
proto::AttributionAggregatableSource proto); | ||
|
||
proto::AttributionAggregatableSource proto_; | ||
}; | ||
|
||
} // namespace content | ||
|
||
#endif // CONTENT_BROWSER_ATTRIBUTION_REPORTING_ATTRIBUTION_AGGREGATABLE_SOURCE_H_ |
52 changes: 0 additions & 52 deletions
52
content/browser/attribution_reporting/attribution_aggregatable_sources.cc
This file was deleted.
Oops, something went wrong.
42 changes: 0 additions & 42 deletions
42
content/browser/attribution_reporting/attribution_aggregatable_sources.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.