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

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

Issue 7328004: Makes views menu open submenus immediately when pressing a key. We (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 5 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 | Annotate | Revision Log
« 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "views/controls/menu/menu_controller.h" 5 #include "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 1664 matching lines...) Expand 10 before | Expand all | Expand 10 after
1675 const SelectByCharDetails& details) { 1675 const SelectByCharDetails& details) {
1676 // This should only be invoked if there is a match. 1676 // This should only be invoked if there is a match.
1677 DCHECK(details.first_match != -1); 1677 DCHECK(details.first_match != -1);
1678 DCHECK(parent->HasSubmenu()); 1678 DCHECK(parent->HasSubmenu());
1679 SubmenuView* submenu = parent->GetSubmenu(); 1679 SubmenuView* submenu = parent->GetSubmenu();
1680 DCHECK(submenu); 1680 DCHECK(submenu);
1681 if (!details.has_multiple) { 1681 if (!details.has_multiple) {
1682 // There's only one match, activate it (or open if it has a submenu). 1682 // There's only one match, activate it (or open if it has a submenu).
1683 if (submenu->GetMenuItemAt(details.first_match)->HasSubmenu()) { 1683 if (submenu->GetMenuItemAt(details.first_match)->HasSubmenu()) {
1684 SetSelection(submenu->GetMenuItemAt(details.first_match), 1684 SetSelection(submenu->GetMenuItemAt(details.first_match),
1685 SELECTION_OPEN_SUBMENU); 1685 SELECTION_OPEN_SUBMENU | SELECTION_UPDATE_IMMEDIATELY);
1686 } else { 1686 } else {
1687 Accept(submenu->GetMenuItemAt(details.first_match), 0); 1687 Accept(submenu->GetMenuItemAt(details.first_match), 0);
1688 return true; 1688 return true;
1689 } 1689 }
1690 } else if (details.index_of_item == -1 || details.next_match == -1) { 1690 } else if (details.index_of_item == -1 || details.next_match == -1) {
1691 SetSelection(submenu->GetMenuItemAt(details.first_match), 1691 SetSelection(submenu->GetMenuItemAt(details.first_match),
1692 SELECTION_DEFAULT); 1692 SELECTION_DEFAULT);
1693 } else { 1693 } else {
1694 SetSelection(submenu->GetMenuItemAt(details.next_match), 1694 SetSelection(submenu->GetMenuItemAt(details.next_match),
1695 SELECTION_DEFAULT); 1695 SELECTION_DEFAULT);
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1895 return; 1895 return;
1896 1896
1897 // Reset the active_mouse_view_ before sending mouse capture lost. That way if 1897 // Reset the active_mouse_view_ before sending mouse capture lost. That way if
1898 // it calls back to us, we aren't in a weird state. 1898 // it calls back to us, we aren't in a weird state.
1899 View* active_view = active_mouse_view_; 1899 View* active_view = active_mouse_view_;
1900 active_mouse_view_ = NULL; 1900 active_mouse_view_ = NULL;
1901 active_view->OnMouseCaptureLost(); 1901 active_view->OnMouseCaptureLost();
1902 } 1902 }
1903 1903
1904 } // namespace views 1904 } // 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