summaryrefslogtreecommitdiff
path: root/chromium/content/public/common/impression.h
blob: b009873f02d983fb9d917e3645e8028303067533 (plain)
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
// Copyright 2020 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_PUBLIC_COMMON_IMPRESSION_H_
#define CONTENT_PUBLIC_COMMON_IMPRESSION_H_

#include <stdint.h>
#include <string>

#include "base/time/time.h"
#include "content/common/content_export.h"
#include "url/origin.h"

namespace content {

// An impression represents a click on an anchor tag that has special Conversion
// Measurement attributes declared. When the anchor is clicked, an impression is
// generated from these attributes and associated with the resulting navigation.
// When an action is performed on the linked site at a later date, the
// impression information is used to provide context about the initial
// navigation that resulted in that action.
//
// Used for IPC transport of WebImpression. WebImpression cannot be used
// directly as it contains non-header-only blink types.
struct CONTENT_EXPORT Impression {
  Impression();
  Impression(const Impression& other);
  Impression& operator=(const Impression& other);
  ~Impression();

  // Intended committed top-level origin of the resulting navigation. Must match
  // the committed navigation's origin to be a valid impression. Declared by
  // the impression tag.
  url::Origin conversion_destination;

  // Optional origin that will receive all conversion measurement reports
  // associated with this impression. Declared by the impression tag.
  base::Optional<url::Origin> reporting_origin;

  // Data that will be sent in conversion reports to identify this impression.
  // Declared by the impression tag.
  uint64_t impression_data;

  // Optional expiry specifying the amount of time this impression can convert.
  // Declared by the impression tag.
  base::Optional<base::TimeDelta> expiry;
};

}  // namespace content

#endif  // CONTENT_PUBLIC_COMMON_IMPRESSION_H_