File: accessibility_state.h

package info (click to toggle)
chromium 138.0.7204.183-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,071,908 kB
  • sloc: cpp: 34,937,088; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,953; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,806; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (91 lines) | stat: -rw-r--r-- 3,584 bytes parent folder | download | duplicates (4)
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
// 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 UI_ACCESSIBILITY_ANDROID_ACCESSIBILITY_STATE_H_
#define UI_ACCESSIBILITY_ANDROID_ACCESSIBILITY_STATE_H_

#include <vector>

namespace ui {

// Provides methods for measuring accessibility state on Android via
// org.chromium.ui.accessibility.AccessibilityState.
class AccessibilityState {
 public:
  // Provides an interface for clients to listen to animator duration scale
  // changes.
  class AccessibilityStateDelegate {
   public:
    // Called when the animator duration scale changes.
    virtual void OnAnimatorDurationScaleChanged() = 0;

    // Called when the display inversion state changes.
    virtual void OnDisplayInversionEnabledChanged(bool enabled) = 0;

    // Called when the contrast level changes.
    virtual void OnContrastLevelChanged(bool highContrastEnabled) = 0;

    // Called during browser startup and any time enabled services change.
    virtual void RecordAccessibilityServiceInfoHistograms() = 0;
  };

  static void RegisterAccessibilityStateDelegate(
      AccessibilityStateDelegate* delegate);

  static void UnregisterAccessibilityStateDelegate(
      AccessibilityStateDelegate* delegate);

  // Notifies all delegates of an animator duration scale change.
  static void NotifyAnimatorDurationScaleObservers();

  // Notifies all delegates of a display inversion state change.
  static void NotifyDisplayInversionEnabledObservers(bool enabled);

  // Notifies all delegates of a contrast level change.
  static void NotifyContrastLevelObservers(bool highContrastEnabled);

  // Notifies all delegates to record service info histograms.
  static void NotifyRecordAccessibilityServiceInfoHistogram();

  // --------------------------------------------------------------------------
  // Methods that call into AccessibilityState.java via JNI
  // --------------------------------------------------------------------------

  // Returns the event mask of all running accessibility services.
  static int GetAccessibilityServiceEventTypeMask();

  // Returns the feedback type mask of all running accessibility services.
  static int GetAccessibilityServiceFeedbackTypeMask();

  // Returns the flags mask of all running accessibility services.
  static int GetAccessibilityServiceFlagsMask();

  // Returns the capabilities mask of all running accessibility services.
  static int GetAccessibilityServiceCapabilitiesMask();

  // Returns a vector containing the IDs of all running accessibility services.
  static std::vector<std::string> GetAccessibilityServiceIds();

  // Returns true when the user has set the OS-level setting to reduce motion.
  static bool PrefersReducedMotion();

  // --------------------------------------------------------------------------
  // Methods that call into AccessibilityAutofillHelper.java via JNI
  // --------------------------------------------------------------------------

  // Returns true if this instance should respect the displayed password text
  // (available in the shadow DOM), false if it should return bullets. Default
  // false.
  static bool ShouldRespectDisplayedPasswordText();
  static void ForceRespectDisplayedPasswordTextForTesting();

  // Returns true if this instance should expose password text to AT (e.g. as a
  // user is typing in a field), false if it should return bullets. Default
  // true.
  static bool ShouldExposePasswordText();
};

}  // namespace ui

#endif  // UI_ACCESSIBILITY_ANDROID_ACCESSIBILITY_STATE_H_