OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/custom_button.h" | 5 #include "ui/views/controls/button/custom_button.h" |
6 | 6 |
7 #include "ui/accessibility/ax_node_data.h" | 7 #include "ui/accessibility/ax_node_data.h" |
8 #include "ui/events/event.h" | 8 #include "ui/events/event.h" |
9 #include "ui/events/event_utils.h" | 9 #include "ui/events/event_utils.h" |
10 #include "ui/events/keycodes/keyboard_codes.h" | 10 #include "ui/events/keycodes/keyboard_codes.h" |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 node_data->AddStateFlag(ui::AX_STATE_PRESSED); | 344 node_data->AddStateFlag(ui::AX_STATE_PRESSED); |
345 break; | 345 break; |
346 case STATE_DISABLED: | 346 case STATE_DISABLED: |
347 node_data->AddStateFlag(ui::AX_STATE_DISABLED); | 347 node_data->AddStateFlag(ui::AX_STATE_DISABLED); |
348 break; | 348 break; |
349 case STATE_NORMAL: | 349 case STATE_NORMAL: |
350 case STATE_COUNT: | 350 case STATE_COUNT: |
351 // No additional accessibility node_data set for this button node_data. | 351 // No additional accessibility node_data set for this button node_data. |
352 break; | 352 break; |
353 } | 353 } |
| 354 if (enabled()) { |
| 355 node_data->AddIntAttribute(ui::AX_ATTR_ACTION, |
| 356 ui::AX_SUPPORTED_ACTION_PRESS); |
| 357 } |
354 } | 358 } |
355 | 359 |
356 void CustomButton::VisibilityChanged(View* starting_from, bool visible) { | 360 void CustomButton::VisibilityChanged(View* starting_from, bool visible) { |
357 Button::VisibilityChanged(starting_from, visible); | 361 Button::VisibilityChanged(starting_from, visible); |
358 if (state_ == STATE_DISABLED) | 362 if (state_ == STATE_DISABLED) |
359 return; | 363 return; |
360 SetState(visible && ShouldEnterHoveredState() ? STATE_HOVERED : STATE_NORMAL); | 364 SetState(visible && ShouldEnterHoveredState() ? STATE_HOVERED : STATE_NORMAL); |
361 } | 365 } |
362 | 366 |
363 std::unique_ptr<InkDrop> CustomButton::CreateInkDrop() { | 367 std::unique_ptr<InkDrop> CustomButton::CreateInkDrop() { |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 views::InkDropState::ACTION_PENDING || | 474 views::InkDropState::ACTION_PENDING || |
471 GetInkDrop()->GetTargetInkDropState() == | 475 GetInkDrop()->GetTargetInkDropState() == |
472 views::InkDropState::ALTERNATE_ACTION_PENDING) { | 476 views::InkDropState::ALTERNATE_ACTION_PENDING) { |
473 AnimateInkDrop(views::InkDropState::HIDDEN, | 477 AnimateInkDrop(views::InkDropState::HIDDEN, |
474 ui::LocatedEvent::FromIfValid(&event)); | 478 ui::LocatedEvent::FromIfValid(&event)); |
475 } | 479 } |
476 Button::OnClickCanceled(event); | 480 Button::OnClickCanceled(event); |
477 } | 481 } |
478 | 482 |
479 } // namespace views | 483 } // namespace views |
OLD | NEW |