Chromium Code Reviews| Index: ui/views/controls/slider.cc |
| diff --git a/ui/views/controls/slider.cc b/ui/views/controls/slider.cc |
| index 5e3a38fce6ecff16a91a0a6ba69c28b6d361f835..139a0e1e9faa6695f7a893f1a149bab6ca060518 100644 |
| --- a/ui/views/controls/slider.cc |
| +++ b/ui/views/controls/slider.cc |
| @@ -6,13 +6,17 @@ |
| #include "base/logging.h" |
| #include "base/message_loop.h" |
| +#include "base/stringprintf.h" |
| +#include "base/utf_string_conversions.h" |
| #include "third_party/skia/include/core/SkCanvas.h" |
| #include "third_party/skia/include/core/SkColor.h" |
| #include "third_party/skia/include/core/SkPaint.h" |
| +#include "ui/base/accessibility/accessible_view_state.h" |
| #include "ui/base/animation/slide_animation.h" |
| #include "ui/gfx/canvas.h" |
| #include "ui/gfx/point.h" |
| #include "ui/gfx/rect.h" |
| +#include "ui/views/widget/widget.h" |
| namespace { |
| const int kSlideValueChangeDurationMS = 150; |
| @@ -62,6 +66,12 @@ void Slider::SetValueInternal(float value, SliderChangeReason reason) { |
| } else { |
| SchedulePaint(); |
| } |
| + GetWidget()->NotifyAccessibilityEvent( |
|
sadrul
2012/03/12 08:40:47
A NULL check here for GetWidget(), in case the val
dmazzoni
2012/03/12 08:44:11
Done.
|
| + this, ui::AccessibilityTypes::EVENT_VALUE_CHANGED, true); |
| +} |
| + |
| +void Slider::SetAccessibleName(const string16& name) { |
| + accessible_name_ = name; |
| } |
| gfx::Size Slider::GetPreferredSize() { |
| @@ -147,4 +157,11 @@ void Slider::AnimationProgressed(const ui::Animation* animation) { |
| SchedulePaint(); |
| } |
| +void Slider::GetAccessibleState(ui::AccessibleViewState* state) { |
| + state->role = ui::AccessibilityTypes::ROLE_SLIDER; |
| + state->name = accessible_name_; |
| + state->value = UTF8ToUTF16( |
| + base::StringPrintf("%d%%", (int)(value_ * 100 + 0.5))); |
| +} |
| + |
| } // namespace views |