| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/native_button.h" | 5 #include "views/controls/button/native_button.h" |
| 6 | 6 |
| 7 #include "app/keyboard_codes.h" |
| 7 #include "base/i18n/rtl.h" | 8 #include "base/i18n/rtl.h" |
| 8 #include "base/keyboard_codes.h" | |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "views/controls/native/native_view_host.h" | 10 #include "views/controls/native/native_view_host.h" |
| 11 | 11 |
| 12 #if defined(OS_WIN) | 12 #if defined(OS_WIN) |
| 13 #include "gfx/platform_font_win.h" | 13 #include "gfx/platform_font_win.h" |
| 14 #elif defined(OS_LINUX) | 14 #elif defined(OS_LINUX) |
| 15 #include <gdk/gdkkeysyms.h> | 15 #include <gdk/gdkkeysyms.h> |
| 16 #include "views/screen.h" | 16 #include "views/screen.h" |
| 17 #endif | 17 #endif |
| 18 | 18 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 84 |
| 85 // Update the accessible name whenever the label changes. | 85 // Update the accessible name whenever the label changes. |
| 86 SetAccessibleName(label); | 86 SetAccessibleName(label); |
| 87 PreferredSizeChanged(); | 87 PreferredSizeChanged(); |
| 88 } | 88 } |
| 89 | 89 |
| 90 void NativeButton::SetIsDefault(bool is_default) { | 90 void NativeButton::SetIsDefault(bool is_default) { |
| 91 if (is_default == is_default_) | 91 if (is_default == is_default_) |
| 92 return; | 92 return; |
| 93 if (is_default) | 93 if (is_default) |
| 94 AddAccelerator(Accelerator(base::VKEY_RETURN, false, false, false)); | 94 AddAccelerator(Accelerator(app::VKEY_RETURN, false, false, false)); |
| 95 else | 95 else |
| 96 RemoveAccelerator(Accelerator(base::VKEY_RETURN, false, false, false)); | 96 RemoveAccelerator(Accelerator(app::VKEY_RETURN, false, false, false)); |
| 97 SetAppearsAsDefault(is_default); | 97 SetAppearsAsDefault(is_default); |
| 98 } | 98 } |
| 99 | 99 |
| 100 void NativeButton::SetNeedElevation(bool need_elevation) { | 100 void NativeButton::SetNeedElevation(bool need_elevation) { |
| 101 need_elevation_ = need_elevation; | 101 need_elevation_ = need_elevation; |
| 102 if (native_wrapper_) | 102 if (native_wrapper_) |
| 103 native_wrapper_->UpdateLabel(); | 103 native_wrapper_->UpdateLabel(); |
| 104 PreferredSizeChanged(); | 104 PreferredSizeChanged(); |
| 105 } | 105 } |
| 106 | 106 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 native_wrapper->UpdateEnabled(); | 232 native_wrapper->UpdateEnabled(); |
| 233 return native_wrapper; | 233 return native_wrapper; |
| 234 } | 234 } |
| 235 | 235 |
| 236 void NativeButton::InitBorder() { | 236 void NativeButton::InitBorder() { |
| 237 set_border(Border::CreateEmptyBorder(0, kButtonBorderHWidth, 0, | 237 set_border(Border::CreateEmptyBorder(0, kButtonBorderHWidth, 0, |
| 238 kButtonBorderHWidth)); | 238 kButtonBorderHWidth)); |
| 239 } | 239 } |
| 240 | 240 |
| 241 } // namespace views | 241 } // namespace views |
| OLD | NEW |