| 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/base/accessibility/accessible_view_state.h" | 7 #include "ui/base/accessibility/accessible_view_state.h" |
| 8 #include "ui/base/animation/throb_animation.h" | 8 #include "ui/base/animation/throb_animation.h" |
| 9 #include "ui/base/events/event.h" | 9 #include "ui/base/events/event.h" |
| 10 #include "ui/base/keycodes/keyboard_codes.h" | 10 #include "ui/base/keycodes/keyboard_codes.h" |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 switch (state_) { | 267 switch (state_) { |
| 268 case STATE_HOVERED: | 268 case STATE_HOVERED: |
| 269 state->state = ui::AccessibilityTypes::STATE_HOTTRACKED; | 269 state->state = ui::AccessibilityTypes::STATE_HOTTRACKED; |
| 270 break; | 270 break; |
| 271 case STATE_PRESSED: | 271 case STATE_PRESSED: |
| 272 state->state = ui::AccessibilityTypes::STATE_PRESSED; | 272 state->state = ui::AccessibilityTypes::STATE_PRESSED; |
| 273 break; | 273 break; |
| 274 case STATE_DISABLED: | 274 case STATE_DISABLED: |
| 275 state->state = ui::AccessibilityTypes::STATE_UNAVAILABLE; | 275 state->state = ui::AccessibilityTypes::STATE_UNAVAILABLE; |
| 276 break; | 276 break; |
| 277 case STATE_TOGGLED: |
| 278 state->state = ui::AccessibilityTypes::STATE_CHECKED; |
| 279 break; |
| 277 case STATE_NORMAL: | 280 case STATE_NORMAL: |
| 278 case STATE_COUNT: | 281 case STATE_COUNT: |
| 279 // No additional accessibility state set for this button state. | 282 // No additional accessibility state set for this button state. |
| 280 break; | 283 break; |
| 281 } | 284 } |
| 282 } | 285 } |
| 283 | 286 |
| 284 void CustomButton::VisibilityChanged(View* starting_from, bool visible) { | 287 void CustomButton::VisibilityChanged(View* starting_from, bool visible) { |
| 285 if (state_ == STATE_DISABLED) | 288 if (state_ == STATE_DISABLED) |
| 286 return; | 289 return; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 if (!is_add && state_ != STATE_DISABLED) | 334 if (!is_add && state_ != STATE_DISABLED) |
| 332 SetState(STATE_NORMAL); | 335 SetState(STATE_NORMAL); |
| 333 } | 336 } |
| 334 | 337 |
| 335 void CustomButton::OnBlur() { | 338 void CustomButton::OnBlur() { |
| 336 if (IsHotTracked()) | 339 if (IsHotTracked()) |
| 337 SetState(STATE_NORMAL); | 340 SetState(STATE_NORMAL); |
| 338 } | 341 } |
| 339 | 342 |
| 340 } // namespace views | 343 } // namespace views |
| OLD | NEW |