0

[A11yPerformance] Move native theme UMA out of BrowserAccessibilityStateImpl

The first part of the Auto Disable Refresh work, is to clean up
BrowserAccessibilityState and what it's responsible for. It should only
know about AXMode and assistive technologies. High contrast is not
related to a11y trees.

In addition, having this code prevents some other simplifications,
specifically removing UpdateUniqueUserHistograms().

Bug: none
Change-Id: I2932f64a4f89cf7ec0cae657a9aee2f8d297d48d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6343691
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
Reviewed-by: Elly FJ <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1431114}
This commit is contained in:
Aaron Leventhal
2025-03-11 13:37:01 -07:00
committed by Chromium LUCI CQ
parent 24093184e9
commit 176f84be04
2 changed files with 7 additions and 9 deletions
content/browser/accessibility
ui/native_theme

@ -32,7 +32,6 @@
#include "ui/accessibility/platform/ax_platform_node.h"
#include "ui/events/base_event_utils.h"
#include "ui/gfx/color_utils.h"
#include "ui/native_theme/native_theme.h"
namespace content {
@ -454,14 +453,6 @@ void BrowserAccessibilityStateImpl::UpdateHistogramsOnUIThread() {
"Accessibility.ManuallyEnabled",
!GetAccessibilityMode().is_mode_off() && !allow_ax_mode_changes_);
#if BUILDFLAG(IS_WIN)
base::UmaHistogramEnumeration(
"Accessibility.WinHighContrastTheme",
ui::NativeTheme::GetInstanceForNativeUi()
->GetPlatformHighContrastColorScheme(),
ui::NativeTheme::PlatformHighContrastColorScheme::kMaxValue);
#endif
ui_thread_done_ = true;
if (other_thread_done_ && background_thread_done_callback_) {
std::move(background_thread_done_callback_).Run();

@ -24,6 +24,7 @@
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/metrics/histogram_functions.h"
#include "base/no_destructor.h"
#include "base/notreached.h"
#include "base/task/sequenced_task_runner.h"
@ -352,6 +353,12 @@ NativeThemeWin::NativeThemeWin(bool configure_web_instance,
if (configure_web_instance) {
ConfigureWebInstance();
}
#if BUILDFLAG(IS_WIN)
base::UmaHistogramEnumeration("Accessibility.WinHighContrastTheme",
GetPlatformHighContrastColorScheme(),
PlatformHighContrastColorScheme::kMaxValue);
#endif
}
void NativeThemeWin::ConfigureWebInstance() {