 Chromium Code Reviews
 Chromium Code Reviews Issue 6452011:
  Rework tree APIs to reflect Google style and more const-correctness....  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src/
    
  
    Issue 6452011:
  Rework tree APIs to reflect Google style and more const-correctness....  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src/| Index: views/controls/menu/menu_controller.cc | 
| =================================================================== | 
| --- views/controls/menu/menu_controller.cc (revision 74117) | 
| +++ views/controls/menu/menu_controller.cc (working copy) | 
| @@ -81,7 +81,7 @@ | 
| if (view->IsHotTracked()) | 
| return view; | 
| - for (int i = 0; i < view->GetChildViewCount(); ++i) { | 
| + for (size_t i = 0; i < view->child_count(); ++i) { | 
| View* hot_view = GetFirstHotTrackedView(view->GetChildViewAt(i)); | 
| if (hot_view) | 
| return hot_view; | 
| @@ -96,14 +96,14 @@ | 
| // to first. | 
| static View* GetFirstFocusableView(View* view, int start, bool forward) { | 
| if (forward) { | 
| - for (int i = start == -1 ? 0 : start; i < view->GetChildViewCount(); ++i) { | 
| + for (size_t i = start == -1 ? 0 : start; i < view->child_count(); ++i) { | 
| View* deepest = GetFirstFocusableView(view->GetChildViewAt(i), -1, | 
| forward); | 
| if (deepest) | 
| return deepest; | 
| } | 
| } else { | 
| - for (int i = start == -1 ? view->GetChildViewCount() - 1 : start; | 
| + for (size_t i = start == -1 ? view->child_count() - 1 : start; | 
| i >= 0; --i) { | 
| 
sky
2011/02/08 19:11:54
This never stops if we never find deepest.
PS I d
 | 
| View* deepest = GetFirstFocusableView(view->GetChildViewAt(i), -1, | 
| forward); | 
| @@ -124,11 +124,11 @@ | 
| static View* GetNextFocusableView(View* ancestor, | 
| View* start_at, | 
| bool forward) { | 
| - DCHECK(ancestor->IsParentOf(start_at)); | 
| + DCHECK(ancestor->Contains(start_at)); | 
| View* parent = start_at; | 
| do { | 
| - View* new_parent = parent->GetParent(); | 
| - int index = new_parent->GetChildIndex(parent); | 
| + View* new_parent = parent->parent(); | 
| + int index = new_parent->GetIndexOf(parent); | 
| index += forward ? 1 : -1; | 
| if (forward || index != -1) { | 
| View* next = GetFirstFocusableView(new_parent, index, forward); | 
| @@ -1098,7 +1098,7 @@ | 
| View* child_under_mouse = source->GetViewForPoint(gfx::Point(x, y)); | 
| while (child_under_mouse && | 
| child_under_mouse->GetID() != MenuItemView::kMenuItemViewID) { | 
| - child_under_mouse = child_under_mouse->GetParent(); | 
| + child_under_mouse = child_under_mouse->parent(); | 
| } | 
| if (child_under_mouse && child_under_mouse->IsEnabled() && | 
| child_under_mouse->GetID() == MenuItemView::kMenuItemViewID) { | 
| @@ -1493,7 +1493,7 @@ | 
| } | 
| } | 
| - if (item->GetChildViewCount()) { | 
| + if (item->has_children()) { | 
| View* hot_view = GetFirstHotTrackedView(item); | 
| if (hot_view) { | 
| hot_view->SetHotTracked(false); | 
| @@ -1766,7 +1766,7 @@ | 
| View* target_menu) { | 
| View* target = NULL; | 
| gfx::Point target_menu_loc(event.location()); | 
| - if (target_menu && target_menu->GetChildViewCount()) { | 
| + if (target_menu && target_menu->has_children()) { | 
| // Locate the deepest child view to send events to. This code assumes we | 
| // don't have to walk up the tree to find a view interested in events. This | 
| // is currently true for the cases we are embedding views, but if we embed |