| 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/native_button.h" | 5 #include "views/controls/button/native_button.h" |
| 6 | 6 |
| 7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
| 8 #include "ui/base/keycodes/keyboard_codes.h" | 8 #include "ui/base/keycodes/keyboard_codes.h" |
| 9 #include "views/controls/native/native_view_host.h" | 9 #include "views/controls/native/native_view_host.h" |
| 10 | 10 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 return sz; | 157 return sz; |
| 158 } | 158 } |
| 159 | 159 |
| 160 void NativeButtonBase::Layout() { | 160 void NativeButtonBase::Layout() { |
| 161 if (native_wrapper_) { | 161 if (native_wrapper_) { |
| 162 native_wrapper_->GetView()->SetBounds(0, 0, width(), height()); | 162 native_wrapper_->GetView()->SetBounds(0, 0, width(), height()); |
| 163 native_wrapper_->GetView()->Layout(); | 163 native_wrapper_->GetView()->Layout(); |
| 164 } | 164 } |
| 165 } | 165 } |
| 166 | 166 |
| 167 void NativeButtonBase::SetEnabled(bool flag) { | 167 void NativeButtonBase::OnEnabledChanged() { |
| 168 Button::SetEnabled(flag); | 168 Button::OnEnabledChanged(); |
| 169 if (native_wrapper_) | 169 if (native_wrapper_) |
| 170 native_wrapper_->UpdateEnabled(); | 170 native_wrapper_->UpdateEnabled(); |
| 171 } | 171 } |
| 172 | 172 |
| 173 void NativeButtonBase::ViewHierarchyChanged(bool is_add, View* parent, | 173 void NativeButtonBase::ViewHierarchyChanged(bool is_add, View* parent, |
| 174 View* child) { | 174 View* child) { |
| 175 if (is_add && !native_wrapper_ && GetWidget()) { | 175 if (is_add && !native_wrapper_ && GetWidget()) { |
| 176 // The native wrapper's lifetime will be managed by the view hierarchy after | 176 // The native wrapper's lifetime will be managed by the view hierarchy after |
| 177 // we call AddChildView. | 177 // we call AddChildView. |
| 178 native_wrapper_ = CreateWrapper(); | 178 native_wrapper_ = CreateWrapper(); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 | 280 |
| 281 NativeButton::NativeButton(ButtonListener* listener, const std::wstring& label) | 281 NativeButton::NativeButton(ButtonListener* listener, const std::wstring& label) |
| 282 : NativeButtonBase(listener, label) { | 282 : NativeButtonBase(listener, label) { |
| 283 } | 283 } |
| 284 | 284 |
| 285 NativeButton::~NativeButton() { | 285 NativeButton::~NativeButton() { |
| 286 } | 286 } |
| 287 #endif | 287 #endif |
| 288 | 288 |
| 289 } // namespace views | 289 } // namespace views |
| OLD | NEW |