diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-26 14:19:33 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-26 14:19:33 +0000 |
commit | 09834fa24c47140d5f2ee37f527404fbe534d622 (patch) | |
tree | fa7dd30b35a89531e853f18335b1a80c8966ee3c | |
parent | 2115d282f01c592807e45400a5218158837f27d1 (diff) | |
download | chromium_src-09834fa24c47140d5f2ee37f527404fbe534d622.zip chromium_src-09834fa24c47140d5f2ee37f527404fbe534d622.tar.gz chromium_src-09834fa24c47140d5f2ee37f527404fbe534d622.tar.bz2 |
views: Have the non-const version of child_at call the constant one.
BUG=72040
TEST=views_unittests, views_examples, views_desktop
R=sky@chromium.org
Review URL: http://codereview.chromium.org/7471048
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94092 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | views/view.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/views/view.h b/views/view.h index a277a69..00c664b 100644 --- a/views/view.h +++ b/views/view.h @@ -144,12 +144,15 @@ class View : public AcceleratorTarget { Views::const_reverse_iterator children_rend() { return children_.rend(); } int child_count() const { return static_cast<int>(children_.size()); } bool has_children() const { return !children_.empty(); } - View* child_at(int index) { + + // Returns the child view at |index|. + const View* child_at(int index) const { + DCHECK_GE(index, 0); DCHECK_LT(index, child_count()); return children_[index]; } - const View* child_at(int index) const { - return const_cast<View*>(const_cast<const View*>(this))->child_at(index); + View* child_at(int index) { + return const_cast<View*>(const_cast<const View*>(this)->child_at(index)); } // Returns the parent view. |