Commit 4ee93960 authored by Alexander Alekseev's avatar Alexander Alekseev Committed by Commit Bot

Ash HUD: Make animation duration changes permenent.

Implemented permanent ScopedAnimationDuration object to persist animation
duration changes.

Bug: 1137643
Change-Id: Iacaad772114ff4bc262080f809ad37fb009f642a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2466841
Commit-Queue: Alexander Alekseev <alemate@chromium.org>
Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#816879}
parent f6e22b3b
......@@ -25,6 +25,12 @@
namespace ash {
namespace hud_display {
namespace {
ui::ScopedAnimationDurationScaleMode* scoped_animation_duration_scale_mode =
nullptr;
} // anonymous namespace
class HUDCheckboxHandler {
public:
......@@ -207,9 +213,6 @@ class AnimationSpeedControl : public views::SliderListener, public views::View {
// Map slider values to animation scale.
using SliderValuesMap = base::flat_map<float, float>;
std::unique_ptr<ui::ScopedAnimationDurationScaleMode>
scoped_animation_duration_scale_mode_;
views::View* hints_container_ = nullptr; // not owned.
AnimationSpeedSlider* slider_ = nullptr; // not owned.
......@@ -306,10 +309,11 @@ void AnimationSpeedControl::SliderValueChanged(
// There could be only one instance of the scoped modifier at a time.
// So we need to destroy the existing one before we can create a
// new one.
scoped_animation_duration_scale_mode_.reset();
delete scoped_animation_duration_scale_mode;
scoped_animation_duration_scale_mode = nullptr;
if (multiplier != 1) {
scoped_animation_duration_scale_mode_ =
std::make_unique<ui::ScopedAnimationDurationScaleMode>(multiplier);
scoped_animation_duration_scale_mode =
new ui::ScopedAnimationDurationScaleMode(multiplier);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment