chromium/chrome/common/accessibility/read_anything_constants.h

// 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 CHROME_COMMON_ACCESSIBILITY_READ_ANYTHING_CONSTANTS_H_
#define CHROME_COMMON_ACCESSIBILITY_READ_ANYTHING_CONSTANTS_H_

#include <string>
#include <string_view>

#include "base/containers/fixed_flat_map.h"
#include "ui/accessibility/ax_mode.h"

// Various constants used throughout the Read Anything feature.
namespace string_constants {

extern const char kReadAnythingPlaceholderFontName[];
extern const char kReadAnythingDefaultFont[];
extern const char kReadAnythingPlaceholderVoiceName[];
extern const char kLetterSpacingHistogramName[];
extern const char kLineSpacingHistogramName[];
extern const char kColorHistogramName[];
extern const char kFontNameHistogramName[];
extern const char kFontScaleHistogramName[];
extern const char kScrollEventHistogramName[];
extern const char kEmptyStateHistogramName[];
extern const char kLanguageHistogramName[];

}  // namespace string_constants

// When adding a new font, add info to ReadAnythingFont, kReadAnythingFonts,
// and GetFontInfos() below.
namespace fonts {
// Enum for logging the user-chosen font.
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
//
// LINT.IfChange(ReadAnythingFont)
enum class ReadAnythingFont {};
// LINT.ThenChange(/tools/metrics/histograms/metadata/accessibility/enums.xml:ReadAnythingFontName)

// Holds compile-time known information about each of Read Anything's supported
// fonts. If num_langs_supported is 0, then that font supports all languages.
struct FontInfo {};

inline const char* kReadAnythingFonts[] =;
inline constexpr FontInfo kPoppinsFontInfo =;
inline constexpr FontInfo kSansSerifFontInfo =;
inline constexpr FontInfo kSerifFontInfo =;
inline constexpr FontInfo kComicNeueFontInfo =;
inline constexpr FontInfo kLexendDecaFontInfo =;
inline constexpr FontInfo kEbGaramondFontInfo =;
inline constexpr FontInfo kStixTwoTextFontInfo =;
inline constexpr FontInfo kAndikaFontInfo =;
inline constexpr FontInfo kAtkinsonHyperlegibleFontInfo =;
extern const base::fixed_flat_map<std::string_view, FontInfo, 9> kFontInfos;

}  // namespace fonts

namespace {

// Used for text formatting correction in PDFs. This value should match the line
// width limit in app.html.
inline constexpr int kMaxLineWidth =;

// Audio constants for Read Aloud feature.
// Speech rate is a multiplicative scale where 1 is the baseline.
inline constexpr double kReadAnythingDefaultSpeechRate =;

// Font size in em
inline constexpr double kReadAnythingDefaultFontScale =;
inline constexpr double kReadAnythingMinimumFontScale =;
inline constexpr double kReadAnythingMaximumFontScale =;
inline constexpr double kReadAnythingFontScaleIncrement =;

// Display settings.
inline constexpr bool kReadAnythingDefaultLinksEnabled =;
inline constexpr bool kReadAnythingDefaultImagesEnabled =;

// Enum for logging how a scroll occurs.
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
//
// LINT.IfChange(ReadAnythingScrollEvent)
enum class ReadAnythingScrollEvent {};
// LINT.ThenChange(/tools/metrics/histograms/metadata/accessibility/enums.xml:ReadAnythingScrollEvent)

// Enum for logging when we show the empty state.
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
//
// LINT.IfChange(ReadAnythingEmptyState)
enum class ReadAnythingEmptyState {};
// LINT.ThenChange(/tools/metrics/histograms/metadata/accessibility/enums.xml:ReadAnythingFontName)

}  // namespace

#endif  // CHROME_COMMON_ACCESSIBILITY_READ_ANYTHING_CONSTANTS_H_