OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/controls/menu/menu_event_dispatcher_linux.h" | 5 #include "ui/views/controls/menu/menu_event_dispatcher_linux.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "ui/aura/window.h" | 8 #include "ui/aura/window.h" |
9 #include "ui/events/event_utils.h" | 9 #include "ui/events/event_utils.h" |
10 #include "ui/events/keycodes/keyboard_code_conversion.h" | 10 #include "ui/events/keycodes/keyboard_code_conversion.h" |
11 #include "ui/events/keycodes/keyboard_codes.h" | 11 #include "ui/events/keycodes/keyboard_codes.h" |
12 #include "ui/views/controls/menu/menu_controller.h" | 12 #include "ui/views/controls/menu/menu_controller.h" |
13 #include "ui/views/widget/widget.h" | 13 #include "ui/views/widget/widget.h" |
14 | 14 |
15 namespace views { | 15 namespace views { |
16 namespace internal { | 16 namespace internal { |
17 | 17 |
18 MenuEventDispatcher::MenuEventDispatcher(MenuController* controller) | 18 MenuEventDispatcher::MenuEventDispatcher(MenuController* controller) |
19 : menu_controller_(controller) {} | 19 : menu_controller_(controller) {} |
20 | 20 |
21 MenuEventDispatcher::~MenuEventDispatcher() {} | 21 MenuEventDispatcher::~MenuEventDispatcher() {} |
22 | 22 |
23 bool MenuEventDispatcher::CanDispatchEvent(const ui::PlatformEvent& event) { | 23 bool MenuEventDispatcher::CanDispatchEvent(const ui::PlatformEvent& event) { |
24 return true; | 24 return true; |
25 } | 25 } |
26 | 26 |
27 uint32_t MenuEventDispatcher::DispatchEvent(const ui::PlatformEvent& event) { | 27 ui::PostDispatchAction MenuEventDispatcher::DispatchEvent( |
| 28 const ui::PlatformEvent& event) { |
28 bool should_quit = false; | 29 bool should_quit = false; |
29 bool should_perform_default = true; | 30 bool should_perform_default = true; |
30 bool should_process_event = true; | 31 bool should_process_event = true; |
31 | 32 |
32 // Check if the event should be handled. | 33 // Check if the event should be handled. |
33 scoped_ptr<ui::Event> ui_event(ui::EventFromNative(event)); | 34 scoped_ptr<ui::Event> ui_event(ui::EventFromNative(event)); |
34 if (ui_event && menu_controller_->owner()) { | 35 if (ui_event && menu_controller_->owner()) { |
35 aura::Window* menu_window = menu_controller_->owner()->GetNativeWindow(); | 36 aura::Window* menu_window = menu_controller_->owner()->GetNativeWindow(); |
36 aura::Window* target_window = static_cast<aura::Window*>( | 37 aura::Window* target_window = static_cast<aura::Window*>( |
37 static_cast<ui::EventTarget*>(menu_window->GetRootWindow())-> | 38 static_cast<ui::EventTarget*>(menu_window->GetRootWindow())-> |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 83 |
83 if (should_quit || menu_controller_->exit_type() != MenuController::EXIT_NONE) | 84 if (should_quit || menu_controller_->exit_type() != MenuController::EXIT_NONE) |
84 menu_controller_->TerminateNestedMessageLoop(); | 85 menu_controller_->TerminateNestedMessageLoop(); |
85 | 86 |
86 return should_perform_default ? ui::POST_DISPATCH_PERFORM_DEFAULT | 87 return should_perform_default ? ui::POST_DISPATCH_PERFORM_DEFAULT |
87 : ui::POST_DISPATCH_NONE; | 88 : ui::POST_DISPATCH_NONE; |
88 } | 89 } |
89 | 90 |
90 } // namespace internal | 91 } // namespace internal |
91 } // namespace views | 92 } // namespace views |
OLD | NEW |