Index: ui/views/controls/menu/menu_event_dispatcher_linux.cc |
diff --git a/ui/views/controls/menu/menu_message_pump_dispatcher_linux.cc b/ui/views/controls/menu/menu_event_dispatcher_linux.cc |
similarity index 62% |
copy from ui/views/controls/menu/menu_message_pump_dispatcher_linux.cc |
copy to ui/views/controls/menu/menu_event_dispatcher_linux.cc |
index 0172f8b33d9255223affbdc7fe14b7c852408c65..716c6bb51bb3f0bd167f87f8ab58b9d64ed4f3ff 100644 |
--- a/ui/views/controls/menu/menu_message_pump_dispatcher_linux.cc |
+++ b/ui/views/controls/menu/menu_event_dispatcher_linux.cc |
@@ -2,7 +2,7 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "ui/views/controls/menu/menu_message_pump_dispatcher.h" |
+#include "ui/views/controls/menu/menu_event_dispatcher_linux.h" |
#include "ui/events/event_utils.h" |
#include "ui/events/keycodes/keyboard_code_conversion.h" |
@@ -12,15 +12,24 @@ |
namespace views { |
namespace internal { |
-uint32_t MenuMessagePumpDispatcher::Dispatch(const base::NativeEvent& event) { |
+MenuEventDispatcher::MenuEventDispatcher(MenuController* controller) |
+ : menu_controller_(controller) {} |
+ |
+MenuEventDispatcher::~MenuEventDispatcher() {} |
+ |
+bool MenuEventDispatcher::CanDispatchEvent(const ui::PlatformEvent& event) { |
+ return true; |
+} |
+ |
+uint32_t MenuEventDispatcher::DispatchEvent(const ui::PlatformEvent& event) { |
if (menu_controller_->exit_type() == MenuController::EXIT_ALL || |
menu_controller_->exit_type() == MenuController::EXIT_DESTROYED) |
- return (POST_DISPATCH_QUIT_LOOP | POST_DISPATCH_PERFORM_DEFAULT); |
+ return (ui::POST_DISPATCH_QUIT_LOOP | ui::POST_DISPATCH_PERFORM_DEFAULT); |
switch (ui::EventTypeFromNative(event)) { |
case ui::ET_KEY_PRESSED: { |
if (!menu_controller_->OnKeyDown(ui::KeyboardCodeFromNative(event))) |
- return POST_DISPATCH_QUIT_LOOP; |
+ return ui::POST_DISPATCH_QUIT_LOOP; |
// Do not check mnemonics if the Alt or Ctrl modifiers are pressed. |
int flags = ui::EventFlagsFromNative(event); |
@@ -28,20 +37,20 @@ uint32_t MenuMessagePumpDispatcher::Dispatch(const base::NativeEvent& event) { |
char c = ui::GetCharacterFromKeyCode(ui::KeyboardCodeFromNative(event), |
flags); |
if (menu_controller_->SelectByChar(c)) |
- return POST_DISPATCH_QUIT_LOOP; |
+ return ui::POST_DISPATCH_QUIT_LOOP; |
} |
- return POST_DISPATCH_NONE; |
+ return ui::POST_DISPATCH_NONE; |
} |
case ui::ET_KEY_RELEASED: |
- return POST_DISPATCH_NONE; |
+ return ui::POST_DISPATCH_NONE; |
default: |
break; |
} |
- return POST_DISPATCH_PERFORM_DEFAULT | |
+ return ui::POST_DISPATCH_PERFORM_DEFAULT | |
(menu_controller_->exit_type() == MenuController::EXIT_NONE |
- ? POST_DISPATCH_NONE |
- : POST_DISPATCH_QUIT_LOOP); |
+ ? ui::POST_DISPATCH_NONE |
+ : ui::POST_DISPATCH_QUIT_LOOP); |
} |
} // namespace internal |