Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 523 | 523 |
| 524 void FocusManager::AddFocusChangeListener(FocusChangeListener* listener) { | 524 void FocusManager::AddFocusChangeListener(FocusChangeListener* listener) { |
| 525 focus_change_listeners_.AddObserver(listener); | 525 focus_change_listeners_.AddObserver(listener); |
| 526 } | 526 } |
| 527 | 527 |
| 528 void FocusManager::RemoveFocusChangeListener(FocusChangeListener* listener) { | 528 void FocusManager::RemoveFocusChangeListener(FocusChangeListener* listener) { |
| 529 focus_change_listeners_.RemoveObserver(listener); | 529 focus_change_listeners_.RemoveObserver(listener); |
| 530 } | 530 } |
| 531 | 531 |
| 532 bool FocusManager::ProcessArrowKeyTraversal(const ui::KeyEvent& event) { | 532 bool FocusManager::ProcessArrowKeyTraversal(const ui::KeyEvent& event) { |
| 533 if (event.IsShiftDown() || event.IsControlDown() || event.IsAltDown()) | 533 if (event.IsShiftDown() || event.IsControlDown() || event.IsAltDown() || event .IsAltGrDown()) |
|
Peter Kasting
2016/05/27 01:11:01
Nit: 80 columns
| |
| 534 return false; | 534 return false; |
| 535 | 535 |
| 536 const int key_code = event.key_code(); | 536 const int key_code = event.key_code(); |
| 537 if (key_code == ui::VKEY_LEFT || key_code == ui::VKEY_UP) { | 537 if (key_code == ui::VKEY_LEFT || key_code == ui::VKEY_UP) { |
| 538 AdvanceFocus(true); | 538 AdvanceFocus(true); |
| 539 return true; | 539 return true; |
| 540 } | 540 } |
| 541 if (key_code == ui::VKEY_RIGHT || key_code == ui::VKEY_DOWN) { | 541 if (key_code == ui::VKEY_RIGHT || key_code == ui::VKEY_DOWN) { |
| 542 AdvanceFocus(false); | 542 AdvanceFocus(false); |
| 543 return true; | 543 return true; |
| 544 } | 544 } |
| 545 | 545 |
| 546 return false; | 546 return false; |
| 547 } | 547 } |
| 548 | 548 |
| 549 bool FocusManager::IsFocusable(View* view) const { | 549 bool FocusManager::IsFocusable(View* view) const { |
| 550 DCHECK(view); | 550 DCHECK(view); |
| 551 | 551 |
| 552 // |keyboard_accessible_| is only used on Mac. | 552 // |keyboard_accessible_| is only used on Mac. |
| 553 #if defined(OS_MACOSX) | 553 #if defined(OS_MACOSX) |
| 554 return keyboard_accessible_ ? view->IsAccessibilityFocusable() | 554 return keyboard_accessible_ ? view->IsAccessibilityFocusable() |
| 555 : view->IsFocusable(); | 555 : view->IsFocusable(); |
| 556 #else | 556 #else |
| 557 return view->IsAccessibilityFocusable(); | 557 return view->IsAccessibilityFocusable(); |
| 558 #endif | 558 #endif |
| 559 } | 559 } |
| 560 | 560 |
| 561 } // namespace views | 561 } // namespace views |
| OLD | NEW |