Flutter Engine
The Flutter Engine
ax_mode.cc
Go to the documentation of this file.
1// Copyright 2019 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "ax_mode.h"
6
7#include <vector>
8
9#include "base/logging.h"
10#include "base/string_utils.h"
11
12namespace ui {
13
14std::ostream& operator<<(std::ostream& stream, const AXMode& mode) {
15 return stream << mode.ToString();
16}
17
18std::string AXMode::ToString() const {
19 std::vector<std::string> tokens;
20
21 // Written as a loop with a switch so that this crashes if a new
22 // mode flag is added without adding support for logging it.
23 for (uint32_t mode_flag = AXMode::kFirstModeFlag;
24 mode_flag <= AXMode::kLastModeFlag; mode_flag = mode_flag << 1) {
25 const char* flag_name = nullptr;
26 switch (mode_flag) {
28 flag_name = "kNativeAPIs";
29 break;
31 flag_name = "kWebContents";
32 break;
34 flag_name = "kInlineTextBoxes";
35 break;
37 flag_name = "kScreenReader";
38 break;
39 case AXMode::kHTML:
40 flag_name = "kHTML";
41 break;
43 flag_name = "kLabelImages";
44 break;
45 case AXMode::kPDF:
46 flag_name = "kPDF";
47 break;
48 }
49
50 BASE_DCHECK(flag_name);
51
52 if (has_mode(mode_flag))
53 tokens.push_back(flag_name);
54 }
55
56 return base::JoinString(tokens, " | ");
57}
58
59} // namespace ui
bool has_mode(uint32_t flag) const
Definition: ax_mode.h:73
static constexpr uint32_t kInlineTextBoxes
Definition: ax_mode.h:45
static constexpr uint32_t kScreenReader
Definition: ax_mode.h:52
static constexpr uint32_t kLastModeFlag
Definition: ax_mode.h:68
static constexpr uint32_t kFirstModeFlag
Definition: ax_mode.h:18
static constexpr uint32_t kPDF
Definition: ax_mode.h:63
static constexpr uint32_t kNativeAPIs
Definition: ax_mode.h:25
static constexpr uint32_t kLabelImages
Definition: ax_mode.h:59
static constexpr uint32_t kHTML
Definition: ax_mode.h:56
static constexpr uint32_t kWebContents
Definition: ax_mode.h:36
std::string ToString() const
Definition: ax_mode.cc:18
std::string JoinString(std::vector< std::string > tokens, std::string delimiter)
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
Definition: switches.h:228
std::ostream & operator<<(std::ostream &os, AXEventGenerator::Event event)
#define BASE_DCHECK(condition)
Definition: logging.h:63