| 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 "views/controls/button/custom_button.h" | 5 #include "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/keycodes/keyboard_codes.h" | 9 #include "ui/base/keycodes/keyboard_codes.h" |
| 10 #include "ui/gfx/screen.h" | 10 #include "ui/gfx/screen.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 | 190 |
| 191 bool CustomButton::OnKeyReleased(const KeyEvent& event) { | 191 bool CustomButton::OnKeyReleased(const KeyEvent& event) { |
| 192 if ((state_ == BS_DISABLED) || (event.key_code() != ui::VKEY_SPACE)) | 192 if ((state_ == BS_DISABLED) || (event.key_code() != ui::VKEY_SPACE)) |
| 193 return false; | 193 return false; |
| 194 | 194 |
| 195 SetState(BS_NORMAL); | 195 SetState(BS_NORMAL); |
| 196 NotifyClick(event); | 196 NotifyClick(event); |
| 197 return true; | 197 return true; |
| 198 } | 198 } |
| 199 | 199 |
| 200 bool CustomButton::AcceleratorPressed(const Accelerator& accelerator) { | 200 bool CustomButton::AcceleratorPressed(const ui::Accelerator& accelerator) { |
| 201 if (!View::IsEnabled()) | 201 if (!View::IsEnabled()) |
| 202 return false; | 202 return false; |
| 203 | 203 |
| 204 SetState(BS_NORMAL); | 204 SetState(BS_NORMAL); |
| 205 KeyEvent key_event(ui::ET_KEY_RELEASED, accelerator.key_code(), | 205 KeyEvent key_event(ui::ET_KEY_RELEASED, accelerator.key_code(), |
| 206 accelerator.modifiers()); | 206 accelerator.modifiers()); |
| 207 NotifyClick(key_event); | 207 NotifyClick(key_event); |
| 208 return true; | 208 return true; |
| 209 } | 209 } |
| 210 | 210 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 bool CustomButton::IsFocusable() const { | 286 bool CustomButton::IsFocusable() const { |
| 287 return (state_ != BS_DISABLED) && View::IsFocusable(); | 287 return (state_ != BS_DISABLED) && View::IsFocusable(); |
| 288 } | 288 } |
| 289 | 289 |
| 290 void CustomButton::OnBlur() { | 290 void CustomButton::OnBlur() { |
| 291 if (IsHotTracked()) | 291 if (IsHotTracked()) |
| 292 SetState(BS_NORMAL); | 292 SetState(BS_NORMAL); |
| 293 } | 293 } |
| 294 | 294 |
| 295 } // namespace views | 295 } // namespace views |
| OLD | NEW |