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

Side by Side Diff: views/controls/button/native_button.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.cc ('k') | no next file » | 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) 2009 The Chromium Authors. All rights reserved. Use of this 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // LICENSE file.
4 4
5 #include "views/controls/button/native_button.h" 5 #include "views/controls/button/native_button.h"
6 6
7 #if defined(OS_LINUX) 7 #if defined(OS_LINUX)
8 #include <gdk/gdkkeysyms.h> 8 #include <gdk/gdkkeysyms.h>
9 #include "views/screen.h" 9 #include "views/screen.h"
10 #endif 10 #endif
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // 70 //
71 // In order to overcome this problem, we mark the localized Hebrew strings as 71 // In order to overcome this problem, we mark the localized Hebrew strings as
72 // RTL strings explicitly (using the appropriate Unicode formatting) so that 72 // RTL strings explicitly (using the appropriate Unicode formatting) so that
73 // Windows displays the text correctly regardless of the HWND hierarchy. 73 // Windows displays the text correctly regardless of the HWND hierarchy.
74 std::wstring localized_label; 74 std::wstring localized_label;
75 if (base::i18n::AdjustStringForLocaleDirection(label_, &localized_label)) 75 if (base::i18n::AdjustStringForLocaleDirection(label_, &localized_label))
76 label_ = localized_label; 76 label_ = localized_label;
77 77
78 if (native_wrapper_) 78 if (native_wrapper_)
79 native_wrapper_->UpdateLabel(); 79 native_wrapper_->UpdateLabel();
80
81 // Update the accessible name whenever the label changes.
82 SetAccessibleName(label);
80 } 83 }
81 84
82 void NativeButton::SetIsDefault(bool is_default) { 85 void NativeButton::SetIsDefault(bool is_default) {
83 if (is_default == is_default_) 86 if (is_default == is_default_)
84 return; 87 return;
85 if (is_default) 88 if (is_default)
86 AddAccelerator(Accelerator(base::VKEY_RETURN, false, false, false)); 89 AddAccelerator(Accelerator(base::VKEY_RETURN, false, false, false));
87 else 90 else
88 RemoveAccelerator(Accelerator(base::VKEY_RETURN, false, false, false)); 91 RemoveAccelerator(Accelerator(base::VKEY_RETURN, false, false, false));
89 SetAppearsAsDefault(is_default); 92 SetAppearsAsDefault(is_default);
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 native_wrapper->UpdateEnabled(); 215 native_wrapper->UpdateEnabled();
213 return native_wrapper; 216 return native_wrapper;
214 } 217 }
215 218
216 void NativeButton::InitBorder() { 219 void NativeButton::InitBorder() {
217 set_border(Border::CreateEmptyBorder(0, kButtonBorderHWidth, 0, 220 set_border(Border::CreateEmptyBorder(0, kButtonBorderHWidth, 0,
218 kButtonBorderHWidth)); 221 kButtonBorderHWidth));
219 } 222 }
220 223
221 } // namespace views 224 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/button/checkbox.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698