| OLD | NEW |
| 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 "ui/views/focus/focus_manager.h" | 5 #include "ui/views/focus/focus_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 | 10 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 | 136 |
| 137 // Intercept arrow key messages to switch between grouped views. | 137 // Intercept arrow key messages to switch between grouped views. |
| 138 // TODO(beng): Perhaps make this a FocusTraversable that is created for | 138 // TODO(beng): Perhaps make this a FocusTraversable that is created for |
| 139 // Views that have a group set? | 139 // Views that have a group set? |
| 140 ui::KeyboardCode key_code = event.key_code(); | 140 ui::KeyboardCode key_code = event.key_code(); |
| 141 if (focused_view_ && focused_view_->group() != -1 && | 141 if (focused_view_ && focused_view_->group() != -1 && |
| 142 (key_code == ui::VKEY_UP || key_code == ui::VKEY_DOWN || | 142 (key_code == ui::VKEY_UP || key_code == ui::VKEY_DOWN || |
| 143 key_code == ui::VKEY_LEFT || key_code == ui::VKEY_RIGHT)) { | 143 key_code == ui::VKEY_LEFT || key_code == ui::VKEY_RIGHT)) { |
| 144 bool next = (key_code == ui::VKEY_RIGHT || key_code == ui::VKEY_DOWN); | 144 bool next = (key_code == ui::VKEY_RIGHT || key_code == ui::VKEY_DOWN); |
| 145 std::vector<View*> views; | 145 std::vector<View*> views; |
| 146 focused_view_->parent()->GetViewsWithGroup(focused_view_->group(), &views); | 146 focused_view_->parent()->GetViewsInGroup(focused_view_->group(), &views); |
| 147 std::vector<View*>::const_iterator iter = std::find(views.begin(), | 147 std::vector<View*>::const_iterator iter = std::find(views.begin(), |
| 148 views.end(), | 148 views.end(), |
| 149 focused_view_); | 149 focused_view_); |
| 150 DCHECK(iter != views.end()); | 150 DCHECK(iter != views.end()); |
| 151 int index = static_cast<int>(iter - views.begin()); | 151 int index = static_cast<int>(iter - views.begin()); |
| 152 index += next ? 1 : -1; | 152 index += next ? 1 : -1; |
| 153 if (index < 0) { | 153 if (index < 0) { |
| 154 index = static_cast<int>(views.size()) - 1; | 154 index = static_cast<int>(views.size()) - 1; |
| 155 } else if (index >= static_cast<int>(views.size())) { | 155 } else if (index >= static_cast<int>(views.size())) { |
| 156 index = 0; | 156 index = 0; |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 !IsTraverseForward(direction), | 464 !IsTraverseForward(direction), |
| 465 FocusSearch::DOWN, | 465 FocusSearch::DOWN, |
| 466 false, | 466 false, |
| 467 &new_focus_traversable, | 467 &new_focus_traversable, |
| 468 &new_starting_view); | 468 &new_starting_view); |
| 469 } | 469 } |
| 470 return v; | 470 return v; |
| 471 } | 471 } |
| 472 | 472 |
| 473 } // namespace ui | 473 } // namespace ui |
| OLD | NEW |