| 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/radio_button.h" | 5 #include "views/controls/button/radio_button.h" | 
| 6 | 6 | 
| 7 #include "base/logging.h" | 7 #include "base/logging.h" | 
| 8 #include "views/widget/root_view.h" | 8 #include "views/widget/root_view.h" | 
| 9 | 9 | 
| 10 namespace views { | 10 namespace views { | 
| (...skipping 16 matching lines...) Expand all  Loading... | 
| 27 // RadioButton, Checkbox overrides: | 27 // RadioButton, Checkbox overrides: | 
| 28 | 28 | 
| 29 void RadioButton::SetChecked(bool checked) { | 29 void RadioButton::SetChecked(bool checked) { | 
| 30   if (checked == RadioButton::checked()) | 30   if (checked == RadioButton::checked()) | 
| 31     return; | 31     return; | 
| 32   if (native_wrapper_ && | 32   if (native_wrapper_ && | 
| 33       !native_wrapper_->UsesNativeRadioButtonGroup() && checked) { | 33       !native_wrapper_->UsesNativeRadioButtonGroup() && checked) { | 
| 34     // We can't just get the root view here because sometimes the radio | 34     // We can't just get the root view here because sometimes the radio | 
| 35     // button isn't attached to a root view (e.g., if it's part of a tab page | 35     // button isn't attached to a root view (e.g., if it's part of a tab page | 
| 36     // that is currently not active). | 36     // that is currently not active). | 
| 37     View* container = GetParent(); | 37     View* container = parent(); | 
| 38     while (container && container->GetParent()) | 38     while (container && container->parent()) | 
| 39       container = container->GetParent(); | 39       container = container->parent(); | 
| 40     if (container) { | 40     if (container) { | 
| 41       std::vector<View*> other; | 41       std::vector<View*> other; | 
| 42       container->GetViewsWithGroup(GetGroup(), &other); | 42       container->GetViewsWithGroup(GetGroup(), &other); | 
| 43       std::vector<View*>::iterator i; | 43       std::vector<View*>::iterator i; | 
| 44       for (i = other.begin(); i != other.end(); ++i) { | 44       for (i = other.begin(); i != other.end(); ++i) { | 
| 45         if (*i != this) { | 45         if (*i != this) { | 
| 46           if ((*i)->GetClassName() != kViewClassName) { | 46           if ((*i)->GetClassName() != kViewClassName) { | 
| 47             NOTREACHED() << "radio-button has same group as other non " | 47             NOTREACHED() << "radio-button has same group as other non " | 
| 48                             "radio-button views."; | 48                             "radio-button views."; | 
| 49             continue; | 49             continue; | 
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 104 | 104 | 
| 105 NativeButtonWrapper* RadioButton::CreateWrapper() { | 105 NativeButtonWrapper* RadioButton::CreateWrapper() { | 
| 106   NativeButtonWrapper* native_wrapper = | 106   NativeButtonWrapper* native_wrapper = | 
| 107       NativeButtonWrapper::CreateRadioButtonWrapper(this); | 107       NativeButtonWrapper::CreateRadioButtonWrapper(this); | 
| 108   native_wrapper->UpdateLabel(); | 108   native_wrapper->UpdateLabel(); | 
| 109   native_wrapper->UpdateChecked(); | 109   native_wrapper->UpdateChecked(); | 
| 110   return native_wrapper; | 110   return native_wrapper; | 
| 111 } | 111 } | 
| 112 | 112 | 
| 113 }  // namespace views | 113 }  // namespace views | 
| OLD | NEW | 
|---|