Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: ui/views/controls/menu/menu_controller.cc

Issue 2033433006: MacViews: Modify insertText handlers to correctly handle space key and simplify menu event dispatch. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/macros.h" 9 #include "base/macros.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 current_mouse_event_target_ = nullptr; 1016 current_mouse_event_target_ = nullptr;
1017 if (showing_ && should_close && GetActiveInstance() == this) { 1017 if (showing_ && should_close && GetActiveInstance() == this) {
1018 CloseAllNestedMenus(); 1018 CloseAllNestedMenus();
1019 Cancel(EXIT_ALL); 1019 Cancel(EXIT_ALL);
1020 } else if (async_run_) { 1020 } else if (async_run_) {
1021 ExitAsyncRun(); 1021 ExitAsyncRun();
1022 } 1022 }
1023 } 1023 }
1024 1024
1025 ui::PostDispatchAction MenuController::OnWillDispatchKeyEvent( 1025 ui::PostDispatchAction MenuController::OnWillDispatchKeyEvent(
1026 base::char16 character, 1026 const ui::KeyEvent& key_event) {
tapted 2016/06/06 04:44:05 Is there a way of having MenuKeyEventHandler::OnKe
karandeepb 2016/06/06 11:21:10 Done.
1027 ui::KeyboardCode key_code) {
1028 if (exit_type() == MenuController::EXIT_ALL || 1027 if (exit_type() == MenuController::EXIT_ALL ||
1029 exit_type() == MenuController::EXIT_DESTROYED) { 1028 exit_type() == MenuController::EXIT_DESTROYED) {
1030 TerminateNestedMessageLoopIfNecessary(); 1029 TerminateNestedMessageLoopIfNecessary();
1031 return ui::POST_DISPATCH_PERFORM_DEFAULT; 1030 return ui::POST_DISPATCH_PERFORM_DEFAULT;
1032 } 1031 }
1033 1032
1034 if (character) 1033 if (key_event.is_char())
1035 SelectByChar(character); 1034 SelectByChar(key_event.GetCharacter());
1036 else 1035 else
1037 OnKeyDown(key_code); 1036 OnKeyDown(key_event.key_code());
1038 1037
1039 // MenuController may have been deleted, so check for an active instance 1038 // MenuController may have been deleted, so check for an active instance
1040 // before accessing member variables. 1039 // before accessing member variables.
1041 if (GetActiveInstance()) 1040 if (GetActiveInstance())
1042 TerminateNestedMessageLoopIfNecessary(); 1041 TerminateNestedMessageLoopIfNecessary();
1043 1042
1044 return ui::POST_DISPATCH_NONE; 1043 return ui::POST_DISPATCH_NONE;
1045 } 1044 }
1046 1045
1047 void MenuController::UpdateSubmenuSelection(SubmenuView* submenu) { 1046 void MenuController::UpdateSubmenuSelection(SubmenuView* submenu) {
(...skipping 1630 matching lines...) Expand 10 before | Expand all | Expand 10 after
2678 if (hot_button_) 2677 if (hot_button_)
2679 hot_button_->SetHotTracked(false); 2678 hot_button_->SetHotTracked(false);
2680 hot_button_ = hot_button; 2679 hot_button_ = hot_button;
2681 if (hot_button) { 2680 if (hot_button) {
2682 hot_button->SetHotTracked(true); 2681 hot_button->SetHotTracked(true);
2683 hot_button->NotifyAccessibilityEvent(ui::AX_EVENT_SELECTION, true); 2682 hot_button->NotifyAccessibilityEvent(ui::AX_EVENT_SELECTION, true);
2684 } 2683 }
2685 } 2684 }
2686 2685
2687 } // namespace views 2686 } // namespace views
OLDNEW
« ui/views/cocoa/bridged_content_view.mm ('K') | « ui/views/controls/menu/menu_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698