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

Unified Diff: views/controls/menu/menu_item_view.cc

Issue 388007: Fixes possible crash in showing bookmark menu. The problem occurred... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « views/controls/menu/menu_item_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/controls/menu/menu_item_view.cc
===================================================================
--- views/controls/menu/menu_item_view.cc (revision 31560)
+++ views/controls/menu/menu_item_view.cc (working copy)
@@ -165,7 +165,7 @@
}
void MenuItemView::SetIcon(const SkBitmap& icon, int item_id) {
- MenuItemView* item = GetDescendantByID(item_id);
+ MenuItemView* item = GetMenuItemByID(item_id);
DCHECK(item);
item->SetIcon(icon);
}
@@ -216,6 +216,23 @@
return 0;
}
+MenuItemView* MenuItemView::GetMenuItemByID(int id) {
+ if (GetCommand() == id)
+ return this;
+ if (!HasSubmenu())
+ return NULL;
+ for (int i = 0; i < GetSubmenu()->GetChildViewCount(); ++i) {
+ View* child = GetSubmenu()->GetChildViewAt(i);
+ if (child->GetID() == MenuItemView::kMenuItemViewID) {
+ MenuItemView* result = static_cast<MenuItemView*>(child)->
+ GetMenuItemByID(id);
+ if (result)
+ return result;
+ }
+ }
+ return NULL;
+}
+
MenuItemView::MenuItemView(MenuItemView* parent,
int command,
MenuItemView::Type type) {
@@ -291,23 +308,6 @@
return item;
}
-MenuItemView* MenuItemView::GetDescendantByID(int id) {
- if (GetCommand() == id)
- return this;
- if (!HasSubmenu())
- return NULL;
- for (int i = 0; i < GetSubmenu()->GetChildViewCount(); ++i) {
- View* child = GetSubmenu()->GetChildViewAt(i);
- if (child->GetID() == MenuItemView::kMenuItemViewID) {
- MenuItemView* result = static_cast<MenuItemView*>(child)->
- GetDescendantByID(id);
- if (result)
- return result;
- }
- }
- return NULL;
-}
-
void MenuItemView::DropMenuClosed(bool notify_delegate) {
DCHECK(controller_);
DCHECK(!controller_->IsBlockingRun());
« no previous file with comments | « views/controls/menu/menu_item_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698