-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Browsing Data Model] Adds Attribution Reporting interface
Exposes Get and Remove methods in a new public interface for Attribution Reporting. Next step is implementing the interface. See crrev.com/c/4026870 for reference. Bug: 1407369 Change-Id: Id5505f54014a4a698a5ca6989ed0564f6227b0ec Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4166234 Reviewed-by: Nan Lin <linnan@chromium.org> Reviewed-by: Andrew Paseltiner <apaseltiner@chromium.org> Commit-Queue: Mariam Ali <alimariam@google.com> Reviewed-by: Avi Drissman <avi@chromium.org> Cr-Commit-Position: refs/heads/main@{#1096090}
- Loading branch information
1 parent
1540cdc
commit 93a252e
Showing
12 changed files
with
169 additions
and
2 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright 2023 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "content/public/browser/attribution_data_model.h" | ||
|
||
#include <tuple> | ||
#include <utility> | ||
|
||
#include "base/check.h" | ||
#include "third_party/abseil-cpp/absl/types/optional.h" | ||
#include "url/origin.h" | ||
|
||
namespace content { | ||
|
||
AttributionDataModel::DataKey::DataKey( | ||
url::Origin reporting_origin, | ||
absl::optional<url::Origin> source_origin, | ||
absl::optional<url::Origin> destination_origin) | ||
: reporting_origin_(std::move(reporting_origin)), | ||
source_origin_(std::move(source_origin)), | ||
destination_origin_(std::move(destination_origin)) { | ||
DCHECK(!reporting_origin_.opaque()); | ||
|
||
DCHECK(!source_origin_.has_value() || !source_origin_->opaque()); | ||
|
||
DCHECK(!destination_origin_.has_value() || !destination_origin_->opaque()); | ||
} | ||
|
||
AttributionDataModel::DataKey::DataKey(const DataKey&) = default; | ||
|
||
AttributionDataModel::DataKey::DataKey(DataKey&&) = default; | ||
|
||
AttributionDataModel::DataKey& AttributionDataModel::DataKey::operator=( | ||
const DataKey&) = default; | ||
|
||
AttributionDataModel::DataKey& AttributionDataModel::DataKey::operator=( | ||
DataKey&&) = default; | ||
|
||
AttributionDataModel::DataKey::~DataKey() = default; | ||
|
||
bool AttributionDataModel::DataKey::operator<( | ||
const AttributionDataModel::DataKey& other) const { | ||
return std::tie(reporting_origin_, source_origin_, destination_origin_) < | ||
std::tie(other.reporting_origin_, other.source_origin_, | ||
other.destination_origin_); | ||
} | ||
|
||
} // namespace content |
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,64 @@ | ||
// Copyright 2023 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef CONTENT_PUBLIC_BROWSER_ATTRIBUTION_DATA_MODEL_H_ | ||
#define CONTENT_PUBLIC_BROWSER_ATTRIBUTION_DATA_MODEL_H_ | ||
|
||
#include <vector> | ||
|
||
#include "base/functional/callback_forward.h" | ||
#include "content/common/content_export.h" | ||
#include "third_party/abseil-cpp/absl/types/optional.h" | ||
#include "url/origin.h" | ||
|
||
namespace content { | ||
|
||
class CONTENT_EXPORT AttributionDataModel { | ||
public: | ||
class DataKey { | ||
public: | ||
DataKey(url::Origin reporting_origin, | ||
absl::optional<url::Origin> source_origin, | ||
absl::optional<url::Origin> destination_origin); | ||
|
||
DataKey(const DataKey&); | ||
DataKey(DataKey&&); | ||
|
||
DataKey& operator=(const DataKey&); | ||
DataKey& operator=(DataKey&&); | ||
|
||
~DataKey(); | ||
|
||
const url::Origin& reporting_origin() const { return reporting_origin_; } | ||
|
||
const absl::optional<url::Origin>& source_origin() const { | ||
return source_origin_; | ||
} | ||
|
||
const absl::optional<url::Origin>& destination_origin() const { | ||
return destination_origin_; | ||
} | ||
|
||
bool operator<(const DataKey&) const; | ||
|
||
private: | ||
url::Origin reporting_origin_; | ||
|
||
absl::optional<url::Origin> source_origin_; | ||
|
||
absl::optional<url::Origin> destination_origin_; | ||
}; | ||
|
||
virtual ~AttributionDataModel() = default; | ||
|
||
virtual void GetAllDataKeys( | ||
base::OnceCallback<void(std::vector<DataKey>)> callback) = 0; | ||
|
||
virtual void RemoveAttributionDataByDataKey(const DataKey& data_key, | ||
base::OnceClosure callback) = 0; | ||
}; | ||
|
||
} // namespace content | ||
|
||
#endif // CONTENT_PUBLIC_BROWSER_ATTRIBUTION_DATA_MODEL_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