Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: views/controls/button/radio_button.cc

Issue 6452011: Rework tree APIs to reflect Google style and more const-correctness.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698