File: pdf_ink_metrics_handler.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 (128 lines) | stat: -rw-r--r-- 3,563 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
// 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 PDF_PDF_INK_METRICS_HANDLER_H_
#define PDF_PDF_INK_METRICS_HANDLER_H_

#include "pdf/buildflags.h"
#include "pdf/pdf_ink_brush.h"
#include "third_party/ink/src/ink/strokes/input/stroke_input.h"

static_assert(BUILDFLAG(ENABLE_PDF_INK2), "ENABLE_PDF_INK2 not set to true");

namespace chrome_pdf {

// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
//
// LINT.IfChange(PDFInk2StrokeBrushSize)
enum class StrokeMetricBrushSize {
  kExtraThin = 0,
  kThin = 1,
  kMedium = 2,
  kThick = 3,
  kExtraThick = 4,
  kMaxValue = 4,
};
// LINT.ThenChange(//tools/metrics/histograms/metadata/pdf/enums.xml:PDFInk2StrokeBrushSize)

// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
//
// LINT.IfChange(PDFInk2StrokeBrushType)
enum class StrokeMetricBrushType {
  kPen = 0,
  kHighlighter = 1,
  kEraser = 2,
  kMaxValue = 2,
};
// LINT.ThenChange(//tools/metrics/histograms/metadata/pdf/enums.xml:PDFInk2StrokeBrushType)

// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
//
// LINT.IfChange(PDFInk2StrokeHighlighterColor)
enum class StrokeMetricHighlighterColor {
  kLightRed = 0,
  kLightYellow = 1,
  kLightGreen = 2,
  kLightBlue = 3,
  kLightOrange = 4,
  kRed = 5,
  kYellow = 6,
  kGreen = 7,
  kBlue = 8,
  kOrange = 9,
  kMaxValue = 9,
};
// LINT.ThenChange(//tools/metrics/histograms/metadata/pdf/enums.xml:PDFInk2StrokeHighlighterColor)

// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
//
// LINT.IfChange(PDFInk2StrokeInputDeviceType)
enum class StrokeMetricInputDeviceType {
  kMouse = 0,
  kTouch = 1,
  kPen = 2,
  kMaxValue = 2,
};
// LINT.ThenChange(//tools/metrics/histograms/metadata/pdf/enums.xml:PDFInk2StrokeInputDeviceType)

// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
//
// LINT.IfChange(PDFInk2StrokePenColor)
enum class StrokeMetricPenColor {
  kBlack = 0,
  kDarkGrey2 = 1,
  kDarkGrey1 = 2,
  kLightGrey = 3,
  kWhite = 4,
  kRed1 = 5,
  kYellow1 = 6,
  kGreen1 = 7,
  kBlue1 = 8,
  kTan1 = 9,
  kRed2 = 10,
  kYellow2 = 11,
  kGreen2 = 12,
  kBlue2 = 13,
  kTan2 = 14,
  kRed3 = 15,
  kYellow3 = 16,
  kGreen3 = 17,
  kBlue3 = 18,
  kTan3 = 19,
  kMaxValue = 19,
};
// LINT.ThenChange(//tools/metrics/histograms/metadata/pdf/enums.xml:PDFInk2StrokePenColor)

// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
//
// LINT.IfChange(PDFLoadedWithV2InkAnnotations)
enum class PDFLoadedWithV2InkAnnotations {
  kUnknown = 0,
  kTrue = 1,
  kFalse = 2,
  kMaxValue = kFalse,
};
// LINT.ThenChange(//tools/metrics/histograms/metadata/pdf/enums.xml:PDFLoadedWithV2InkAnnotations)

void ReportDrawStroke(PdfInkBrush::Type type,
                      const ink::Brush& brush,
                      ink::StrokeInput::ToolType tool_type);

void ReportEraseStroke(ink::StrokeInput::ToolType tool_type);

void ReportTextHighlight(const ink::Brush& brush,
                         ink::StrokeInput::ToolType tool_type);

void RecordPdfLoadedWithV2InkAnnotations(
    PDFLoadedWithV2InkAnnotations loaded_with_annotations);

}  // namespace chrome_pdf

#endif  // PDF_PDF_INK_METRICS_HANDLER_H_