| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/common_theme.h" | 5 #include "ui/native_theme/common_theme.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "third_party/skia/include/core/SkCanvas.h" | 9 #include "third_party/skia/include/core/SkCanvas.h" |
| 10 #include "ui/base/material_design/material_design_controller.h" | 10 #include "ui/base/material_design/material_design_controller.h" |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 case NativeTheme::kColorId_NumColors: | 313 case NativeTheme::kColorId_NumColors: |
| 314 break; | 314 break; |
| 315 } | 315 } |
| 316 | 316 |
| 317 NOTREACHED(); | 317 NOTREACHED(); |
| 318 return gfx::kPlaceholderColor; | 318 return gfx::kPlaceholderColor; |
| 319 } | 319 } |
| 320 | 320 |
| 321 void CommonThemePaintMenuItemBackground( | 321 void CommonThemePaintMenuItemBackground( |
| 322 const NativeTheme* theme, | 322 const NativeTheme* theme, |
| 323 SkCanvas* canvas, | 323 CdlCanvas* canvas, |
| 324 NativeTheme::State state, | 324 NativeTheme::State state, |
| 325 const gfx::Rect& rect, | 325 const gfx::Rect& rect, |
| 326 const NativeTheme::MenuItemExtraParams& menu_item) { | 326 const NativeTheme::MenuItemExtraParams& menu_item) { |
| 327 SkPaint paint; | 327 CdlPaint paint; |
| 328 switch (state) { | 328 switch (state) { |
| 329 case NativeTheme::kNormal: | 329 case NativeTheme::kNormal: |
| 330 case NativeTheme::kDisabled: | 330 case NativeTheme::kDisabled: |
| 331 paint.setColor( | 331 paint.setColor( |
| 332 theme->GetSystemColor(NativeTheme::kColorId_MenuBackgroundColor)); | 332 theme->GetSystemColor(NativeTheme::kColorId_MenuBackgroundColor)); |
| 333 break; | 333 break; |
| 334 case NativeTheme::kHovered: | 334 case NativeTheme::kHovered: |
| 335 paint.setColor(theme->GetSystemColor( | 335 paint.setColor(theme->GetSystemColor( |
| 336 NativeTheme::kColorId_FocusedMenuItemBackgroundColor)); | 336 NativeTheme::kColorId_FocusedMenuItemBackgroundColor)); |
| 337 break; | 337 break; |
| 338 default: | 338 default: |
| 339 NOTREACHED() << "Invalid state " << state; | 339 NOTREACHED() << "Invalid state " << state; |
| 340 break; | 340 break; |
| 341 } | 341 } |
| 342 if (menu_item.corner_radius > 0) { | 342 if (menu_item.corner_radius > 0) { |
| 343 const SkScalar radius = SkIntToScalar(menu_item.corner_radius); | 343 const SkScalar radius = SkIntToScalar(menu_item.corner_radius); |
| 344 canvas->drawRoundRect(gfx::RectToSkRect(rect), radius, radius, paint); | 344 canvas->drawRoundRect(gfx::RectToSkRect(rect), radius, radius, paint); |
| 345 return; | 345 return; |
| 346 } | 346 } |
| 347 canvas->drawRect(gfx::RectToSkRect(rect), paint); | 347 canvas->drawRect(gfx::RectToSkRect(rect), paint); |
| 348 } | 348 } |
| 349 | 349 |
| 350 } // namespace ui | 350 } // namespace ui |
| OLD | NEW |