| 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_view_state.h" | 7 #include "ui/accessibility/ax_view_state.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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 if (state_ != STATE_DISABLED) | 270 if (state_ != STATE_DISABLED) |
| 271 SetState(STATE_NORMAL); | 271 SetState(STATE_NORMAL); |
| 272 View::ShowContextMenu(p, source_type); | 272 View::ShowContextMenu(p, source_type); |
| 273 } | 273 } |
| 274 | 274 |
| 275 void CustomButton::OnDragDone() { | 275 void CustomButton::OnDragDone() { |
| 276 // Only reset the state to normal if the button isn't currently disabled | 276 // Only reset the state to normal if the button isn't currently disabled |
| 277 // (since disabled buttons may still be able to be dragged). | 277 // (since disabled buttons may still be able to be dragged). |
| 278 if (state_ != STATE_DISABLED) | 278 if (state_ != STATE_DISABLED) |
| 279 SetState(STATE_NORMAL); | 279 SetState(STATE_NORMAL); |
| 280 Button::OnDragDone(); |
| 280 } | 281 } |
| 281 | 282 |
| 282 void CustomButton::GetAccessibleState(ui::AXViewState* state) { | 283 void CustomButton::GetAccessibleState(ui::AXViewState* state) { |
| 283 Button::GetAccessibleState(state); | 284 Button::GetAccessibleState(state); |
| 284 switch (state_) { | 285 switch (state_) { |
| 285 case STATE_HOVERED: | 286 case STATE_HOVERED: |
| 286 state->AddStateFlag(ui::AX_STATE_HOVERED); | 287 state->AddStateFlag(ui::AX_STATE_HOVERED); |
| 287 break; | 288 break; |
| 288 case STATE_PRESSED: | 289 case STATE_PRESSED: |
| 289 state->AddStateFlag(ui::AX_STATE_PRESSED); | 290 state->AddStateFlag(ui::AX_STATE_PRESSED); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 if (!details.is_add && state_ != STATE_DISABLED) | 373 if (!details.is_add && state_ != STATE_DISABLED) |
| 373 SetState(STATE_NORMAL); | 374 SetState(STATE_NORMAL); |
| 374 } | 375 } |
| 375 | 376 |
| 376 void CustomButton::OnBlur() { | 377 void CustomButton::OnBlur() { |
| 377 if (IsHotTracked()) | 378 if (IsHotTracked()) |
| 378 SetState(STATE_NORMAL); | 379 SetState(STATE_NORMAL); |
| 379 } | 380 } |
| 380 | 381 |
| 381 } // namespace views | 382 } // namespace views |
| OLD | NEW |