File: registration_mojom_traits.h

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (661 lines) | stat: -rw-r--r-- 24,441 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
// 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_REGISTRATION_MOJOM_TRAITS_H_
#define COMPONENTS_ATTRIBUTION_REPORTING_REGISTRATION_MOJOM_TRAITS_H_

#include <stdint.h>

#include <optional>
#include <string>
#include <vector>

#include "base/component_export.h"
#include "base/containers/flat_set.h"
#include "base/time/time.h"
#include "components/attribution_reporting/aggregatable_debug_reporting_config.h"
#include "components/attribution_reporting/aggregatable_dedup_key.h"
#include "components/attribution_reporting/aggregatable_filtering_id_max_bytes.h"
#include "components/attribution_reporting/aggregatable_named_budget_candidate.h"
#include "components/attribution_reporting/aggregatable_named_budget_defs.h"
#include "components/attribution_reporting/aggregatable_trigger_config.h"
#include "components/attribution_reporting/aggregatable_trigger_data.h"
#include "components/attribution_reporting/aggregatable_values.h"
#include "components/attribution_reporting/aggregation_keys.h"
#include "components/attribution_reporting/attribution_scopes_data.h"
#include "components/attribution_reporting/attribution_scopes_set.h"
#include "components/attribution_reporting/destination_set.h"
#include "components/attribution_reporting/event_level_epsilon.h"
#include "components/attribution_reporting/event_report_windows.h"
#include "components/attribution_reporting/event_trigger_data.h"
#include "components/attribution_reporting/filters.h"
#include "components/attribution_reporting/max_event_level_reports.h"
#include "components/attribution_reporting/os_registration.h"
#include "components/attribution_reporting/registration.mojom-shared.h"
#include "components/attribution_reporting/source_registration.h"
#include "components/attribution_reporting/suitable_origin.h"
#include "components/attribution_reporting/trigger_config.h"
#include "components/attribution_reporting/trigger_registration.h"
#include "mojo/public/cpp/base/int128_mojom_traits.h"
#include "mojo/public/cpp/base/time_mojom_traits.h"
#include "net/base/schemeful_site.h"
#include "services/network/public/cpp/schemeful_site_mojom_traits.h"
#include "third_party/abseil-cpp/absl/numeric/int128.h"
#include "url/gurl.h"
#include "url/mojom/origin_mojom_traits.h"
#include "url/mojom/url_gurl_mojom_traits.h"
#include "url/origin.h"

