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

Side by Side Diff: components/renderer_context_menu/views/toolkit_delegate_views.cc

Issue 892953002: Show icons for custom menuitems in contextmenu. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/renderer_context_menu/views/toolkit_delegate_views.h" 5 #include "components/renderer_context_menu/views/toolkit_delegate_views.h"
6 6
7 #include "ui/gfx/geometry/rect.h" 7 #include "ui/gfx/geometry/rect.h"
8 #include "ui/gfx/image/image.h"
8 #include "ui/views/controls/menu/menu_item_view.h" 9 #include "ui/views/controls/menu/menu_item_view.h"
9 #include "ui/views/controls/menu/menu_model_adapter.h" 10 #include "ui/views/controls/menu/menu_model_adapter.h"
10 #include "ui/views/controls/menu/menu_runner.h" 11 #include "ui/views/controls/menu/menu_runner.h"
11 12
12 ToolkitDelegateViews::ToolkitDelegateViews() : menu_view_(NULL) {} 13 ToolkitDelegateViews::ToolkitDelegateViews() : menu_view_(NULL) {}
13 14
14 ToolkitDelegateViews::~ToolkitDelegateViews() {} 15 ToolkitDelegateViews::~ToolkitDelegateViews() {}
15 16
16 void ToolkitDelegateViews::RunMenuAt(views::Widget* parent, 17 void ToolkitDelegateViews::RunMenuAt(views::Widget* parent,
17 const gfx::Point& point, 18 const gfx::Point& point,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 item->SetTitle(title); 51 item->SetTitle(title);
51 item->SetVisible(!hidden); 52 item->SetVisible(!hidden);
52 53
53 views::MenuItemView* parent = item->GetParentMenuItem(); 54 views::MenuItemView* parent = item->GetParentMenuItem();
54 if (!parent) 55 if (!parent)
55 return; 56 return;
56 57
57 parent->ChildrenChanged(); 58 parent->ChildrenChanged();
58 } 59 }
59 60
61 void ToolkitDelegateViews::SetIcon(int command_id, const gfx::ImageSkia& icon) {
62 views::MenuItemView* item = menu_view_->GetMenuItemByID(command_id);
63 if (!item)
64 return;
65 item->SetIcon(icon);
66 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698