| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ui/views/controls/menu/menu_key_event_handler.h" | |
| 6 | |
| 7 #include "ui/aura/env.h" | |
| 8 #include "ui/views/controls/menu/menu_controller.h" | |
| 9 #include "ui/views/views_delegate.h" | |
| 10 | |
| 11 namespace views { | |
| 12 | |
| 13 MenuKeyEventHandler::MenuKeyEventHandler() { | |
| 14 aura::Env::GetInstanceDontCreate()->PrependPreTargetHandler(this); | |
| 15 } | |
| 16 | |
| 17 MenuKeyEventHandler::~MenuKeyEventHandler() { | |
| 18 aura::Env::GetInstanceDontCreate()->RemovePreTargetHandler(this); | |
| 19 } | |
| 20 | |
| 21 void MenuKeyEventHandler::OnKeyEvent(ui::KeyEvent* event) { | |
| 22 MenuController* menu_controller = MenuController::GetActiveInstance(); | |
| 23 DCHECK(menu_controller); | |
| 24 menu_controller->OnWillDispatchKeyEvent(event); | |
| 25 } | |
| 26 | |
| 27 } // namespace views | |
| OLD | NEW |