0

Replace usages of static_cast with views::AsViewClass

Change-Id: Ifa49326a8faee8b3c4ab251529648c089c4b9581
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5778519
Reviewed-by: Ahmed Fakhry <afakhry@chromium.org>
Commit-Queue: David Padlipsky <dpad@google.com>
Cr-Commit-Position: refs/heads/main@{#1343057}
This commit is contained in:
David Padlipsky
2024-08-16 21:46:52 +00:00
committed by Chromium LUCI CQ
parent 276e05c7bd
commit b0543a5e5c

@ -220,8 +220,10 @@ void TouchCalibratorController::StopCalibrationAndResetParams() {
if (state_ == CalibrationState::kNativeCalibration ||
state_ == CalibrationState::kNativeCalibrationTouchscreenMapping) {
for (const auto& it : touch_calibrator_widgets_) {
static_cast<TouchCalibratorView*>(it.second->GetContentsView())
->SkipToFinalState();
if (auto* touch_calibrator_view = views::AsViewClass<TouchCalibratorView>(
it.second->GetContentsView())) {
touch_calibrator_view->SkipToFinalState();
}
}
}
@ -327,8 +329,9 @@ void TouchCalibratorController::OnTouchEvent(ui::TouchEvent* touch) {
touch->StopPropagation();
TouchCalibratorView* target_screen_calibration_view =
static_cast<TouchCalibratorView*>(
views::AsViewClass<TouchCalibratorView>(
touch_calibrator_widgets_[target_display_.id()]->GetContentsView());
CHECK(target_screen_calibration_view);
// If this is the final state, then store all calibration data and stop
// calibration.