| 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/native_theme_aura.h" | 5 #include "ui/native_theme/native_theme_aura.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "grit/ui_resources.h" | 8 #include "grit/ui_resources.h" |
| 9 #include "ui/base/layout.h" | 9 #include "ui/base/layout.h" |
| 10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
| 11 #include "ui/gfx/image/image_skia.h" | 11 #include "ui/gfx/image/image_skia.h" |
| 12 #include "ui/gfx/path.h" |
| 12 #include "ui/gfx/rect.h" | 13 #include "ui/gfx/rect.h" |
| 13 #include "ui/gfx/size.h" | 14 #include "ui/gfx/size.h" |
| 14 #include "ui/gfx/skbitmap_operations.h" | 15 #include "ui/gfx/skbitmap_operations.h" |
| 15 #include "ui/native_theme/common_theme.h" | 16 #include "ui/native_theme/common_theme.h" |
| 17 #include "ui/views/round_rect_painter.h" |
| 16 | 18 |
| 17 namespace { | 19 namespace { |
| 18 | 20 |
| 19 const SkColor kMenuBackgroundColor = SK_ColorWHITE; | 21 const SkColor kMenuBackgroundColor = SK_ColorWHITE; |
| 20 | 22 |
| 21 // Theme colors returned by GetSystemColor(). | 23 // Theme colors returned by GetSystemColor(). |
| 22 const SkColor kInvalidColorIdColor = SkColorSetRGB(255, 0, 128); | 24 const SkColor kInvalidColorIdColor = SkColorSetRGB(255, 0, 128); |
| 23 // Windows: | 25 // Windows: |
| 24 const SkColor kWindowBackgroundColor = SK_ColorWHITE; | 26 const SkColor kWindowBackgroundColor = SK_ColorWHITE; |
| 25 // Dialogs: | 27 // Dialogs: |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 case kColorId_MenuBorderColor: | 190 case kColorId_MenuBorderColor: |
| 189 NOTREACHED(); | 191 NOTREACHED(); |
| 190 break; | 192 break; |
| 191 } | 193 } |
| 192 | 194 |
| 193 return kInvalidColorIdColor; | 195 return kInvalidColorIdColor; |
| 194 } | 196 } |
| 195 | 197 |
| 196 void NativeThemeAura::PaintMenuPopupBackground(SkCanvas* canvas, | 198 void NativeThemeAura::PaintMenuPopupBackground(SkCanvas* canvas, |
| 197 const gfx::Size& size) const { | 199 const gfx::Size& size) const { |
| 198 canvas->drawColor(kMenuBackgroundColor, SkXfermode::kSrc_Mode); | 200 SkPaint paint; |
| 201 paint.setStyle(SkPaint::kFill_Style); |
| 202 paint.setFlags(SkPaint::kAntiAlias_Flag); |
| 203 paint.setColor(kMenuBackgroundColor); |
| 204 |
| 205 gfx::Path path; |
| 206 views::RoundRectPainter::CreateRoundRectPath(gfx::Rect(size), &path); |
| 207 |
| 208 canvas->drawPath(path, paint); |
| 199 } | 209 } |
| 200 | 210 |
| 201 void NativeThemeAura::PaintScrollbarTrack( | 211 void NativeThemeAura::PaintScrollbarTrack( |
| 202 SkCanvas* canvas, | 212 SkCanvas* canvas, |
| 203 Part part, | 213 Part part, |
| 204 State state, | 214 State state, |
| 205 const ScrollbarTrackExtraParams& extra_params, | 215 const ScrollbarTrackExtraParams& extra_params, |
| 206 const gfx::Rect& rect) const { | 216 const gfx::Rect& rect) const { |
| 207 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 217 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| 208 if (part == kScrollbarVerticalTrack) { | 218 if (part == kScrollbarVerticalTrack) { |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 DrawTiledImage(canvas, *center, | 354 DrawTiledImage(canvas, *center, |
| 345 0, 0, 1.0, 1.0, | 355 0, 0, 1.0, 1.0, |
| 346 rect.x() + left->width(), rect.y(), | 356 rect.x() + left->width(), rect.y(), |
| 347 rect.width() - left->width() - right->width(), | 357 rect.width() - left->width() - right->width(), |
| 348 center->height()); | 358 center->height()); |
| 349 } | 359 } |
| 350 } | 360 } |
| 351 } | 361 } |
| 352 | 362 |
| 353 } // namespace ui | 363 } // namespace ui |
| OLD | NEW |