Avi Drissman | 3e1a26c | 2022-09-15 20:26:03 | [diff] [blame] | 1 | // Copyright 2021 The Chromium Authors |
Allen Bauer | acb6b7c | 2021-02-27 01:43:32 | [diff] [blame] | 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 "ui/native_theme/native_theme_utils.h" |
| 6 | |
Helmut Januschka | 36619c1 | 2024-04-24 14:33:19 | [diff] [blame] | 7 | #include <string_view> |
| 8 | |
Zoraiz Naeem | badbeda | 2025-03-03 22:15:03 | [diff] [blame] | 9 | #include "ui/native_theme/features/native_theme_features.h" |
Zhengzheng Liu | 4d68db2 | 2024-10-19 04:46:57 | [diff] [blame] | 10 | |
Allen Bauer | acb6b7c | 2021-02-27 01:43:32 | [diff] [blame] | 11 | namespace ui { |
| 12 | |
Helmut Januschka | 36619c1 | 2024-04-24 14:33:19 | [diff] [blame] | 13 | std::string_view NativeThemeColorSchemeName( |
Allen Bauer | acb6b7c | 2021-02-27 01:43:32 | [diff] [blame] | 14 | NativeTheme::ColorScheme color_scheme) { |
| 15 | switch (color_scheme) { |
| 16 | case NativeTheme::ColorScheme::kDefault: |
| 17 | return "kDefault"; |
| 18 | case NativeTheme::ColorScheme::kLight: |
| 19 | return "kLight"; |
| 20 | case NativeTheme::ColorScheme::kDark: |
| 21 | return "kDark"; |
| 22 | case NativeTheme::ColorScheme::kPlatformHighContrast: |
| 23 | return "kPlatformHighContrast"; |
| 24 | default: |
Peter Boström | e4f1aef5 | 2024-10-29 23:42:03 | [diff] [blame] | 25 | NOTREACHED() << "Invalid NativeTheme::ColorScheme"; |
Allen Bauer | acb6b7c | 2021-02-27 01:43:32 | [diff] [blame] | 26 | } |
| 27 | } |
| 28 | |
Zhengzheng Liu | 4d68db2 | 2024-10-19 04:46:57 | [diff] [blame] | 29 | bool IsOverlayScrollbarEnabled() { |
Zhengzheng Liu | b140c996 | 2024-11-08 22:21:52 | [diff] [blame] | 30 | #if BUILDFLAG(IS_CHROMEOS) |
| 31 | return NativeTheme::GetInstanceForWeb()->use_overlay_scrollbar(); |
| 32 | #else |
| 33 | return IsOverlayScrollbarEnabledByFeatureFlag(); |
| 34 | #endif |
Zhengzheng Liu | 4d68db2 | 2024-10-19 04:46:57 | [diff] [blame] | 35 | } |
| 36 | |
Allen Bauer | acb6b7c | 2021-02-27 01:43:32 | [diff] [blame] | 37 | } // namespace ui |