Migrate absl variant.h and utility.h in ash
Since https://crrev.com/c/6330348, some utils in third_party/abseil-cpp/absl/types/variant.h and and third_party/abseil-cpp/absl/utility/utility.h are only aliases for their std counterparts. This CL migrates code to use std:: directly. Bug: 40242126 Change-Id: Iaaaaacd0e85ed291d04f33cc0a4e0ac1d0f2deb0 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6343270 Commit-Queue: Victor Vianna <victorvianna@google.com> Reviewed-by: James Cook <jamescook@chromium.org> Cr-Commit-Position: refs/heads/main@{#1434187}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
6bba50d9a0
commit
6bc0c58b33
ash
accelerators
accelerator_capslock_state_machine_unittest.ccaccelerator_launcher_state_machine_unittest.ccaccelerator_shift_disable_capslock_state_machine_unittest.cc
events
scanner
style
blurred_background_shield.hicon_button.ccicon_button.hrounded_label_widget.ccrounded_label_widget.h
style_viewer
system
focus_mode
test
user_education
welcome_tour
webui
eche_app_ui
@ -4,6 +4,8 @@
|
||||
|
||||
#include "ash/accelerators/accelerator_capslock_state_machine.h"
|
||||
|
||||
#include <variant>
|
||||
|
||||
#include "ash/test/ash_test_base.h"
|
||||
#include "testing/gmock/include/gmock/gmock.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
@ -26,7 +28,7 @@ class MockInputController : public ui::StubInputController {
|
||||
const bool kKeysPressed = true;
|
||||
const bool kNoKeysPressed = false;
|
||||
|
||||
using EventTypeVariant = absl::variant<ui::MouseEvent, ui::KeyEvent, bool>;
|
||||
using EventTypeVariant = std::variant<ui::MouseEvent, ui::KeyEvent, bool>;
|
||||
using CapslockState = AcceleratorCapslockStateMachine::CapslockState;
|
||||
|
||||
ui::MouseEvent MousePress() {
|
||||
@ -54,10 +56,10 @@ ui::KeyEvent KeyRelease(ui::KeyboardCode key_code) {
|
||||
}
|
||||
|
||||
ui::Event& GetEventFromVariant(EventTypeVariant& event) {
|
||||
if (absl::holds_alternative<ui::MouseEvent>(event)) {
|
||||
return absl::get<ui::MouseEvent>(event);
|
||||
if (std::holds_alternative<ui::MouseEvent>(event)) {
|
||||
return std::get<ui::MouseEvent>(event);
|
||||
} else {
|
||||
return absl::get<ui::KeyEvent>(event);
|
||||
return std::get<ui::KeyEvent>(event);
|
||||
}
|
||||
}
|
||||
|
||||
@ -183,9 +185,9 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
|
||||
TEST_P(AcceleratorCapslockStateMachineTest, StateTest) {
|
||||
for (auto& event : events_) {
|
||||
if (absl::holds_alternative<bool>(event)) {
|
||||
if (std::holds_alternative<bool>(event)) {
|
||||
ON_CALL(*input_controller_, AreAnyKeysPressed())
|
||||
.WillByDefault(testing::Return(absl::get<bool>(event)));
|
||||
.WillByDefault(testing::Return(std::get<bool>(event)));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
#include "ash/accelerators/accelerator_launcher_state_machine.h"
|
||||
|
||||
#include <variant>
|
||||
|
||||
#include "ash/test/ash_test_base.h"
|
||||
#include "testing/gmock/include/gmock/gmock.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
@ -18,7 +20,7 @@ namespace ash::accelerators {
|
||||
|
||||
namespace {
|
||||
|
||||
using EventTypeVariant = absl::variant<ui::MouseEvent, ui::KeyEvent, bool>;
|
||||
using EventTypeVariant = std::variant<ui::MouseEvent, ui::KeyEvent, bool>;
|
||||
using LauncherState = AcceleratorLauncherStateMachine::LauncherState;
|
||||
|
||||
const bool kKeysPressed = true;
|
||||
@ -38,10 +40,10 @@ ui::KeyEvent KeyRelease(ui::KeyboardCode key_code) {
|
||||
}
|
||||
|
||||
ui::Event& GetEventFromVariant(EventTypeVariant& event) {
|
||||
if (absl::holds_alternative<ui::MouseEvent>(event)) {
|
||||
return absl::get<ui::MouseEvent>(event);
|
||||
if (std::holds_alternative<ui::MouseEvent>(event)) {
|
||||
return std::get<ui::MouseEvent>(event);
|
||||
} else {
|
||||
return absl::get<ui::KeyEvent>(event);
|
||||
return std::get<ui::KeyEvent>(event);
|
||||
}
|
||||
}
|
||||
|
||||
@ -132,9 +134,9 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
|
||||
TEST_P(AcceleratorLauncherStateMachineTest, StateTest) {
|
||||
for (auto& event : events_) {
|
||||
if (absl::holds_alternative<bool>(event)) {
|
||||
if (std::holds_alternative<bool>(event)) {
|
||||
ON_CALL(*input_controller_, AreAnyKeysPressed())
|
||||
.WillByDefault(testing::Return(absl::get<bool>(event)));
|
||||
.WillByDefault(testing::Return(std::get<bool>(event)));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
#include "ash/accelerators/accelerator_shift_disable_capslock_state_machine.h"
|
||||
|
||||
#include <variant>
|
||||
|
||||
#include "ash/test/ash_test_base.h"
|
||||
#include "testing/gmock/include/gmock/gmock.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
@ -26,7 +28,7 @@ class MockInputController : public ui::StubInputController {
|
||||
const bool kKeysPressed = true;
|
||||
const bool kNoKeysPressed = false;
|
||||
|
||||
using EventTypeVariant = absl::variant<ui::MouseEvent, ui::KeyEvent, bool>;
|
||||
using EventTypeVariant = std::variant<ui::MouseEvent, ui::KeyEvent, bool>;
|
||||
using ShiftDisableState =
|
||||
AcceleratorShiftDisableCapslockStateMachine::ShiftDisableState;
|
||||
|
||||
@ -55,10 +57,10 @@ ui::KeyEvent KeyRelease(ui::KeyboardCode key_code) {
|
||||
}
|
||||
|
||||
ui::Event& GetEventFromVariant(EventTypeVariant& event) {
|
||||
if (absl::holds_alternative<ui::MouseEvent>(event)) {
|
||||
return absl::get<ui::MouseEvent>(event);
|
||||
if (std::holds_alternative<ui::MouseEvent>(event)) {
|
||||
return std::get<ui::MouseEvent>(event);
|
||||
} else {
|
||||
return absl::get<ui::KeyEvent>(event);
|
||||
return std::get<ui::KeyEvent>(event);
|
||||
}
|
||||
}
|
||||
|
||||
@ -142,9 +144,9 @@ INSTANTIATE_TEST_SUITE_P(
|
||||
|
||||
TEST_P(AcceleratorShiftDisableCapslockStateMachineTest, StateTest) {
|
||||
for (auto& event : events_) {
|
||||
if (absl::holds_alternative<bool>(event)) {
|
||||
if (std::holds_alternative<bool>(event)) {
|
||||
ON_CALL(*input_controller_, AreAnyKeysPressed())
|
||||
.WillByDefault(testing::Return(absl::get<bool>(event)));
|
||||
.WillByDefault(testing::Return(std::get<bool>(event)));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include "base/test/metrics/histogram_tester.h"
|
||||
#include "base/test/scoped_feature_list.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "third_party/abseil-cpp/absl/types/variant.h"
|
||||
#include "ui/base/accelerators/ash/quick_insert_event_property.h"
|
||||
#include "ui/events/ash/mojom/modifier_key.mojom-shared.h"
|
||||
#include "ui/events/base_event_utils.h"
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/values.h"
|
||||
#include "components/manta/proto/scanner.pb.h"
|
||||
#include "third_party/abseil-cpp/absl/types/variant.h"
|
||||
|
||||
namespace ash {
|
||||
|
||||
@ -161,7 +160,7 @@ class UserFacingValueWriter {
|
||||
depth_limit_(depth_limit),
|
||||
output_limit_(output_limit) {}
|
||||
|
||||
void BuildString(absl::monostate node) { OutputValue("null"); }
|
||||
void BuildString(std::monostate node) { OutputValue("null"); }
|
||||
void BuildString(bool node) { OutputValue(node ? "true" : "false"); }
|
||||
void BuildString(int node) { OutputValue(base::NumberToString(node)); }
|
||||
void BuildString(double node) { OutputValue(base::NumberToString(node)); }
|
||||
|
@ -5,9 +5,10 @@
|
||||
#ifndef ASH_STYLE_BLURRED_BACKGROUND_SHIELD_H_
|
||||
#define ASH_STYLE_BLURRED_BACKGROUND_SHIELD_H_
|
||||
|
||||
#include <variant>
|
||||
|
||||
#include "ash/ash_export.h"
|
||||
#include "base/scoped_observation.h"
|
||||
#include "third_party/abseil-cpp/absl/types/variant.h"
|
||||
#include "ui/color/color_id.h"
|
||||
#include "ui/color/color_variant.h"
|
||||
#include "ui/compositor/layer.h"
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
#include "ash/style/icon_button.h"
|
||||
|
||||
#include <variant>
|
||||
|
||||
#include "ash/public/cpp/style/color_provider.h"
|
||||
#include "ash/style/blurred_background_shield.h"
|
||||
#include "ash/style/style_util.h"
|
||||
@ -227,11 +229,11 @@ std::unique_ptr<IconButton> IconButton::Builder::Build() {
|
||||
}
|
||||
|
||||
std::u16string accessible_name;
|
||||
if (absl::holds_alternative<int>(accessible_name_)) {
|
||||
if (std::holds_alternative<int>(accessible_name_)) {
|
||||
accessible_name =
|
||||
l10n_util::GetStringUTF16(absl::get<int>(accessible_name_));
|
||||
l10n_util::GetStringUTF16(std::get<int>(accessible_name_));
|
||||
} else {
|
||||
accessible_name = absl::get<std::u16string>(accessible_name_);
|
||||
accessible_name = std::get<std::u16string>(accessible_name_);
|
||||
}
|
||||
|
||||
auto button = std::make_unique<IconButton>(
|
||||
|
@ -6,11 +6,11 @@
|
||||
#define ASH_STYLE_ICON_BUTTON_H_
|
||||
|
||||
#include <optional>
|
||||
#include <variant>
|
||||
|
||||
#include "ash/ash_export.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "base/third_party/icu/icu_utf.h"
|
||||
#include "third_party/abseil-cpp/absl/types/variant.h"
|
||||
#include "ui/base/metadata/metadata_header_macros.h"
|
||||
#include "ui/color/color_id.h"
|
||||
#include "ui/color/color_variant.h"
|
||||
@ -110,7 +110,7 @@ class ASH_EXPORT IconButton : public views::ImageButton {
|
||||
Type type_;
|
||||
raw_ptr<const gfx::VectorIcon> icon_;
|
||||
std::optional<base_icu::UChar32> character_;
|
||||
absl::variant<int, std::u16string> accessible_name_;
|
||||
std::variant<int, std::u16string> accessible_name_;
|
||||
bool is_togglable_;
|
||||
bool has_border_;
|
||||
std::optional<int> view_id_;
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "ash/style/rounded_label_widget.h"
|
||||
|
||||
#include <memory>
|
||||
#include <variant>
|
||||
|
||||
#include "ash/public/cpp/window_properties.h"
|
||||
#include "ash/style/rounded_label.h"
|
||||
@ -49,9 +50,9 @@ void RoundedLabelWidget::Init(InitParams params) {
|
||||
SetContentsView(std::make_unique<RoundedLabel>(
|
||||
params.horizontal_padding, params.vertical_padding, params.rounding_dp,
|
||||
params.preferred_height,
|
||||
absl::holds_alternative<std::u16string>(params.message)
|
||||
? absl::get<std::u16string>(params.message)
|
||||
: l10n_util::GetStringUTF16(absl::get<int>(params.message))));
|
||||
std::holds_alternative<std::u16string>(params.message)
|
||||
? std::get<std::u16string>(params.message)
|
||||
: l10n_util::GetStringUTF16(std::get<int>(params.message))));
|
||||
Show();
|
||||
}
|
||||
|
||||
|
@ -6,9 +6,9 @@
|
||||
#define ASH_STYLE_ROUNDED_LABEL_WIDGET_H_
|
||||
|
||||
#include <string>
|
||||
#include <variant>
|
||||
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "third_party/abseil-cpp/absl/types/variant.h"
|
||||
#include "third_party/skia/include/core/SkColor.h"
|
||||
#include "ui/gfx/geometry/rect.h"
|
||||
#include "ui/views/widget/widget.h"
|
||||
@ -33,7 +33,7 @@ class RoundedLabelWidget : public views::Widget {
|
||||
// A message string or the string ID.
|
||||
// TODO(zxdan): change back to message ID if test string is no longer
|
||||
// needed.
|
||||
absl::variant<std::u16string, int> message;
|
||||
std::variant<std::u16string, int> message;
|
||||
raw_ptr<aura::Window> parent;
|
||||
bool disable_default_visibility_animation = false;
|
||||
};
|
||||
|
@ -2,10 +2,11 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include <variant>
|
||||
|
||||
#include "ash/style/rounded_rect_cutout_path_builder.h"
|
||||
#include "ash/style/style_viewer/system_ui_components_grid_view.h"
|
||||
#include "ash/style/style_viewer/system_ui_components_grid_view_factories.h"
|
||||
#include "third_party/abseil-cpp/absl/types/variant.h"
|
||||
#include "third_party/skia/include/core/SkColor.h"
|
||||
#include "ui/views/background.h"
|
||||
#include "ui/views/view.h"
|
||||
@ -34,7 +35,7 @@ struct CutoutSpec {
|
||||
struct CutoutEntry {
|
||||
std::u16string name;
|
||||
SkColor color;
|
||||
absl::variant<std::vector<CutoutSpec>, CutoutsSpec> cutouts;
|
||||
std::variant<std::vector<CutoutSpec>, CutoutsSpec> cutouts;
|
||||
std::optional<int> radius;
|
||||
std::optional<int> outer_radius;
|
||||
std::optional<int> inner_radius;
|
||||
@ -58,15 +59,15 @@ class CutoutsGridView : public SystemUIComponentsGridView {
|
||||
view->SetPreferredSize(std::make_optional<gfx::Size>(200, 150));
|
||||
auto builder =
|
||||
RoundedRectCutoutPathBuilder(gfx::SizeF(view->GetPreferredSize()));
|
||||
if (absl::holds_alternative<std::vector<CutoutSpec>>(entry.cutouts)) {
|
||||
const auto& cutouts = absl::get<std::vector<CutoutSpec>>(entry.cutouts);
|
||||
if (std::holds_alternative<std::vector<CutoutSpec>>(entry.cutouts)) {
|
||||
const auto& cutouts = std::get<std::vector<CutoutSpec>>(entry.cutouts);
|
||||
if (!cutouts.empty()) {
|
||||
for (const auto& spec : cutouts) {
|
||||
builder.AddCutout(spec.corner, gfx::SizeF(spec.size));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const CutoutsSpec& cutouts = absl::get<CutoutsSpec>(entry.cutouts);
|
||||
const CutoutsSpec& cutouts = std::get<CutoutsSpec>(entry.cutouts);
|
||||
if (!cutouts.corners.empty()) {
|
||||
for (const auto& corner : cutouts.corners) {
|
||||
builder.AddCutout(corner, gfx::SizeF(cutouts.cutout_size));
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "ash/system/focus_mode/sounds/focus_mode_sounds_view.h"
|
||||
|
||||
#include <memory>
|
||||
#include <variant>
|
||||
|
||||
#include "ash/public/cpp/system_tray_client.h"
|
||||
#include "ash/resources/vector_icons/vector_icons.h"
|
||||
@ -27,7 +28,6 @@
|
||||
#include "base/check_op.h"
|
||||
#include "base/containers/fixed_flat_map.h"
|
||||
#include "base/functional/bind.h"
|
||||
#include "third_party/abseil-cpp/absl/types/variant.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/metadata/metadata_impl_macros.h"
|
||||
#include "ui/chromeos/devicetype_utils.h"
|
||||
@ -325,12 +325,12 @@ constexpr std::partial_ordering FocusModeSoundsView::ToastData::operator<=>(
|
||||
return kActionValue.at(action_type) <=> kActionValue.at(other.action_type);
|
||||
}
|
||||
|
||||
if (absl::holds_alternative<int>(message)) {
|
||||
if (absl::holds_alternative<std::u16string>(other.message)) {
|
||||
if (std::holds_alternative<int>(message)) {
|
||||
if (std::holds_alternative<std::u16string>(other.message)) {
|
||||
return std::partial_ordering::less;
|
||||
}
|
||||
} else {
|
||||
if (absl::holds_alternative<int>(other.message)) {
|
||||
if (std::holds_alternative<int>(other.message)) {
|
||||
return std::partial_ordering::greater;
|
||||
}
|
||||
}
|
||||
@ -630,9 +630,9 @@ void FocusModeSoundsView::ProcessError(const ToastData& data) {
|
||||
}
|
||||
|
||||
const std::u16string& message =
|
||||
absl::holds_alternative<std::u16string>(data.message)
|
||||
? absl::get<std::u16string>(data.message)
|
||||
: l10n_util::GetStringUTF16(absl::get<int>(data.message));
|
||||
std::holds_alternative<std::u16string>(data.message)
|
||||
? std::get<std::u16string>(data.message)
|
||||
: l10n_util::GetStringUTF16(std::get<int>(data.message));
|
||||
ShowErrorMessageForType(
|
||||
data.source == focus_mode_util::SoundType::kSoundscape, message,
|
||||
data.action_type);
|
||||
|
@ -5,13 +5,14 @@
|
||||
#ifndef ASH_SYSTEM_FOCUS_MODE_SOUNDS_FOCUS_MODE_SOUNDS_VIEW_H_
|
||||
#define ASH_SYSTEM_FOCUS_MODE_SOUNDS_FOCUS_MODE_SOUNDS_VIEW_H_
|
||||
|
||||
#include <variant>
|
||||
|
||||
#include "ash/ash_export.h"
|
||||
#include "ash/style/error_message_toast.h"
|
||||
#include "ash/style/rounded_container.h"
|
||||
#include "ash/system/focus_mode/focus_mode_util.h"
|
||||
#include "ash/system/focus_mode/sounds/focus_mode_sounds_controller.h"
|
||||
#include "base/containers/flat_set.h"
|
||||
#include "third_party/abseil-cpp/absl/types/variant.h"
|
||||
#include "ui/base/metadata/metadata_header_macros.h"
|
||||
|
||||
namespace ash {
|
||||
@ -65,7 +66,7 @@ class ASH_EXPORT FocusModeSoundsView
|
||||
constexpr std::partial_ordering operator<=>(const ToastData& other) const;
|
||||
|
||||
focus_mode_util::SoundType source;
|
||||
absl::variant<int, std::u16string> message;
|
||||
std::variant<int, std::u16string> message;
|
||||
ErrorMessageToast::ButtonActionType action_type;
|
||||
bool fatal;
|
||||
};
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "ash/test/ash_test_util.h"
|
||||
|
||||
#include <string>
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
|
||||
#include "ash/frame/non_client_frame_view_ash.h"
|
||||
@ -280,17 +281,17 @@ views::MenuItemView* WaitForMenuItemWithLabel(const std::u16string& label) {
|
||||
}
|
||||
|
||||
chromeos::MultitaskMenu* ShowAndWaitMultitaskMenuForWindow(
|
||||
absl::variant<aura::Window*, chromeos::FrameSizeButton*>
|
||||
std::variant<aura::Window*, chromeos::FrameSizeButton*>
|
||||
window_or_size_button,
|
||||
chromeos::MultitaskMenuEntryType entry_type) {
|
||||
// If a size button object is passed, use that. Otherwise retrieve it from the
|
||||
// non client frame view ash.
|
||||
chromeos::FrameSizeButton* size_button = nullptr;
|
||||
if (absl::holds_alternative<chromeos::FrameSizeButton*>(
|
||||
if (std::holds_alternative<chromeos::FrameSizeButton*>(
|
||||
window_or_size_button)) {
|
||||
size_button = absl::get<chromeos::FrameSizeButton*>(window_or_size_button);
|
||||
size_button = std::get<chromeos::FrameSizeButton*>(window_or_size_button);
|
||||
} else {
|
||||
aura::Window* window = absl::get<aura::Window*>(window_or_size_button);
|
||||
aura::Window* window = std::get<aura::Window*>(window_or_size_button);
|
||||
CHECK(window);
|
||||
auto* frame_view = NonClientFrameViewAsh::Get(window);
|
||||
if (!frame_view) {
|
||||
|
@ -7,11 +7,11 @@
|
||||
|
||||
#include <cstddef>
|
||||
#include <string_view>
|
||||
#include <variant>
|
||||
|
||||
#include "chromeos/ui/frame/caption_buttons/frame_size_button.h"
|
||||
#include "chromeos/ui/frame/multitask_menu/multitask_menu_metrics.h"
|
||||
#include "services/data_decoder/public/mojom/image_decoder.mojom-shared.h"
|
||||
#include "third_party/abseil-cpp/absl/types/variant.h"
|
||||
#include "third_party/skia/include/core/SkColor.h"
|
||||
#include "ui/aura/window.h"
|
||||
#include "ui/gfx/image/image_skia.h"
|
||||
@ -91,7 +91,7 @@ views::MenuItemView* WaitForMenuItemWithLabel(const std::u16string& label);
|
||||
// therefore their own size button. We use that if it is passed, otherwise try
|
||||
// to fetch the size button from the non client frame view ash.
|
||||
chromeos::MultitaskMenu* ShowAndWaitMultitaskMenuForWindow(
|
||||
absl::variant<aura::Window*, chromeos::FrameSizeButton*>
|
||||
std::variant<aura::Window*, chromeos::FrameSizeButton*>
|
||||
window_or_size_button,
|
||||
chromeos::MultitaskMenuEntryType entry_type =
|
||||
chromeos::MultitaskMenuEntryType::kFrameSizeButtonHover);
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
|
||||
#include "ash/accelerators/accelerator_lookup.h"
|
||||
@ -54,7 +55,6 @@
|
||||
#include "components/user_manager/user_type.h"
|
||||
#include "testing/gmock/include/gmock/gmock.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
#include "third_party/abseil-cpp/absl/types/variant.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/mojom/ui_base_types.mojom-shared.h"
|
||||
#include "ui/chromeos/devicetype_utils.h"
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
#include "ash/webui/eche_app_ui/launch_app_helper.h"
|
||||
|
||||
#include <variant>
|
||||
|
||||
#include "ash/constants/notifier_catalogs.h"
|
||||
#include "ash/public/cpp/system/toast_data.h"
|
||||
#include "ash/public/cpp/system/toast_manager.h"
|
||||
@ -30,12 +32,12 @@ constexpr base::TimeDelta kPackageSetResetFrequency = base::Days(1);
|
||||
|
||||
LaunchAppHelper::NotificationInfo::NotificationInfo(
|
||||
Category category,
|
||||
absl::variant<NotificationType, mojom::WebNotificationType> type)
|
||||
std::variant<NotificationType, mojom::WebNotificationType> type)
|
||||
: category_(category), type_(type) {
|
||||
DCHECK(nullptr != absl::get_if<NotificationType>(&type)
|
||||
DCHECK(nullptr != std::get_if<NotificationType>(&type)
|
||||
? category == Category::kNative
|
||||
: category == Category::kWebUI);
|
||||
DCHECK(nullptr != absl::get_if<mojom::WebNotificationType>(&type)
|
||||
DCHECK(nullptr != std::get_if<mojom::WebNotificationType>(&type)
|
||||
? category == Category::kWebUI
|
||||
: category == Category::kNative);
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
#define ASH_WEBUI_ECHE_APP_UI_LAUNCH_APP_HELPER_H_
|
||||
|
||||
#include <optional>
|
||||
#include <variant>
|
||||
|
||||
#include "ash/webui/eche_app_ui/feature_status.h"
|
||||
#include "ash/webui/eche_app_ui/mojom/eche_app.mojom.h"
|
||||
@ -13,7 +14,6 @@
|
||||
#include "base/functional/callback.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "base/timer/timer.h"
|
||||
#include "third_party/abseil-cpp/absl/types/variant.h"
|
||||
|
||||
namespace gfx {
|
||||
class Image;
|
||||
@ -50,17 +50,17 @@ class LaunchAppHelper {
|
||||
|
||||
NotificationInfo(
|
||||
Category category,
|
||||
absl::variant<NotificationType, mojom::WebNotificationType> type);
|
||||
std::variant<NotificationType, mojom::WebNotificationType> type);
|
||||
~NotificationInfo();
|
||||
|
||||
Category category() const { return category_; }
|
||||
absl::variant<NotificationType, mojom::WebNotificationType> type() const {
|
||||
std::variant<NotificationType, mojom::WebNotificationType> type() const {
|
||||
return type_;
|
||||
}
|
||||
|
||||
private:
|
||||
Category category_;
|
||||
absl::variant<NotificationType, mojom::WebNotificationType> type_;
|
||||
std::variant<NotificationType, mojom::WebNotificationType> type_;
|
||||
};
|
||||
|
||||
using LaunchNotificationFunction =
|
||||
|
Reference in New Issue
Block a user