| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/views/controls/button/button.h" | 5 #include "ui/views/controls/button/button.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "ui/accessibility/ax_node_data.h" | 8 #include "ui/accessibility/ax_node_data.h" |
| 9 | 9 |
| 10 namespace views { | 10 namespace views { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 return false; | 59 return false; |
| 60 | 60 |
| 61 *tooltip = tooltip_text_; | 61 *tooltip = tooltip_text_; |
| 62 return true; | 62 return true; |
| 63 } | 63 } |
| 64 | 64 |
| 65 void Button::GetAccessibleNodeData(ui::AXNodeData* node_data) { | 65 void Button::GetAccessibleNodeData(ui::AXNodeData* node_data) { |
| 66 node_data->role = ui::AX_ROLE_BUTTON; | 66 node_data->role = ui::AX_ROLE_BUTTON; |
| 67 node_data->SetName(accessible_name_); | 67 node_data->SetName(accessible_name_); |
| 68 if (!enabled()) | 68 if (!enabled()) |
| 69 node_data->AddStateFlag(ui::AX_STATE_DISABLED); | 69 node_data->AddState(ui::AX_STATE_DISABLED); |
| 70 } | 70 } |
| 71 | 71 |
| 72 //////////////////////////////////////////////////////////////////////////////// | 72 //////////////////////////////////////////////////////////////////////////////// |
| 73 // Button, protected: | 73 // Button, protected: |
| 74 | 74 |
| 75 Button::Button(ButtonListener* listener) | 75 Button::Button(ButtonListener* listener) |
| 76 : listener_(listener), | 76 : listener_(listener), |
| 77 tag_(-1) { | 77 tag_(-1) { |
| 78 SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY); | 78 SetFocusBehavior(FocusBehavior::ACCESSIBLE_ONLY); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void Button::NotifyClick(const ui::Event& event) { | 81 void Button::NotifyClick(const ui::Event& event) { |
| 82 // We can be called when there is no listener, in cases like double clicks on | 82 // We can be called when there is no listener, in cases like double clicks on |
| 83 // menu buttons etc. | 83 // menu buttons etc. |
| 84 if (listener_) | 84 if (listener_) |
| 85 listener_->ButtonPressed(this, event); | 85 listener_->ButtonPressed(this, event); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void Button::OnClickCanceled(const ui::Event& event) {} | 88 void Button::OnClickCanceled(const ui::Event& event) {} |
| 89 | 89 |
| 90 } // namespace views | 90 } // namespace views |
| OLD | NEW |