| 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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 case NativeTheme::kColorId_NumColors: | 322 case NativeTheme::kColorId_NumColors: |
| 323 break; | 323 break; |
| 324 } | 324 } |
| 325 | 325 |
| 326 NOTREACHED(); | 326 NOTREACHED(); |
| 327 return gfx::kPlaceholderColor; | 327 return gfx::kPlaceholderColor; |
| 328 } | 328 } |
| 329 | 329 |
| 330 void CommonThemePaintMenuItemBackground( | 330 void CommonThemePaintMenuItemBackground( |
| 331 const NativeTheme* theme, | 331 const NativeTheme* theme, |
| 332 SkCanvas* canvas, | 332 cc::PaintCanvas* canvas, |
| 333 NativeTheme::State state, | 333 NativeTheme::State state, |
| 334 const gfx::Rect& rect, | 334 const gfx::Rect& rect, |
| 335 const NativeTheme::MenuItemExtraParams& menu_item) { | 335 const NativeTheme::MenuItemExtraParams& menu_item) { |
| 336 SkPaint paint; | 336 cc::PaintFlags paint; |
| 337 switch (state) { | 337 switch (state) { |
| 338 case NativeTheme::kNormal: | 338 case NativeTheme::kNormal: |
| 339 case NativeTheme::kDisabled: | 339 case NativeTheme::kDisabled: |
| 340 paint.setColor( | 340 paint.setColor( |
| 341 theme->GetSystemColor(NativeTheme::kColorId_MenuBackgroundColor)); | 341 theme->GetSystemColor(NativeTheme::kColorId_MenuBackgroundColor)); |
| 342 break; | 342 break; |
| 343 case NativeTheme::kHovered: | 343 case NativeTheme::kHovered: |
| 344 paint.setColor(theme->GetSystemColor( | 344 paint.setColor(theme->GetSystemColor( |
| 345 NativeTheme::kColorId_FocusedMenuItemBackgroundColor)); | 345 NativeTheme::kColorId_FocusedMenuItemBackgroundColor)); |
| 346 break; | 346 break; |
| 347 default: | 347 default: |
| 348 NOTREACHED() << "Invalid state " << state; | 348 NOTREACHED() << "Invalid state " << state; |
| 349 break; | 349 break; |
| 350 } | 350 } |
| 351 if (menu_item.corner_radius > 0) { | 351 if (menu_item.corner_radius > 0) { |
| 352 const SkScalar radius = SkIntToScalar(menu_item.corner_radius); | 352 const SkScalar radius = SkIntToScalar(menu_item.corner_radius); |
| 353 canvas->drawRoundRect(gfx::RectToSkRect(rect), radius, radius, paint); | 353 canvas->drawRoundRect(gfx::RectToSkRect(rect), radius, radius, paint); |
| 354 return; | 354 return; |
| 355 } | 355 } |
| 356 canvas->drawRect(gfx::RectToSkRect(rect), paint); | 356 canvas->drawRect(gfx::RectToSkRect(rect), paint); |
| 357 } | 357 } |
| 358 | 358 |
| 359 } // namespace ui | 359 } // namespace ui |
| OLD | NEW |