BookmarkManager: Fix 'new folder text field size changes on clicking it' issue.
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / wrench_menu / recent_tabs_menu_model_delegate.mm
blobfdcaec3ed7da28e7a018a911a874a4a66916de3b
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.
5 #import "chrome/browser/ui/cocoa/wrench_menu/recent_tabs_menu_model_delegate.h"
6 #include "ui/base/models/menu_model.h"
7 #include "ui/gfx/image/image.h"
9 RecentTabsMenuModelDelegate::RecentTabsMenuModelDelegate(
10     ui::MenuModel* model,
11     NSMenu* menu)
12     : model_(model),
13       menu_([menu retain]) {
14   model_->SetMenuModelDelegate(this);
17 RecentTabsMenuModelDelegate::~RecentTabsMenuModelDelegate() {
18   model_->SetMenuModelDelegate(NULL);
21 void RecentTabsMenuModelDelegate::OnIconChanged(int index) {
22   gfx::Image icon;
23   if (!model_->GetIconAt(index, &icon))
24     return;
26   NSMenuItem* item = [menu_ itemAtIndex:index];
27   [item setImage:icon.ToNSImage()];