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

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

Issue 6275009: Fixes possible crash in menus. The crash would happen because we were (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome
Patch Set: Created 9 years, 11 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "app/l10n_util.h" 7 #include "app/l10n_util.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 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 552
553 if (!blocking_run_) 553 if (!blocking_run_)
554 return; 554 return;
555 555
556 if (part.type == MenuPart::NONE && ShowSiblingMenu(source, event)) 556 if (part.type == MenuPart::NONE && ShowSiblingMenu(source, event))
557 return; 557 return;
558 558
559 if (part.type == MenuPart::MENU_ITEM && part.menu) { 559 if (part.type == MenuPart::MENU_ITEM && part.menu) {
560 SetSelection(part.menu, SELECTION_OPEN_SUBMENU); 560 SetSelection(part.menu, SELECTION_OPEN_SUBMENU);
561 } else if (!part.is_scroll() && pending_state_.item && 561 } else if (!part.is_scroll() && pending_state_.item &&
562 pending_state_.item->GetParentMenuItem() &&
562 (!pending_state_.item->HasSubmenu() || 563 (!pending_state_.item->HasSubmenu() ||
563 !pending_state_.item->GetSubmenu()->IsShowing())) { 564 !pending_state_.item->GetSubmenu()->IsShowing())) {
564 // On exit if the user hasn't selected an item with a submenu, move the 565 // On exit if the user hasn't selected an item with a submenu, move the
565 // selection back to the parent menu item. 566 // selection back to the parent menu item.
566 SetSelection(pending_state_.item->GetParentMenuItem(), 567 SetSelection(pending_state_.item->GetParentMenuItem(),
567 SELECTION_OPEN_SUBMENU); 568 SELECTION_OPEN_SUBMENU);
568 } 569 }
569 } 570 }
570 571
571 void MenuController::OnMouseEntered(SubmenuView* source, 572 void MenuController::OnMouseEntered(SubmenuView* source,
(...skipping 1263 matching lines...) Expand 10 before | Expand all | Expand 10 after
1835 1836
1836 MouseEvent release_event(Event::ET_MOUSE_RELEASED, -1, -1, 0); 1837 MouseEvent release_event(Event::ET_MOUSE_RELEASED, -1, -1, 0);
1837 // Reset the active_mouse_view_ before sending mouse released. That way if if 1838 // Reset the active_mouse_view_ before sending mouse released. That way if if
1838 // calls back to use we aren't in a weird state. 1839 // calls back to use we aren't in a weird state.
1839 View* active_view = active_mouse_view_; 1840 View* active_view = active_mouse_view_;
1840 active_mouse_view_ = NULL; 1841 active_mouse_view_ = NULL;
1841 active_view->OnMouseReleased(release_event, true); 1842 active_view->OnMouseReleased(release_event, true);
1842 } 1843 }
1843 1844
1844 } // namespace views 1845 } // 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