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

Side by Side Diff: chrome/browser/ui/toolbar/recent_tabs_menu_model_delegate.cc

Issue 11298004: alternate ntp: add "Recent Tabs" submenu to wrench menu (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/toolbar/recent_tabs_menu_model_delegate.h"
6
7 #include "ui/base/models/menu_model.h"
8 #include "ui/gfx/image/image.h"
9 #include "ui/views/controls/menu/menu_item_view.h"
10
11 RecentTabsMenuModelDelegate::RecentTabsMenuModelDelegate(
12 ui::MenuModel* model,
13 views::MenuItemView* menu_item)
14 : model_(model),
15 menu_item_(menu_item) {
16 model_->SetMenuModelDelegate(this);
17 }
18
19 RecentTabsMenuModelDelegate::~RecentTabsMenuModelDelegate() {
20 model_->SetMenuModelDelegate(NULL);
21 }
22
23 void RecentTabsMenuModelDelegate::OnIconChanged(int index) {
24 // |index| specifies position in children items of |menu_item_| starting at 0,
25 // its corresponding command id as used in the children menu item views
26 // follows that of the parent menu item view |menu_item_|.
27 int command_id = menu_item_->GetCommand() + 1 + index;
28 views::MenuItemView* item = menu_item_->GetMenuItemByID(command_id);
29 DCHECK(item);
30 gfx::Image icon;
31 if (model_->GetIconAt(index, &icon))
32 item->SetIcon(*icon.ToImageSkia());
33 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698