Commit cfee36b5 authored by Kristyn Hamasaki's avatar Kristyn Hamasaki Committed by Commit Bot

Convert some Throbber and SmootherThrobber fields to properties

Bug: 972145
Change-Id: I47f5ec08c7dbd5639f4e11a4aeb8095b03453a37
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1674451Reviewed-by: default avatarAllen Bauer <kylixrd@chromium.org>
Commit-Queue: Kristyn Hamasaki <khamasaki@google.com>
Cr-Commit-Position: refs/heads/master@{#672547}
parent 1c15cb31
......@@ -52,12 +52,16 @@ void Throbber::Stop() {
SchedulePaint();
}
bool Throbber::GetChecked() const {
return checked_;
}
void Throbber::SetChecked(bool checked) {
if (checked == checked_)
return;
checked_ = checked;
SchedulePaint();
OnPropertyChanged(&checked_, kPropertyEffectsPaint);
}
gfx::Size Throbber::CalculatePreferredSize() const {
......@@ -88,6 +92,7 @@ bool Throbber::IsRunning() const {
BEGIN_METADATA(Throbber)
METADATA_PARENT_CLASS(View)
ADD_PROPERTY_METADATA(Throbber, bool, Checked)
END_METADATA()
// Smoothed throbber ---------------------------------------------------------
......@@ -128,12 +133,36 @@ void SmoothedThrobber::Stop() {
&SmoothedThrobber::StopDelayOver);
}
int SmoothedThrobber::GetStartDelayMs() const {
return start_delay_ms_;
}
void SmoothedThrobber::SetStartDelayMs(int start_delay_ms) {
if (start_delay_ms == start_delay_ms_)
return;
start_delay_ms_ = start_delay_ms;
OnPropertyChanged(&start_delay_ms_, kPropertyEffectsNone);
}
int SmoothedThrobber::GetStopDelayMs() const {
return stop_delay_ms_;
}
void SmoothedThrobber::SetStopDelayMs(int stop_delay_ms) {
if (stop_delay_ms == stop_delay_ms_)
return;
stop_delay_ms_ = stop_delay_ms;
OnPropertyChanged(&stop_delay_ms_, kPropertyEffectsNone);
}
void SmoothedThrobber::StopDelayOver() {
Throbber::Stop();
}
BEGIN_METADATA(SmoothedThrobber)
METADATA_PARENT_CLASS(Throbber)
ADD_PROPERTY_METADATA(SmoothedThrobber, int, StartDelayMs)
ADD_PROPERTY_METADATA(SmoothedThrobber, int, StopDelayMs)
END_METADATA()
} // namespace views
......@@ -25,7 +25,9 @@ class VIEWS_EXPORT Throbber : public View {
virtual void Start();
virtual void Stop();
// Stop spinning and, if checked is true, display a checkmark.
// Gets/Sets checked. For SetChecked, stop spinning and, if
// checked is true, display a checkmark.
bool GetChecked() const;
void SetChecked(bool checked);
// Overridden from View:
......@@ -59,8 +61,11 @@ class VIEWS_EXPORT SmoothedThrobber : public Throbber {
void Start() override;
void Stop() override;
void set_start_delay_ms(int value) { start_delay_ms_ = value; }
void set_stop_delay_ms(int value) { stop_delay_ms_ = value; }
int GetStartDelayMs() const;
void SetStartDelayMs(int start_delay_ms);
int GetStopDelayMs() const;
void SetStopDelayMs(int stop_delay_ms);
private:
// Called when the startup-delay timer fires
......
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