Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: views/controls/button/checkbox.cc

Issue 1102006: Add Accessibility name for native buttons. (Closed)
Patch Set: Add Accessibility for Native Buttons Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « views/controls/button/checkbox.h ('k') | views/controls/button/native_button.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "views/controls/button/checkbox.h" 5 #include "views/controls/button/checkbox.h"
6 6
7 #include "app/gfx/canvas.h" 7 #include "app/gfx/canvas.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "views/controls/label.h" 9 #include "views/controls/label.h"
10 10
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 label_->set_paint_as_focused(false); 153 label_->set_paint_as_focused(false);
154 } 154 }
155 155
156 bool Checkbox::GetAccessibleRole(AccessibilityTypes::Role* role) { 156 bool Checkbox::GetAccessibleRole(AccessibilityTypes::Role* role) {
157 DCHECK(role); 157 DCHECK(role);
158 158
159 *role = AccessibilityTypes::ROLE_CHECKBUTTON; 159 *role = AccessibilityTypes::ROLE_CHECKBUTTON;
160 return true; 160 return true;
161 } 161 }
162 162
163 bool Checkbox::GetAccessibleName(std::wstring* name) {
164 DCHECK(name);
165 *name = label_->GetText();
166 return !name->empty();
167 }
168
169 std::string Checkbox::GetClassName() const { 163 std::string Checkbox::GetClassName() const {
170 return kViewClassName; 164 return kViewClassName;
171 } 165 }
172 166
173 //////////////////////////////////////////////////////////////////////////////// 167 ////////////////////////////////////////////////////////////////////////////////
174 // Checkbox, NativeButton overrides: 168 // Checkbox, NativeButton overrides:
175 169
176 NativeButtonWrapper* Checkbox::CreateWrapper() { 170 NativeButtonWrapper* Checkbox::CreateWrapper() {
177 NativeButtonWrapper* native_wrapper = 171 NativeButtonWrapper* native_wrapper =
178 NativeButtonWrapper::CreateCheckboxWrapper(this); 172 NativeButtonWrapper::CreateCheckboxWrapper(this);
(...skipping 27 matching lines...) Expand all
206 void Checkbox::Init(const std::wstring& label_text) { 200 void Checkbox::Init(const std::wstring& label_text) {
207 // Checkboxs don't need to enforce a minimum size. 201 // Checkboxs don't need to enforce a minimum size.
208 set_ignore_minimum_size(true); 202 set_ignore_minimum_size(true);
209 label_ = new Label(label_text); 203 label_ = new Label(label_text);
210 label_->SetHasFocusBorder(true); 204 label_->SetHasFocusBorder(true);
211 label_->SetHorizontalAlignment(Label::ALIGN_LEFT); 205 label_->SetHorizontalAlignment(Label::ALIGN_LEFT);
212 AddChildView(label_); 206 AddChildView(label_);
213 } 207 }
214 208
215 } // namespace views 209 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/button/checkbox.h ('k') | views/controls/button/native_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698