OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ui/base/cocoa/menu_controller.h" | 5 #import "ui/base/cocoa/menu_controller.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
9 #include "ui/base/accelerators/accelerator.h" | 9 #include "ui/base/accelerators/accelerator.h" |
10 #include "ui/base/accelerators/platform_accelerator_cocoa.h" | 10 #include "ui/base/accelerators/platform_accelerator_cocoa.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 if (model->IsItemDynamicAt(modelIndex)) { | 172 if (model->IsItemDynamicAt(modelIndex)) { |
173 // Update the label and the icon. | 173 // Update the label and the icon. |
174 NSString* label = | 174 NSString* label = |
175 l10n_util::FixUpWindowsStyleLabel(model->GetLabelAt(modelIndex)); | 175 l10n_util::FixUpWindowsStyleLabel(model->GetLabelAt(modelIndex)); |
176 [(id)item setTitle:label]; | 176 [(id)item setTitle:label]; |
177 | 177 |
178 gfx::Image icon; | 178 gfx::Image icon; |
179 model->GetIconAt(modelIndex, &icon); | 179 model->GetIconAt(modelIndex, &icon); |
180 [(id)item setImage:icon.IsEmpty() ? nil : icon.ToNSImage()]; | 180 [(id)item setImage:icon.IsEmpty() ? nil : icon.ToNSImage()]; |
181 } | 181 } |
182 const gfx::Font* font = model->GetLabelFontAt(modelIndex); | 182 const gfx::FontList* font_list = model->GetLabelFontListAt(modelIndex); |
183 if (font) { | 183 if (font_list) { |
184 NSDictionary *attributes = | 184 NSDictionary *attributes = |
185 [NSDictionary dictionaryWithObject:font->GetNativeFont() | 185 [NSDictionary dictionaryWithObject:font_list->GetPrimaryFont(). |
| 186 GetNativeFont() |
186 forKey:NSFontAttributeName]; | 187 forKey:NSFontAttributeName]; |
187 base::scoped_nsobject<NSAttributedString> title( | 188 base::scoped_nsobject<NSAttributedString> title( |
188 [[NSAttributedString alloc] initWithString:[(id)item title] | 189 [[NSAttributedString alloc] initWithString:[(id)item title] |
189 attributes:attributes]); | 190 attributes:attributes]); |
190 [(id)item setAttributedTitle:title.get()]; | 191 [(id)item setAttributedTitle:title.get()]; |
191 } | 192 } |
192 return model->IsEnabledAt(modelIndex); | 193 return model->IsEnabledAt(modelIndex); |
193 } | 194 } |
194 return NO; | 195 return NO; |
195 } | 196 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 } | 236 } |
236 | 237 |
237 - (void)menuDidClose:(NSMenu*)menu { | 238 - (void)menuDidClose:(NSMenu*)menu { |
238 if (isMenuOpen_) { | 239 if (isMenuOpen_) { |
239 model_->MenuClosed(); | 240 model_->MenuClosed(); |
240 isMenuOpen_ = NO; | 241 isMenuOpen_ = NO; |
241 } | 242 } |
242 } | 243 } |
243 | 244 |
244 @end | 245 @end |
OLD | NEW |