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

Side by Side Diff: views/view.cc

Issue 7104096: views: Simplify View::RemoveAllChildViews() function implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 6 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
« no previous file with comments | « no previous file | views/view_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/view.h" 5 #include "views/view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 #if defined(COMPOSITOR_2) 180 #if defined(COMPOSITOR_2)
181 view->MarkTextureDirty(); 181 view->MarkTextureDirty();
182 #endif 182 #endif
183 } 183 }
184 184
185 void View::RemoveChildView(View* view) { 185 void View::RemoveChildView(View* view) {
186 DoRemoveChildView(view, true, true, false); 186 DoRemoveChildView(view, true, true, false);
187 } 187 }
188 188
189 void View::RemoveAllChildViews(bool delete_children) { 189 void View::RemoveAllChildViews(bool delete_children) {
190 Views::iterator iter; 190 while (!children_.empty())
191 while ((iter = children_.begin()) != children_.end()) 191 DoRemoveChildView(children_.front(), false, false, delete_children);
192 DoRemoveChildView(*iter, false, false, delete_children);
193 UpdateTooltip(); 192 UpdateTooltip();
194 } 193 }
195 194
196 const View* View::GetChildViewAt(int index) const { 195 const View* View::GetChildViewAt(int index) const {
197 return index < child_count() ? children_[index] : NULL; 196 return index < child_count() ? children_[index] : NULL;
198 } 197 }
199 198
200 View* View::GetChildViewAt(int index) { 199 View* View::GetChildViewAt(int index) {
201 return 200 return
202 const_cast<View*>(const_cast<const View*>(this)->GetChildViewAt(index)); 201 const_cast<View*>(const_cast<const View*>(this)->GetChildViewAt(index));
(...skipping 1699 matching lines...) Expand 10 before | Expand all | Expand 10 after
1902 result.append(GetChildViewAt(i)->PrintViewGraph(false)); 1901 result.append(GetChildViewAt(i)->PrintViewGraph(false));
1903 1902
1904 if (first) 1903 if (first)
1905 result.append("}\n"); 1904 result.append("}\n");
1906 1905
1907 return result; 1906 return result;
1908 } 1907 }
1909 #endif 1908 #endif
1910 1909
1911 } // namespace views 1910 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | views/view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698