| 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 "ash/focus_cycler.h" | 5 #include "ash/focus_cycler.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/system/tray/system_tray.h" | 8 #include "ash/system/tray/system_tray.h" |
| 9 #include "ash/wm/window_cycle_controller.h" | 9 #include "ash/wm/window_cycle_controller.h" |
| 10 #include "ui/views/widget/widget.h" | 10 #include "ui/views/widget/widget.h" |
| 11 #include "ui/views/focus/focus_search.h" | 11 #include "ui/views/focus/focus_search.h" |
| 12 #include "ui/aura/window.h" | 12 #include "ui/aura/window.h" |
| 13 #include "ui/aura/client/activation_client.h" | 13 #include "ui/aura/client/activation_client.h" |
| 14 #include "ui/views/accessible_pane_view.h" | 14 #include "ui/views/accessible_pane_view.h" |
| 15 | 15 |
| 16 namespace ash { | 16 namespace ash { |
| 17 | 17 |
| 18 namespace internal { | 18 namespace internal { |
| 19 | 19 |
| 20 FocusCycler::FocusCycler() : widget_activating_(NULL) { | 20 FocusCycler::FocusCycler() : widget_activating_(NULL) { |
| 21 } | 21 } |
| 22 | 22 |
| 23 FocusCycler::~FocusCycler() { | 23 FocusCycler::~FocusCycler() { |
| 24 } | 24 } |
| 25 | 25 |
| 26 void FocusCycler::AddWidget(views::Widget* widget) { | 26 void FocusCycler::AddWidget(views::Widget* widget) { |
| 27 widgets_.push_back(widget); | 27 widgets_.push_back(widget); |
| 28 | 28 |
| 29 widget->GetFocusManager()->RegisterAccelerator( | 29 widget->GetFocusManager()->RegisterAccelerator( |
| 30 ui::Accelerator(ui::VKEY_F2, ui::EF_CONTROL_DOWN), | 30 ui::Accelerator(ui::VKEY_F2, ui::EF_CONTROL_DOWN, ui::ET_KEY_PRESSED), |
| 31 ui::AcceleratorManager::kNormalPriority, | 31 ui::AcceleratorManager::kNormalPriority, |
| 32 this); | 32 this); |
| 33 widget->GetFocusManager()->RegisterAccelerator( | 33 widget->GetFocusManager()->RegisterAccelerator( |
| 34 ui::Accelerator(ui::VKEY_F1, ui::EF_CONTROL_DOWN), | 34 ui::Accelerator(ui::VKEY_F1, ui::EF_CONTROL_DOWN, ui::ET_KEY_PRESSED), |
| 35 ui::AcceleratorManager::kNormalPriority, | 35 ui::AcceleratorManager::kNormalPriority, |
| 36 this); | 36 this); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void FocusCycler::RotateFocus(Direction direction) { | 39 void FocusCycler::RotateFocus(Direction direction) { |
| 40 int index = 0; | 40 int index = 0; |
| 41 int count = static_cast<int>(widgets_.size()); | 41 int count = static_cast<int>(widgets_.size()); |
| 42 int browser_index = count; | 42 int browser_index = count; |
| 43 | 43 |
| 44 for (; index < count; ++index) { | 44 for (; index < count; ++index) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 } | 102 } |
| 103 } | 103 } |
| 104 | 104 |
| 105 bool FocusCycler::CanHandleAccelerators() const { | 105 bool FocusCycler::CanHandleAccelerators() const { |
| 106 return true; | 106 return true; |
| 107 } | 107 } |
| 108 | 108 |
| 109 } // namespace internal | 109 } // namespace internal |
| 110 | 110 |
| 111 } // namespace ash | 111 } // namespace ash |
| OLD | NEW |