refactor: use base::fixed_flat_set in NativeWindowViews::SetAlwaysOnTop() (#47201)

refactor: use base::fixed_flat_set in NativeWindowViews::SetAlwaysOnTop()
This commit is contained in:
Charles Kerr 2025-05-22 18:20:39 -05:00 committed by GitHub
commit 2248de847d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -20,7 +20,7 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "base/containers/contains.h" #include "base/containers/fixed_flat_set.h"
#include "base/memory/raw_ref.h" #include "base/memory/raw_ref.h"
#include "base/numerics/ranges.h" #include "base/numerics/ranges.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
@ -1157,9 +1157,9 @@ void NativeWindowViews::SetAlwaysOnTop(ui::ZOrderLevel z_order,
if (z_order != ui::ZOrderLevel::kNormal) { if (z_order != ui::ZOrderLevel::kNormal) {
// On macOS the window is placed behind the Dock for the following levels. // On macOS the window is placed behind the Dock for the following levels.
// Re-use the same names on Windows to make it easier for the user. // Re-use the same names on Windows to make it easier for the user.
static const std::vector<std::string> levels = { static constexpr auto levels = base::MakeFixedFlatSet<std::string_view>(
"floating", "torn-off-menu", "modal-panel", "main-menu", "status"}; {"floating", "torn-off-menu", "modal-panel", "main-menu", "status"});
behind_task_bar_ = base::Contains(levels, level); behind_task_bar_ = levels.contains(level);
} }
#endif #endif
MoveBehindTaskBarIfNeeded(); MoveBehindTaskBarIfNeeded();