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
content / public / browser / preview_cancel_reason.h [blame]
// Copyright 2024 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_PREVIEW_CANCEL_REASON_H_
#define CONTENT_PUBLIC_BROWSER_PREVIEW_CANCEL_REASON_H_
#include <string>
#include "content/common/content_export.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
namespace content {
// TODO(b:316209095): Report UMA
enum class PreviewFinalStatus {
kActivated = 0,
kCancelledByWindowClose = 1,
kBlockedByMojoBinderPolicy = 2,
kBlockedByNonHttps = 3,
kMaxValue = kBlockedByNonHttps,
};
class CONTENT_EXPORT PreviewCancelReason {
public:
static PreviewCancelReason Build(PreviewFinalStatus final_status);
static PreviewCancelReason BlockedByMojoBinderPolicy(
std::string interface_name);
// Move only
PreviewCancelReason(PreviewCancelReason&& other);
PreviewCancelReason& operator=(PreviewCancelReason&& other);
PreviewCancelReason(const PreviewCancelReason&) = delete;
PreviewCancelReason& operator=(const PreviewCancelReason&) = delete;
~PreviewCancelReason();
PreviewFinalStatus GetFinalStatus() const;
private:
struct MojoInterfaceName {
std::string interface_name;
};
using ExtraData = absl::variant<absl::monostate, MojoInterfaceName>;
PreviewCancelReason(PreviewFinalStatus final_status, ExtraData extra_data);
PreviewFinalStatus final_status_;
ExtraData extra_data_;
};
} // namespace content
#endif // CONTENT_PUBLIC_BROWSER_PREVIEW_CANCEL_REASON_H_