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

Side by Side Diff: views/controls/menu/chrome_menu.h

Issue 160458: Fixes possible crash in bookmark menus. Specifically if you had a menu... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 4 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 | « chrome/browser/views/bookmark_bar_view_test.cc ('k') | views/controls/menu/chrome_menu.cc » ('j') | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #ifndef VIEWS_CONTROLS_MENU_CHROME_MENU_H_ 5 #ifndef VIEWS_CONTROLS_MENU_CHROME_MENU_H_
6 #define VIEWS_CONTROLS_MENU_CHROME_MENU_H_ 6 #define VIEWS_CONTROLS_MENU_CHROME_MENU_H_
7 7
8 #include <list> 8 #include <list>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 // particular location. 707 // particular location.
708 struct MenuPart { 708 struct MenuPart {
709 // Type of part. 709 // Type of part.
710 enum Type { 710 enum Type {
711 NONE, 711 NONE,
712 MENU_ITEM, 712 MENU_ITEM,
713 SCROLL_UP, 713 SCROLL_UP,
714 SCROLL_DOWN 714 SCROLL_DOWN
715 }; 715 };
716 716
717 MenuPart() : type(NONE), menu(NULL), submenu(NULL) {} 717 MenuPart() : type(NONE), menu(NULL), parent(NULL), submenu(NULL) {}
718 718
719 // Convenience for testing type == SCROLL_DOWN or type == SCROLL_UP. 719 // Convenience for testing type == SCROLL_DOWN or type == SCROLL_UP.
720 bool is_scroll() const { return type == SCROLL_DOWN || type == SCROLL_UP; } 720 bool is_scroll() const { return type == SCROLL_DOWN || type == SCROLL_UP; }
721 721
722 // Type of part. 722 // Type of part.
723 Type type; 723 Type type;
724 724
725 // If type is MENU_ITEM, this is the menu item the mouse is over, otherwise 725 // If type is MENU_ITEM, this is the menu item the mouse is over, otherwise
726 // this is NULL. 726 // this is NULL.
727 // NOTE: if type is MENU_ITEM and the mouse is not over a valid menu item 727 // NOTE: if type is MENU_ITEM and the mouse is not over a valid menu item
728 // but is over a menu (for example, the mouse is over a separator or 728 // but is over a menu (for example, the mouse is over a separator or
729 // empty menu), this is NULL. 729 // empty menu), this is NULL and parent is the menu the mouse was
730 // clicked on.
730 MenuItemView* menu; 731 MenuItemView* menu;
731 732
733 // If type is MENU_ITEM but the mouse is not over a menu item this is the
734 // parent of the menu item the user clicked on. Otherwise this is NULL.
735 MenuItemView* parent;
736
732 // If type is SCROLL_*, this is the submenu the mouse is over. 737 // If type is SCROLL_*, this is the submenu the mouse is over.
733 SubmenuView* submenu; 738 SubmenuView* submenu;
734 }; 739 };
735 740
736 // Sets the active MenuController. 741 // Sets the active MenuController.
737 static void SetActiveInstance(MenuController* controller); 742 static void SetActiveInstance(MenuController* controller);
738 743
739 #if defined(OS_WIN) 744 #if defined(OS_WIN)
740 // Dispatcher method. This returns true if the menu was canceled, or 745 // Dispatcher method. This returns true if the menu was canceled, or
741 // if the message is such that the menu should be closed. 746 // if the message is such that the menu should be closed.
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 // Task for scrolling the menu. If non-null indicates a scroll is currently 953 // Task for scrolling the menu. If non-null indicates a scroll is currently
949 // underway. 954 // underway.
950 scoped_ptr<MenuScrollTask> scroll_task_; 955 scoped_ptr<MenuScrollTask> scroll_task_;
951 956
952 DISALLOW_COPY_AND_ASSIGN(MenuController); 957 DISALLOW_COPY_AND_ASSIGN(MenuController);
953 }; 958 };
954 959
955 } // namespace views 960 } // namespace views
956 961
957 #endif // VIEWS_CONTROLS_MENU_CHROME_MENU_H_ 962 #endif // VIEWS_CONTROLS_MENU_CHROME_MENU_H_
OLDNEW
« no previous file with comments | « chrome/browser/views/bookmark_bar_view_test.cc ('k') | views/controls/menu/chrome_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698