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

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

Issue 1771863002: Corrects hot-tracked state when space or enter is pressed in a menu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2620 matching lines...) Expand 10 before | Expand all | Expand 10 after
2631 SelectionIncrementDirectionType direction) { 2631 SelectionIncrementDirectionType direction) {
2632 if (!item) 2632 if (!item)
2633 return; 2633 return;
2634 SetSelection(item, SELECTION_DEFAULT); 2634 SetSelection(item, SELECTION_DEFAULT);
2635 View* hot_view = 2635 View* hot_view =
2636 GetInitialFocusableView(item, direction == INCREMENT_SELECTION_DOWN); 2636 GetInitialFocusableView(item, direction == INCREMENT_SELECTION_DOWN);
2637 SetHotTrackedButton(CustomButton::AsCustomButton(hot_view)); 2637 SetHotTrackedButton(CustomButton::AsCustomButton(hot_view));
2638 } 2638 }
2639 2639
2640 void MenuController::SetHotTrackedButton(CustomButton* hot_button) { 2640 void MenuController::SetHotTrackedButton(CustomButton* hot_button) {
2641 if (hot_button == hot_button_) 2641 if (hot_button == hot_button_) {
2642 // Hot-tracked state may change outside of the MenuController. Correct it.
2643 if (hot_button && !hot_button->IsHotTracked())
2644 hot_button->SetHotTracked(true);
2642 return; 2645 return;
2646 }
2643 if (hot_button_) 2647 if (hot_button_)
2644 hot_button_->SetHotTracked(false); 2648 hot_button_->SetHotTracked(false);
2645 hot_button_ = hot_button; 2649 hot_button_ = hot_button;
2646 if (hot_button) 2650 if (hot_button)
2647 hot_button->SetHotTracked(true); 2651 hot_button->SetHotTracked(true);
2648 } 2652 }
2649 2653
2650 } // namespace views 2654 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698