diff options
author | ctguil@chromium.org <ctguil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-26 21:51:04 +0000 |
---|---|---|
committer | ctguil@chromium.org <ctguil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-26 21:51:04 +0000 |
commit | a9d59460c07913177e8bf149276a433403783c88 (patch) | |
tree | e661ac21a58003c4e5a1ddd0afb550258ace59ee /views/controls | |
parent | 78d36a2f101aaa7dea9820b7001672c8f5f78f4f (diff) | |
download | chromium_src-a9d59460c07913177e8bf149276a433403783c88.zip chromium_src-a9d59460c07913177e8bf149276a433403783c88.tar.gz chromium_src-a9d59460c07913177e8bf149276a433403783c88.tar.bz2 |
views: [accessibility] Add support for Accessibility Value.
BUG=9604
TEST=point AccExplorer to Edit Bookmark dialog, see if everything has a MSAA information, like: Name, Role, State, Value.
Patch from Thiago Farina <thiago.farina@gmail.com>
Review URL: http://codereview.chromium.org/928001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42831 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/controls')
-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(); |