namespace mojo {

template <>
struct COMPONENT_EXPORT(ATTRIBUTION_REPORTING_REGISTRATION_MOJOM_TRAITS)
    StructTraits<attribution_reporting::mojom::SuitableOriginDataView,
                 attribution_reporting::SuitableOrigin> {
  static const url::Origin& origin(
      const attribution_reporting::SuitableOrigin& origin) {
    return *origin;
  }

  static bool Read(attribution_reporting::mojom::SuitableOriginDataView data,
                   attribution_reporting::SuitableOrigin* out);
};

template <>
struct COMPONENT_EXPORT(ATTRIBUTION_REPORTING_REGISTRATION_MOJOM_TRAITS)
    StructTraits<attribution_reporting::mojom::FilterDataDataView,
                 attribution_reporting::FilterData> {
  static const attribution_reporting::FilterValues& filter_values(
      const attribution_reporting::FilterData& filter_data) {
    return filter_data.filter_values();
  }

  static bool Read(attribution_reporting::mojom::FilterDataDataView data,
                   attribution_reporting::FilterData* out);
};

template <>
struct COMPONENT_EXPORT(ATTRIBUTION_REPORTING_REGISTRATION_MOJOM_TRAITS)
    StructTraits<attribution_reporting::mojom::FilterConfigDataView,
                 attribution_reporting::FilterConfig> {
  static const std::optional<base::TimeDelta>& lookback_window(
      const attribution_reporting::FilterConfig& filter_config) {
    return filter_config.lookback_window();
  }

  static const attribution_reporting::FilterValues& filter_values(
      const attribution_reporting::FilterConfig& filter_config) {
    return filter_config.filter_values();
  }

  static bool Read(attribution_reporting::mojom::FilterConfigDataView data,
                   attribution_reporting::FilterConfig* out);
};

template <>
struct COMPONENT_EXPORT(ATTRIBUTION_REPORTING_REGISTRATION_MOJOM_TRAITS)
    StructTraits<attribution_reporting::mojom::AggregationKeysDataView,
                 attribution_reporting::AggregationKeys> {
  static const attribution_reporting::AggregationKeys::Keys& keys(
      const attribution_reporting::AggregationKeys& aggregation_keys) {
    return aggregation_keys.keys();
  }

  static bool Read(attribution_reporting::mojom::AggregationKeysDataView data,
                   attribution_reporting::AggregationKeys* out);
};

template <>
struct COMPONENT_EXPORT(ATTRIBUTION_REPORTING_REGISTRATION_MOJOM_TRAITS)
    StructTraits<attribution_reporting::mojom::DestinationSetDataView,
                 attribution_reporting::DestinationSet> {
  static const attribution_reporting::DestinationSet::Destinations&
  destinations(const attribution_reporting::DestinationSet& set) {
    return set.destinations();
  }

  static bool Read(attribution_reporting::mojom::DestinationSetDataView data,
                   attribution_reporting::DestinationSet* out);
};

template <>
struct COMPONENT_EXPORT(ATTRIBUTION_REPORTING_REGISTRATION_MOJOM_TRAITS)
    StructTraits<attribution_reporting::mojom::EventReportWindowsDataView,
                 attribution_reporting::EventReportWindows> {
  static base::TimeDelta start_time(
      const attribution_reporting::EventReportWindows& event_report_windows) {
    return event_report_windows.start_time();
  }

  static const base::flat_set<base::TimeDelta>& end_times(
      const attribution_reporting::EventReportWindows& event_report_windows) {
    return event_report_windows.end_times();
  }

  static bool Read(
      attribution_reporting::mojom::EventReportWindowsDataView data,
      attribution_reporting::EventReportWindows* out);
};

template <>
struct COMPONENT_EXPORT(ATTRIBUTION_REPORTING_REGISTRATION_MOJOM_TRAITS)
    StructTraits<attribution_reporting::mojom::TriggerDataSetDataView,
                 attribution_reporting::TriggerDataSet> {
  static const attribution_reporting::TriggerDataSet::TriggerData& trigger_data(
      const attribution_reporting::TriggerDataSet& trigger_data) {
    return trigger_data.trigger_data();
  }

  static bool Read(attribution_reporting::mojom::TriggerDataSetDataView data,
                   attribution_reporting::TriggerDataSet* out);
};

template <>
struct COMPONENT_EXPORT(ATTRIBUTION_REPORTING_REGISTRATION_MOJOM_TRAITS)
    StructTraits<
        attribution_reporting::mojom::
            AggregatableDebugReportingContributionDataView,
        attribution_reporting::AggregatableDebugReportingContribution> {
  static absl::uint128 key_piece(
      const attribution_reporting::AggregatableDebugReportingContribution&
          contribution) {
    return contribution.key_piece();
  }

  static uint32_t value(
      const attribution_reporting::AggregatableDebugReportingContribution&
          contribution) {
    return contribution.value();
  }

  static bool Read(
      attribution_reporting::mojom::
          AggregatableDebugReportingContributionDataView data,
      attribution_reporting::AggregatableDebugReportingContribution* out);
};

template <>
struct COMPONENT_EXPORT(ATTRIBUTION_REPORTING_REGISTRATION_MOJOM_TRAITS)
    StructTraits<
        attribution_reporting::mojom::AggregatableDebugReportingConfigDataView,
        attribution_reporting::AggregatableDebugReportingConfig> {
  static absl::uint128 key_piece(
      const attribution_reporting::AggregatableDebugReportingConfig& config) {
    return config.key_piece;
  }

  static const attribution_reporting::AggregatableDebugReportingConfig::
      DebugData&
      debug_data(const attribution_reporting::AggregatableDebugReportingConfig&
                     config) {
    return config.debug_data;
  }

  static const std::optional<attribution_reporting::SuitableOrigin>&
  aggregation_coordinator_origin(
      const attribution_reporting::AggregatableDebugReportingConfig& config) {
    return config.aggregation_coordinator_origin;
  }

  static bool Read(
      attribution_reporting::mojom::AggregatableDebugReportingConfigDataView
          data,
      attribution_reporting::AggregatableDebugReportingConfig* out);
};

template <>
struct COMPONENT_EXPORT(ATTRIBUTION_REPORTING_REGISTRATION_MOJOM_TRAITS)
    StructTraits<
        attribution_reporting::mojom::
            SourceAggregatableDebugReportingConfigDataView,
        attribution_reporting::SourceAggregatableDebugReportingConfig> {
  static uint32_t budget(
      const attribution_reporting::SourceAggregatableDebugReportingConfig&
          config) {
    return config.budget();
  }

  static const attribution_reporting::AggregatableDebugReportingConfig& config(
      const attribution_reporting::SourceAggregatableDebugReportingConfig&
          config) {
    return config.config();
  }

  static bool Read(
      attribution_reporting::mojom::
          SourceAggregatableDebugReportingConfigDataView data,
      attribution_reporting::SourceAggregatableDebugReportingConfig* out);
};

template <>
struct COMPONENT_EXPORT(ATTRIBUTION_REPORTING_REGISTRATION_MOJOM_TRAITS)
    StructTraits<attribution_reporting::mojom::AttributionScopesSetDataView,
                 attribution_reporting::AttributionScopesSet> {
  static const attribution_reporting::AttributionScopesSet::Scopes& scopes(
      const attribution_reporting::AttributionScopesSet& set) {
    return set.scopes();
  }

  static bool Read(
      attribution_reporting::mojom::AttributionScopesSetDataView data,
      attribution_reporting::AttributionScopesSet* out);
};

template <>
struct COMPONENT_EXPORT(ATTRIBUTION_REPORTING_REGISTRATION_MOJOM_TRAITS)
    StructTraits<attribution_reporting::mojom::AttributionScopesDataDataView,
                 attribution_reporting::AttributionScopesData> {
  static const attribution_reporting::AttributionScopesSet&
  attribution_scopes_set(
      const attribution_reporting::AttributionScopesData& data) {
    return data.attribution_scopes_set();
  }

  static uint32_t attribution_scope_limit(
      const attribution_reporting::AttributionScopesData& data) {
    return data.attribution_scope_limit();
  }

  static uint32_t max_event_states(
      const attribution_reporting::AttributionScopesData& data) {
    return data.max_event_states();
  }

  static bool Read(
      attribution_reporting::mojom::AttributionScopesDataDataView data,
      attribution_reporting::AttributionScopesData* out);
};

template <>
struct COMPONENT_EXPORT(ATTRIBUTION_REPORTING_REGISTRATION_MOJOM_TRAITS)
    StructTraits<
        attribution_reporting::mojom::AggregatableNamedBudgetDefsDataView,
        attribution_reporting::AggregatableNamedBudgetDefs> {
  static const attribution_reporting::AggregatableNamedBudgetDefs::BudgetMap&
  budgets(const attribution_reporting::AggregatableNamedBudgetDefs& data) {
    return data.budgets();
  }

  static bool Read(
      attribution_reporting::mojom::AggregatableNamedBudgetDefsDataView data,
      attribution_reporting::AggregatableNamedBudgetDefs* out);
};

template <>
struct COMPONENT_EXPORT(ATTRIBUTION_REPORTING_REGISTRATION_MOJOM_TRAITS)
    StructTraits<attribution_reporting::mojom::SourceRegistrationDataView,
                 attribution_reporting::SourceRegistration> {
  static const attribution_reporting::DestinationSet& destinations(
      const attribution_reporting::SourceRegistration& source) {
    return source.destination_set;
  }

  static uint64_t source_event_id(
      const attribution_reporting::SourceRegistration& source) {
    return source.source_event_id;
  }

  static base::TimeDelta expiry(
      const attribution_reporting::SourceRegistration& source) {
    return source.expiry;
  }

  static base::TimeDelta aggregatable_report_window(
      const attribution_reporting::SourceRegistration& source) {
    return source.aggregatable_report_window;
  }

  static const attribution_reporting::TriggerDataSet& trigger_data(
      const attribution_reporting::SourceRegistration& source) {
    return source.trigger_data;
  }

  static const attribution_reporting::EventReportWindows& event_report_windows(
      const attribution_reporting::SourceRegistration& source) {
    return source.event_report_windows;
  }

  static int max_event_level_reports(
      const attribution_reporting::SourceRegistration& source) {
    return source.max_event_level_reports;
  }

  static int64_t priority(
      const attribution_reporting::SourceRegistration& source) {
    return source.priority;
  }

  static std::optional<uint64_t> debug_key(
      const attribution_reporting::SourceRegistration& source) {
    return source.debug_key;
  }

  static const attribution_reporting::FilterData& filter_data(
      const attribution_reporting::SourceRegistration& source) {
    return source.filter_data;
  }

  static const attribution_reporting::AggregationKeys& aggregation_keys(
      const attribution_reporting::SourceRegistration& source) {
    return source.aggregation_keys;
  }

  static bool debug_reporting(
      const attribution_reporting::SourceRegistration& source) {
    return source.debug_reporting;
  }

  static attribution_reporting::mojom::TriggerDataMatching
  trigger_data_matching(
      const attribution_reporting::SourceRegistration& source) {
    return source.trigger_data_matching;
  }

  static double event_level_epsilon(
      const attribution_reporting::SourceRegistration& source) {
    return source.event_level_epsilon;
  }

  static const attribution_reporting::SourceAggregatableDebugReportingConfig&
  aggregatable_debug_reporting_config(
      const attribution_reporting::SourceRegistration& source) {
    return source.aggregatable_debug_reporting_config;
  }

  static int64_t destination_limit_priority(
      const attribution_reporting::SourceRegistration& source) {
    return source.destination_limit_priority;
  }

  static const std::optional<attribution_reporting::AttributionScopesData>&
  attribution_scopes_data(
      const attribution_reporting::SourceRegistration& source) {
    return source.attribution_scopes_data;
  }

  static const attribution_reporting::AggregatableNamedBudgetDefs&
  aggregatable_named_budget_defs(
      const attribution_reporting::SourceRegistration& source) {
    return source.aggregatable_named_budget_defs;
  }

  static bool Read(
      attribution_reporting::mojom::SourceRegistrationDataView data,
      attribution_reporting::SourceRegistration* out);
};

template <>
struct COMPONENT_EXPORT(ATTRIBUTION_REPORTING_REGISTRATION_MOJOM_TRAITS)
    StructTraits<attribution_reporting::mojom::FilterPairDataView,
                 attribution_reporting::FilterPair> {
  static const attribution_reporting::FiltersDisjunction& positive(
      const attribution_reporting::FilterPair& filters) {
    return filters.positive;
  }

  static const attribution_reporting::FiltersDisjunction& negative(
      const attribution_reporting::FilterPair& filters) {
    return filters.negative;
  }

  static bool Read(attribution_reporting::mojom::FilterPairDataView data,
                   attribution_reporting::FilterPair* out);
};

template <>
struct COMPONENT_EXPORT(ATTRIBUTION_REPORTING_REGISTRATION_MOJOM_TRAITS)
    StructTraits<attribution_reporting::mojom::EventTriggerDataDataView,
                 attribution_reporting::EventTriggerData> {
  static uint64_t data(const attribution_reporting::EventTriggerData& data) {
    return data.data;
  }

  static int64_t priority(const attribution_reporting::EventTriggerData& data) {
    return data.priority;
  }

  static std::optional<uint64_t> dedup_key(
      const attribution_reporting::EventTriggerData& data) {
    return data.dedup_key;
  }

  static const attribution_reporting::FilterPair& filters(
      const attribution_reporting::EventTriggerData& data) {
    return data.filters;
  }

  static bool Read(attribution_reporting::mojom::EventTriggerDataDataView data,
                   attribution_reporting::EventTriggerData* out);
};

template <>
struct COMPONENT_EXPORT(ATTRIBUTION_REPORTING_REGISTRATION_MOJOM_TRAITS)
    StructTraits<attribution_reporting::mojom::AggregatableTriggerDataDataView,
                 attribution_reporting::AggregatableTriggerData> {
  static absl::uint128 key_piece(
      const attribution_reporting::AggregatableTriggerData& data) {
    return data.key_piece();
  }

  static const attribution_reporting::AggregatableTriggerData::Keys&
  source_keys(const attribution_reporting::AggregatableTriggerData& data) {
    return data.source_keys();
  }

  static const attribution_reporting::FilterPair& filters(
      const attribution_reporting::AggregatableTriggerData& data) {
    return data.filters();
  }

  static bool Read(
      attribution_reporting::mojom::AggregatableTriggerDataDataView data,
      attribution_reporting::AggregatableTriggerData* out);
};

template <>
struct COMPONENT_EXPORT(ATTRIBUTION_REPORTING_REGISTRATION_MOJOM_TRAITS)
    StructTraits<
        attribution_reporting::mojom::AggregatableNamedBudgetCandidateDataView,
        attribution_reporting::AggregatableNamedBudgetCandidate> {
  static const std::optional<std::string>& name(
      const attribution_reporting::AggregatableNamedBudgetCandidate& data) {
    return data.name();
  }

  static const attribution_reporting::FilterPair& filters(
      const attribution_reporting::AggregatableNamedBudgetCandidate& data) {
    return data.filters();
  }

  static bool Read(
      attribution_reporting::mojom::AggregatableNamedBudgetCandidateDataView
          data,
      attribution_reporting::AggregatableNamedBudgetCandidate* out);
};

template <>
struct COMPONENT_EXPORT(ATTRIBUTION_REPORTING_REGISTRATION_MOJOM_TRAITS)
    StructTraits<attribution_reporting::mojom::TriggerRegistrationDataView,
                 attribution_reporting::TriggerRegistration> {
  static const std::vector<attribution_reporting::EventTriggerData>&
  event_triggers(const attribution_reporting::TriggerRegistration& trigger) {
    return trigger.event_triggers;
  }

  static const attribution_reporting::FilterPair& filters(
      const attribution_reporting::TriggerRegistration& trigger) {
    return trigger.filters;
  }

  static const std::vector<attribution_reporting::AggregatableTriggerData>&
  aggregatable_trigger_data(
      const attribution_reporting::TriggerRegistration& trigger) {
    return trigger.aggregatable_trigger_data;
  }

  static const std::vector<attribution_reporting::AggregatableValues>&
  aggregatable_values(
      const attribution_reporting::TriggerRegistration& trigger) {
    return trigger.aggregatable_values;
  }

  static std::optional<uint64_t> debug_key(
      const attribution_reporting::TriggerRegistration& trigger) {
    return trigger.debug_key;
  }

  static const std::vector<attribution_reporting::AggregatableDedupKey>&
  aggregatable_dedup_keys(
      const attribution_reporting::TriggerRegistration& trigger) {
    return trigger.aggregatable_dedup_keys;
  }

  static const std::vector<
      attribution_reporting::AggregatableNamedBudgetCandidate>&
  aggregatable_named_budget_candidates(
      const attribution_reporting::TriggerRegistration& trigger) {
    return trigger.aggregatable_named_budget_candidates;
  }

  static bool debug_reporting(
      const attribution_reporting::TriggerRegistration& trigger) {
    return trigger.debug_reporting;
  }

  static const std::optional<attribution_reporting::SuitableOrigin>&
  aggregation_coordinator_origin(
      const attribution_reporting::TriggerRegistration& trigger) {
    return trigger.aggregation_coordinator_origin;
  }

  static attribution_reporting::mojom::SourceRegistrationTimeConfig
  source_registration_time_config(
      const attribution_reporting::TriggerRegistration& trigger) {
    return trigger.aggregatable_trigger_config
        .source_registration_time_config();
  }

  static const std::optional<std::string>& trigger_context_id(
      const attribution_reporting::TriggerRegistration& trigger) {
    return trigger.aggregatable_trigger_config.trigger_context_id();
  }

  static uint8_t aggregatable_filtering_id_max_bytes(
      const attribution_reporting::TriggerRegistration& trigger) {
    return trigger.aggregatable_trigger_config
        .aggregatable_filtering_id_max_bytes()
        .value();
  }

  static const attribution_reporting::AggregatableDebugReportingConfig&
  aggregatable_debug_reporting_config(
      const attribution_reporting::TriggerRegistration& source) {
    return source.aggregatable_debug_reporting_config;
  }

  static const attribution_reporting::AttributionScopesSet& attribution_scopes(
      const attribution_reporting::TriggerRegistration& trigger) {
    return trigger.attribution_scopes;
  }

  static bool Read(
      attribution_reporting::mojom::TriggerRegistrationDataView data,
      attribution_reporting::TriggerRegistration* out);
};

template <>
struct COMPONENT_EXPORT(ATTRIBUTION_REPORTING_REGISTRATION_MOJOM_TRAITS)
    StructTraits<attribution_reporting::mojom::AggregatableDedupKeyDataView,
                 attribution_reporting::AggregatableDedupKey> {
  static std::optional<uint64_t> dedup_key(
      const attribution_reporting::AggregatableDedupKey& data) {
    return data.dedup_key;
  }

  static const attribution_reporting::FilterPair& filters(
      const attribution_reporting::AggregatableDedupKey& data) {
    return data.filters;
  }

  static bool Read(
      attribution_reporting::mojom::AggregatableDedupKeyDataView data,
      attribution_reporting::AggregatableDedupKey* out);
};

template <>
struct COMPONENT_EXPORT(ATTRIBUTION_REPORTING_REGISTRATION_MOJOM_TRAITS)
    StructTraits<attribution_reporting::mojom::AggregatableValuesValueDataView,
                 attribution_reporting::AggregatableValuesValue> {
  static uint32_t value(
      const attribution_reporting::AggregatableValuesValue& data) {
    return data.value();
  }

  static uint64_t filtering_id(
      const attribution_reporting::AggregatableValuesValue& data) {
    return data.filtering_id();
  }

  static bool Read(
      attribution_reporting::mojom::AggregatableValuesValueDataView data,
      attribution_reporting::AggregatableValuesValue* out);
};

template <>
struct COMPONENT_EXPORT(ATTRIBUTION_REPORTING_REGISTRATION_MOJOM_TRAITS)
    StructTraits<attribution_reporting::mojom::AggregatableValuesDataView,
                 attribution_reporting::AggregatableValues> {
  static const attribution_reporting::AggregatableValues::Values& values(
      const attribution_reporting::AggregatableValues& data) {
    return data.values();
  }

  static const attribution_reporting::FilterPair& filters(
      const attribution_reporting::AggregatableValues& data) {
    return data.filters();
  }

  static bool Read(
      attribution_reporting::mojom::AggregatableValuesDataView data,
      attribution_reporting::AggregatableValues* out);
};

template <>
struct COMPONENT_EXPORT(ATTRIBUTION_REPORTING_REGISTRATION_MOJOM_TRAITS)
    StructTraits<attribution_reporting::mojom::OsRegistrationDataView,
                 std::vector<attribution_reporting::OsRegistrationItem>> {
  static const std::vector<attribution_reporting::OsRegistrationItem>& items(
      const std::vector<attribution_reporting::OsRegistrationItem>& items) {
    return items;
  }

  static bool Read(
      attribution_reporting::mojom::OsRegistrationDataView data,
      std::vector<attribution_reporting::OsRegistrationItem>* out) {
    return data.ReadItems(out);
  }
};

template <>
struct COMPONENT_EXPORT(ATTRIBUTION_REPORTING_REGISTRATION_MOJOM_TRAITS)
    StructTraits<attribution_reporting::mojom::OsRegistrationItemDataView,
                 attribution_reporting::OsRegistrationItem> {
  static const GURL& url(
      const attribution_reporting::OsRegistrationItem& item) {
    return item.url;
  }

  static bool debug_reporting(
      const attribution_reporting::OsRegistrationItem& item) {
    return item.debug_reporting;
  }

  static bool Read(
      attribution_reporting::mojom::OsRegistrationItemDataView data,
      attribution_reporting::OsRegistrationItem* out);
};

}  // namespace mojo

#endif  // COMPONENTS_ATTRIBUTION_REPORTING_REGISTRATION_MOJOM_TRAITS_H_