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/controls/menu/menu_controller.h" | 5 #include "ui/views/controls/menu/menu_controller.h" |
6 | 6 |
7 #include "base/i18n/case_conversion.h" | 7 #include "base/i18n/case_conversion.h" |
8 #include "base/i18n/rtl.h" | 8 #include "base/i18n/rtl.h" |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
906 Cancel(EXIT_ALL); | 906 Cancel(EXIT_ALL); |
907 return false; | 907 return false; |
908 | 908 |
909 default: | 909 default: |
910 break; | 910 break; |
911 } | 911 } |
912 TranslateMessage(&msg); | 912 TranslateMessage(&msg); |
913 DispatchMessage(&msg); | 913 DispatchMessage(&msg); |
914 return exit_type_ == EXIT_NONE; | 914 return exit_type_ == EXIT_NONE; |
915 } | 915 } |
916 #elif defined(USE_WAYLAND) | |
917 base::MessagePumpDispatcher::DispatchStatus | |
918 MenuController::Dispatch(base::wayland::WaylandEvent* ev) { | |
919 return exit_type_ != EXIT_NONE ? | |
920 base::MessagePumpDispatcher::EVENT_QUIT : | |
921 base::MessagePumpDispatcher::EVENT_PROCESSED; | |
922 } | |
923 | |
924 #elif defined(USE_AURA) | 916 #elif defined(USE_AURA) |
925 base::MessagePumpDispatcher::DispatchStatus | 917 base::MessagePumpDispatcher::DispatchStatus |
926 MenuController::Dispatch(XEvent* xev) { | 918 MenuController::Dispatch(XEvent* xev) { |
927 if (exit_type_ == EXIT_ALL || exit_type_ == EXIT_DESTROYED) { | 919 if (exit_type_ == EXIT_ALL || exit_type_ == EXIT_DESTROYED) { |
928 aura::Env::GetInstance()->GetDispatcher()->Dispatch(xev); | 920 aura::Env::GetInstance()->GetDispatcher()->Dispatch(xev); |
929 return base::MessagePumpDispatcher::EVENT_QUIT; | 921 return base::MessagePumpDispatcher::EVENT_QUIT; |
930 } | 922 } |
931 switch (ui::EventTypeFromNative(xev)) { | 923 switch (ui::EventTypeFromNative(xev)) { |
932 case ui::ET_KEY_PRESSED: | 924 case ui::ET_KEY_PRESSED: |
933 if (!OnKeyDown(ui::KeyboardCodeFromNative(xev))) | 925 if (!OnKeyDown(ui::KeyboardCodeFromNative(xev))) |
(...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2024 (!pending_state_.item->HasSubmenu() || | 2016 (!pending_state_.item->HasSubmenu() || |
2025 !pending_state_.item->GetSubmenu()->IsShowing())) { | 2017 !pending_state_.item->GetSubmenu()->IsShowing())) { |
2026 // On exit if the user hasn't selected an item with a submenu, move the | 2018 // On exit if the user hasn't selected an item with a submenu, move the |
2027 // selection back to the parent menu item. | 2019 // selection back to the parent menu item. |
2028 SetSelection(pending_state_.item->GetParentMenuItem(), | 2020 SetSelection(pending_state_.item->GetParentMenuItem(), |
2029 SELECTION_OPEN_SUBMENU); | 2021 SELECTION_OPEN_SUBMENU); |
2030 } | 2022 } |
2031 } | 2023 } |
2032 | 2024 |
2033 } // namespace views | 2025 } // namespace views |
OLD | NEW |