OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "ui/native_theme/native_theme_mac.h" | 5 #include "ui/native_theme/native_theme_mac.h" |
6 | 6 |
7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 paint.setColor(kMenuPopupBackgroundColor); | 238 paint.setColor(kMenuPopupBackgroundColor); |
239 const SkScalar radius = SkIntToScalar(menu_background.corner_radius); | 239 const SkScalar radius = SkIntToScalar(menu_background.corner_radius); |
240 SkRect rect = gfx::RectToSkRect(gfx::Rect(size)); | 240 SkRect rect = gfx::RectToSkRect(gfx::Rect(size)); |
241 canvas->drawRoundRect(rect, radius, radius, paint); | 241 canvas->drawRoundRect(rect, radius, radius, paint); |
242 } | 242 } |
243 | 243 |
244 void NativeThemeMac::PaintMenuItemBackground( | 244 void NativeThemeMac::PaintMenuItemBackground( |
245 SkCanvas* canvas, | 245 SkCanvas* canvas, |
246 State state, | 246 State state, |
247 const gfx::Rect& rect, | 247 const gfx::Rect& rect, |
248 const MenuListExtraParams& menu_list) const { | 248 const MenuItemExtraParams& menu_item) const { |
249 SkPaint paint; | 249 SkPaint paint; |
250 switch (state) { | 250 switch (state) { |
251 case NativeTheme::kNormal: | 251 case NativeTheme::kNormal: |
252 case NativeTheme::kDisabled: | 252 case NativeTheme::kDisabled: |
253 // Draw nothing over the regular background. | 253 // Draw nothing over the regular background. |
254 break; | 254 break; |
255 case NativeTheme::kHovered: | 255 case NativeTheme::kHovered: |
256 // TODO(tapted): Draw a gradient, and use [NSColor currentControlTint] to | 256 // TODO(tapted): Draw a gradient, and use [NSColor currentControlTint] to |
257 // pick colors. The System color "selectedMenuItemColor" is actually still | 257 // pick colors. The System color "selectedMenuItemColor" is actually still |
258 // blue for Graphite. And while "keyboardFocusIndicatorColor" does change, | 258 // blue for Graphite. And while "keyboardFocusIndicatorColor" does change, |
259 // and is a good shade of gray, it's not blue enough for the Blue theme. | 259 // and is a good shade of gray, it's not blue enough for the Blue theme. |
260 paint.setColor(GetSystemColor(kColorId_HoverMenuItemBackgroundColor)); | 260 paint.setColor(GetSystemColor(kColorId_HoverMenuItemBackgroundColor)); |
261 canvas->drawRect(gfx::RectToSkRect(rect), paint); | 261 canvas->drawRect(gfx::RectToSkRect(rect), paint); |
262 break; | 262 break; |
263 default: | 263 default: |
264 NOTREACHED(); | 264 NOTREACHED(); |
265 break; | 265 break; |
266 } | 266 } |
267 } | 267 } |
268 | 268 |
269 NativeThemeMac::NativeThemeMac() { | 269 NativeThemeMac::NativeThemeMac() { |
270 } | 270 } |
271 | 271 |
272 NativeThemeMac::~NativeThemeMac() { | 272 NativeThemeMac::~NativeThemeMac() { |
273 } | 273 } |
274 | 274 |
275 } // namespace ui | 275 } // namespace ui |
OLD | NEW |