| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
| 3 // LICENSE file. | 3 // LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/views/controls/button/native_button.h" | 5 #include "chrome/views/controls/button/native_button.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/common/l10n_util.h" | 8 #include "chrome/common/l10n_util.h" |
| 9 | 9 |
| 10 namespace views { | 10 namespace views { |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 } | 131 } |
| 132 | 132 |
| 133 bool NativeButton::AcceleratorPressed(const Accelerator& accelerator) { | 133 bool NativeButton::AcceleratorPressed(const Accelerator& accelerator) { |
| 134 if (IsEnabled()) { | 134 if (IsEnabled()) { |
| 135 NotifyClick(mouse_event_flags()); | 135 NotifyClick(mouse_event_flags()); |
| 136 return true; | 136 return true; |
| 137 } | 137 } |
| 138 return false; | 138 return false; |
| 139 } | 139 } |
| 140 | 140 |
| 141 void NativeButton::Focus() { |
| 142 Button::Focus(); |
| 143 // Forward the focus to the wrapper. |
| 144 if (native_wrapper_) |
| 145 native_wrapper_->SetFocus(); |
| 146 } |
| 147 |
| 141 //////////////////////////////////////////////////////////////////////////////// | 148 //////////////////////////////////////////////////////////////////////////////// |
| 142 // NativeButton, protected: | 149 // NativeButton, protected: |
| 143 | 150 |
| 144 void NativeButton::CreateWrapper() { | 151 void NativeButton::CreateWrapper() { |
| 145 native_wrapper_ = NativeButtonWrapper::CreateNativeButtonWrapper(this); | 152 native_wrapper_ = NativeButtonWrapper::CreateNativeButtonWrapper(this); |
| 146 native_wrapper_->UpdateLabel(); | 153 native_wrapper_->UpdateLabel(); |
| 147 } | 154 } |
| 148 | 155 |
| 149 void NativeButton::InitBorder() { | 156 void NativeButton::InitBorder() { |
| 150 set_border(Border::CreateEmptyBorder(0, kButtonBorderHWidth, 0, | 157 set_border(Border::CreateEmptyBorder(0, kButtonBorderHWidth, 0, |
| 151 kButtonBorderHWidth)); | 158 kButtonBorderHWidth)); |
| 152 } | 159 } |
| 153 | 160 |
| 154 } // namespace views | 161 } // namespace views |
| OLD | NEW |