| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |