diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-09 04:50:21 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-09 04:50:21 +0000 |
commit | 208386048305a96323581eaca4e4c378d2d8534e (patch) | |
tree | 809f266c0b42c1dba64f4233bee4ae615c813cf3 /views/focus | |
parent | 35a43f9fc8b757adfe1226acd95dab7541e8a9a6 (diff) | |
download | chromium_src-208386048305a96323581eaca4e4c378d2d8534e.zip chromium_src-208386048305a96323581eaca4e4c378d2d8534e.tar.gz chromium_src-208386048305a96323581eaca4e4c378d2d8534e.tar.bz2 |
Rework tree APIs to reflect Google style and more const-correctness.Also, move PrintViewHierarchy/PrintFocusHierarchy out into a separate header.
BUG=72040
TEST=None
Review URL: http://codereview.chromium.org/6452011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@74244 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/focus')
-rw-r--r-- | views/focus/external_focus_tracker.cc | 2 | ||||
-rw-r--r-- | views/focus/focus_manager.cc | 6 | ||||
-rw-r--r-- | views/focus/focus_search.cc | 20 |
3 files changed, 12 insertions, 16 deletions
diff --git a/views/focus/external_focus_tracker.cc b/views/focus/external_focus_tracker.cc index 0787359..6af74d6 100644 --- a/views/focus/external_focus_tracker.cc +++ b/views/focus/external_focus_tracker.cc @@ -30,7 +30,7 @@ ExternalFocusTracker::~ExternalFocusTracker() { void ExternalFocusTracker::FocusWillChange(View* focused_before, View* focused_now) { - if (focused_now && !parent_view_->IsParentOf(focused_now) && + if (focused_now && !parent_view_->Contains(focused_now) && parent_view_ != focused_now) { // Store the newly focused view. StoreLastFocusedView(focused_now); diff --git a/views/focus/focus_manager.cc b/views/focus/focus_manager.cc index faaf4c5..d217e63 100644 --- a/views/focus/focus_manager.cc +++ b/views/focus/focus_manager.cc @@ -126,8 +126,8 @@ bool FocusManager::OnKeyEvent(const KeyEvent& event) { key_code == ui::VKEY_LEFT || key_code == ui::VKEY_RIGHT)) { bool next = (key_code == ui::VKEY_RIGHT || key_code == ui::VKEY_DOWN); std::vector<View*> views; - focused_view_->GetParent()->GetViewsWithGroup(focused_view_->GetGroup(), - &views); + focused_view_->parent()->GetViewsWithGroup(focused_view_->GetGroup(), + &views); std::vector<View*>::const_iterator iter = std::find(views.begin(), views.end(), focused_view_); @@ -224,7 +224,7 @@ View* FocusManager::GetNextFocusableView(View* original_starting_view, starting_view = original_starting_view; break; } - pane_search = pane_search->GetParent(); + pane_search = pane_search->parent(); } if (!focus_traversable) { diff --git a/views/focus/focus_search.cc b/views/focus/focus_search.cc index f3fac86..eea5f48 100644 --- a/views/focus/focus_search.cc +++ b/views/focus/focus_search.cc @@ -24,7 +24,7 @@ View* FocusSearch::FindNextFocusableView(View* starting_view, *focus_traversable = NULL; *focus_traversable_view = NULL; - if (root_->GetChildViewCount() == 0) { + if (!root_->has_children()) { NOTREACHED(); // Nothing to focus on here. return NULL; @@ -39,14 +39,14 @@ View* FocusSearch::FindNextFocusableView(View* starting_view, // Default to the first/last child starting_view = reverse ? - root_->GetChildViewAt(root_->GetChildViewCount() - 1) : + root_->GetChildViewAt(root_->child_count() - 1) : root_->GetChildViewAt(0); // If there was no starting view, then the one we select is a potential // focus candidate. check_starting_view = true; } else { // The starting view should be a direct or indirect child of the root. - DCHECK(root_->IsParentOf(starting_view)); + DCHECK(root_->Contains(starting_view)); } View* v = NULL; @@ -70,7 +70,7 @@ View* FocusSearch::FindNextFocusableView(View* starting_view, } // Don't set the focus to something outside of this view hierarchy. - if (v && v != root_ && !root_->IsParentOf(v)) + if (v && v != root_ && !root_->Contains(v)) v = NULL; // If |cycle_| is true, prefer to keep cycling rather than returning NULL. @@ -121,11 +121,7 @@ View* FocusSearch::FindSelectedViewForGroup(View* view) { } View* FocusSearch::GetParent(View* v) { - if (root_->IsParentOf(v)) { - return v->GetParent(); - } else { - return NULL; - } + return root_->Contains(v) ? v->parent() : NULL; } // Strategy for finding the next focusable view: @@ -162,7 +158,7 @@ View* FocusSearch::FindNextFocusableViewImpl( // First let's try the left child. if (can_go_down) { - if (starting_view->GetChildViewCount() > 0) { + if (starting_view->has_children()) { View* v = FindNextFocusableViewImpl(starting_view->GetChildViewAt(0), true, false, true, skip_group_id, focus_traversable, @@ -227,9 +223,9 @@ View* FocusSearch::FindPreviousFocusableViewImpl( return NULL; } - if (starting_view->GetChildViewCount() > 0) { + if (starting_view->has_children()) { View* view = - starting_view->GetChildViewAt(starting_view->GetChildViewCount() - 1); + starting_view->GetChildViewAt(starting_view->child_count() - 1); View* v = FindPreviousFocusableViewImpl(view, true, false, true, skip_group_id, focus_traversable, |