diff options
Diffstat (limited to 'views/controls/textfield')
-rw-r--r-- | views/controls/textfield/textfield.cc | 13 | ||||
-rw-r--r-- | views/controls/textfield/textfield.h | 1 |
2 files changed, 14 insertions, 0 deletions
diff --git a/views/controls/textfield/textfield.cc b/views/controls/textfield/textfield.cc index d2e2fae..71f66b4 100644 --- a/views/controls/textfield/textfield.cc +++ b/views/controls/textfield/textfield.cc @@ -12,6 +12,7 @@ #include "base/keyboard_codes.h" #include "base/string_util.h" +#include "base/utf_string_conversions.h" #include "gfx/insets.h" #include "views/controls/native/native_view_host.h" #include "views/controls/textfield/native_textfield_wrapper.h" @@ -284,6 +285,18 @@ void Textfield::SetAccessibleName(const std::wstring& name) { accessible_name_.assign(name); } +bool Textfield::GetAccessibleValue(std::wstring* value) { + DCHECK(value); + if (!value) + return false; + + if (!text_.empty()) { + *value = UTF16ToWide(text_); + return true; + } + return false; +} + void Textfield::SetEnabled(bool enabled) { View::SetEnabled(enabled); if (native_wrapper_) diff --git a/views/controls/textfield/textfield.h b/views/controls/textfield/textfield.h index 4b8076c..7b36547 100644 --- a/views/controls/textfield/textfield.h +++ b/views/controls/textfield/textfield.h @@ -226,6 +226,7 @@ class Textfield : public View { virtual bool GetAccessibleName(std::wstring* name); virtual bool GetAccessibleState(AccessibilityTypes::State* state); virtual void SetAccessibleName(const std::wstring& name); + virtual bool GetAccessibleValue(std::wstring* value); protected: virtual void Focus(); |