summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authorctguil@chromium.org <ctguil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-18 22:37:17 +0000
committerctguil@chromium.org <ctguil@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-18 22:37:17 +0000
commitff97180e9844dcb229ddde6c9af40d4f481b8959 (patch)
tree85256bde8254b4245a66d56ea549d7e87ff2e103 /views
parent4a7a3ac0fdb069ea4190a826b4bccd10babddf5b (diff)
downloadchromium_src-ff97180e9844dcb229ddde6c9af40d4f481b8959.zip
chromium_src-ff97180e9844dcb229ddde6c9af40d4f481b8959.tar.gz
chromium_src-ff97180e9844dcb229ddde6c9af40d4f481b8959.tar.bz2
views: Implement accessibility issue that was a TODO in the new progress bar control.
BUG=None TEST=compiles Review URL: http://codereview.chromium.org/930001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42017 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/controls/progress_bar.cc11
-rw-r--r--views/controls/progress_bar.h4
2 files changed, 13 insertions, 2 deletions
diff --git a/views/controls/progress_bar.cc b/views/controls/progress_bar.cc
index 1b1af25..053c16d 100644
--- a/views/controls/progress_bar.cc
+++ b/views/controls/progress_bar.cc
@@ -13,7 +13,6 @@
#include "app/resource_bundle.h"
#include "base/logging.h"
#include "base/string_util.h"
-#include "gfx/insets.h"
#include "third_party/skia/include/effects/SkGradientShader.h"
#include "third_party/skia/include/effects/SkBlurMaskFilter.h"
#include "views/background.h"
@@ -197,7 +196,11 @@ bool ProgressBar::GetAccessibleName(std::wstring* name) {
DCHECK(name);
if (name == NULL)
return false;
- // TODO(denisromanov): Return valid text here.
+
+ if (!accessible_name_.empty()) {
+ *name = accessible_name_;
+ return true;
+ }
return false;
}
@@ -209,4 +212,8 @@ bool ProgressBar::GetAccessibleState(AccessibilityTypes::State* state) {
return true;
}
+void ProgressBar::SetAccessibleName(const std::wstring& name) {
+ accessible_name_.assign(name);
+}
+
} // namespace views
diff --git a/views/controls/progress_bar.h b/views/controls/progress_bar.h
index 65d10d7..1047da3 100644
--- a/views/controls/progress_bar.h
+++ b/views/controls/progress_bar.h
@@ -60,6 +60,7 @@ class ProgressBar : public View {
virtual bool GetAccessibleRole(AccessibilityTypes::Role* role);
virtual bool GetAccessibleName(std::wstring* name);
virtual bool GetAccessibleState(AccessibilityTypes::State* state);
+ virtual void SetAccessibleName(const std::wstring& name);
// Maximum value of progress.
static const int kMaxProgress;
@@ -74,6 +75,9 @@ class ProgressBar : public View {
// The view class name.
static const char kViewClassName[];
+ // The storage string for the accessibility name associated with this control.
+ std::wstring accessible_name_;
+
DISALLOW_COPY_AND_ASSIGN(ProgressBar);
};