OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #import "chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.h" | 5 #import "chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/mac/bundle_locations.h" | 8 #include "base/mac/bundle_locations.h" |
9 #include "base/mac/mac_util.h" | 9 #include "base/mac/mac_util.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 | 152 |
153 - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item { | 153 - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item { |
154 const BOOL enabled = [super validateUserInterfaceItem:item]; | 154 const BOOL enabled = [super validateUserInterfaceItem:item]; |
155 | 155 |
156 NSMenuItem* menuItem = (id)item; | 156 NSMenuItem* menuItem = (id)item; |
157 ui::MenuModel* model = | 157 ui::MenuModel* model = |
158 static_cast<ui::MenuModel*>( | 158 static_cast<ui::MenuModel*>( |
159 [[menuItem representedObject] pointerValue]); | 159 [[menuItem representedObject] pointerValue]); |
160 | 160 |
161 // The section headers in the recent tabs submenu should be bold and black if | 161 // The section headers in the recent tabs submenu should be bold and black if |
162 // a font is specified for the items (bold is already applied in the | 162 // a font list is specified for the items (bold is already applied in the |
163 // |MenuController| as the font returned by |GetLabelFontAt| is bold). | 163 // |MenuController| as the font list returned by |GetLabelFontListAt| is |
| 164 // bold). |
164 if (model && model == [self recentTabsMenuModel]) { | 165 if (model && model == [self recentTabsMenuModel]) { |
165 if (model->GetLabelFontAt([item tag])) { | 166 if (model->GetLabelFontListAt([item tag])) { |
166 DCHECK([menuItem attributedTitle]); | 167 DCHECK([menuItem attributedTitle]); |
167 base::scoped_nsobject<NSMutableAttributedString> title( | 168 base::scoped_nsobject<NSMutableAttributedString> title( |
168 [[NSMutableAttributedString alloc] | 169 [[NSMutableAttributedString alloc] |
169 initWithAttributedString:[menuItem attributedTitle]]); | 170 initWithAttributedString:[menuItem attributedTitle]]); |
170 [title addAttribute:NSForegroundColorAttributeName | 171 [title addAttribute:NSForegroundColorAttributeName |
171 value:[NSColor blackColor] | 172 value:[NSColor blackColor] |
172 range:NSMakeRange(0, [title length])]; | 173 range:NSMakeRange(0, [title length])]; |
173 [menuItem setAttributedTitle:title.get()]; | 174 [menuItem setAttributedTitle:title.get()]; |
174 } else { | 175 } else { |
175 // Not a section header. Add a tooltip with the title and the URL. | 176 // Not a section header. Add a tooltip with the title and the URL. |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 controller_ = controller; | 410 controller_ = controller; |
410 } | 411 } |
411 return self; | 412 return self; |
412 } | 413 } |
413 | 414 |
414 - (IBAction)dispatchWrenchMenuCommand:(id)sender { | 415 - (IBAction)dispatchWrenchMenuCommand:(id)sender { |
415 [controller_ dispatchWrenchMenuCommand:sender]; | 416 [controller_ dispatchWrenchMenuCommand:sender]; |
416 } | 417 } |
417 | 418 |
418 @end // @implementation WrenchMenuButtonViewController | 419 @end // @implementation WrenchMenuButtonViewController |
OLD | NEW |