| Index: ui/views/controls/progress_bar.h
|
| diff --git a/ui/views/controls/progress_bar.h b/ui/views/controls/progress_bar.h
|
| index 3fb5fb7f7f2cb496608d1aae9f3e0be7da7e2a5e..aa09845c7a8cf1f7eddf3c74e702b65c797b9b9b 100644
|
| --- a/ui/views/controls/progress_bar.h
|
| +++ b/ui/views/controls/progress_bar.h
|
| @@ -7,58 +7,60 @@
|
|
|
| #include "base/compiler_specific.h"
|
| #include "base/macros.h"
|
| +#include "ui/gfx/animation/animation_delegate.h"
|
| #include "ui/views/view.h"
|
|
|
| +namespace gfx {
|
| +class LinearAnimation;
|
| +}
|
| +
|
| namespace views {
|
|
|
| // Progress bar is a control that indicates progress visually.
|
| -class VIEWS_EXPORT ProgressBar : public View {
|
| +class VIEWS_EXPORT ProgressBar : public View, public gfx::AnimationDelegate {
|
| public:
|
| - // The value range defaults to [0.0, 1.0].
|
| - ProgressBar();
|
| + // The preferred height parameter makes it easier to use a ProgressBar with
|
| + // layout managers that size to preferred size.
|
| + explicit ProgressBar(int preferred_height = 5);
|
| ~ProgressBar() override;
|
|
|
| - double current_value() const { return current_value_; }
|
| -
|
| - // Gets a normalized current value in [0.0, 1.0] range based on current value
|
| - // range and the min/max display value range.
|
| - double GetNormalizedValue() const;
|
| + // Overridden from View:
|
| + void GetAccessibleState(ui::AXViewState* state) override;
|
| + gfx::Size GetPreferredSize() const override;
|
| + const char* GetClassName() const override;
|
| + void OnPaint(gfx::Canvas* canvas) override;
|
|
|
| - // Sets the inclusive range of values to be displayed. Values outside of the
|
| - // range will be capped when displayed.
|
| - void SetDisplayRange(double min_display_value, double max_display_value);
|
| + double current_value() const { return current_value_; }
|
|
|
| - // Sets the current value. Values outside of the range [min_display_value_,
|
| - // max_display_value_] will be stored unmodified and capped for display.
|
| + // Sets the current value. Values outside of the display range of 0.0-1.0 will
|
| + // be displayed with an infinite loading animation.
|
| void SetValue(double value);
|
|
|
| - // Sets the tooltip text. Default behavior for a progress bar is to show no
|
| - // tooltip on mouse hover. Calling this lets you set a custom tooltip. To
|
| - // revert to default behavior, call this with an empty string.
|
| - void SetTooltipText(const base::string16& tooltip_text);
|
| + protected:
|
| + // The color of the progress portion.
|
| + SkColor GetForegroundColor() const;
|
| + // The color of the portion that displays potential progress.
|
| + SkColor GetBackgroundColor() const;
|
|
|
| - // Overridden from View:
|
| - bool GetTooltipText(const gfx::Point& p,
|
| - base::string16* tooltip) const override;
|
| - void GetAccessibleState(ui::AXViewState* state) override;
|
| + int preferred_height() const { return preferred_height_; }
|
|
|
| private:
|
| static const char kViewClassName[];
|
|
|
| - // Overridden from View:
|
| - gfx::Size GetPreferredSize() const override;
|
| - const char* GetClassName() const override;
|
| - void OnPaint(gfx::Canvas* canvas) override;
|
| + // gfx::AnimationDelegate:
|
| + void AnimationProgressed(const gfx::Animation* animation) override;
|
| + void AnimationEnded(const gfx::Animation* animation) override;
|
| +
|
| + bool IsIndeterminate();
|
| + void OnPaintIndeterminate(gfx::Canvas* canvas);
|
|
|
| - // Inclusive range used when displaying values.
|
| - double min_display_value_;
|
| - double max_display_value_;
|
| + // Current progress to display, should be in the range 0.0 to 1.0.
|
| + double current_value_ = 0.0;
|
|
|
| - // Current value. May be outside of [min_display_value_, max_display_value_].
|
| - double current_value_;
|
| + // In DP, the preferred height of this progress bar.
|
| + const int preferred_height_;
|
|
|
| - // Tooltip text.
|
| - base::string16 tooltip_text_;
|
| + std::unique_ptr<gfx::LinearAnimation> indeterminate_bar_animation_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(ProgressBar);
|
| };
|
|
|