Commit 7f114ec8 authored by Hwanseung Lee's avatar Hwanseung Lee Committed by Commit Bot

Convert enum to enum class for views::SliderChangeReason

Use enum class instead of enum for views::SliderChangeReason.
enum class is more type safety.

Bug: 940736
Change-Id: I396a74e79cdf6da52163d875fcceffa20920968f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2128033Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Commit-Queue: Hwanseung Lee <hs1217.lee@samsung.com>
Cr-Commit-Position: refs/heads/master@{#755194}
parent a44a26ac
......@@ -50,7 +50,7 @@ void UnifiedVolumeSliderController::SliderValueChanged(
float value,
float old_value,
views::SliderChangeReason reason) {
if (reason != views::VALUE_CHANGED_BY_USER)
if (reason != views::SliderChangeReason::kByUser)
return;
const int level = value * 100;
......
......@@ -43,7 +43,7 @@ void UnifiedBrightnessSliderController::SliderValueChanged(
float value,
float old_value,
views::SliderChangeReason reason) {
if (reason != views::VALUE_CHANGED_BY_USER)
if (reason != views::SliderChangeReason::kByUser)
return;
BrightnessControlDelegate* brightness_control_delegate =
......
......@@ -69,7 +69,7 @@ float Slider::GetValue() const {
}
void Slider::SetValue(float value) {
SetValueInternal(value, VALUE_CHANGED_BY_API);
SetValueInternal(value, SliderChangeReason::kByApi);
}
bool Slider::GetEnableAccessibilityEvents() const {
......@@ -180,7 +180,7 @@ void Slider::MoveButtonTo(const gfx::Point& point) {
: point.x() - inset.left() - initial_button_offset_;
SetValueInternal(
static_cast<float>(amount) / (width() - inset.width() - kThumbWidth),
VALUE_CHANGED_BY_USER);
SliderChangeReason::kByUser);
}
void Slider::OnSliderDragStarted() {
......@@ -240,7 +240,7 @@ bool Slider::OnKeyPressed(const ui::KeyEvent& event) {
return false;
}
SetValueInternal(value_ + direction * keyboard_increment_,
VALUE_CHANGED_BY_USER);
SliderChangeReason::kByUser);
return true;
}
......
......@@ -22,9 +22,9 @@ class SliderTestApi;
class Slider;
enum SliderChangeReason {
VALUE_CHANGED_BY_USER, // value was changed by the user (by clicking, e.g.)
VALUE_CHANGED_BY_API, // value was changed by a call to SetValue.
enum class SliderChangeReason {
kByUser, // value was changed by the user (e.g. by clicking)
kByApi, // value was changed by a call to SetValue.
};
class VIEWS_EXPORT SliderListener {
......
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