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