| 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" |
| 11 #include "base/mac/scoped_cftyperef.h" | 11 #include "base/mac/scoped_cftyperef.h" |
| 12 #include "base/mac/sdk_forward_declarations.h" | 12 #include "base/mac/sdk_forward_declarations.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #import "skia/ext/skia_utils_mac.h" | 14 #import "skia/ext/skia_utils_mac.h" |
| 15 #include "third_party/skia/include/core/SkDrawLooper.h" | 15 #include "third_party/skia/include/core/SkDrawLooper.h" |
| 16 #include "third_party/skia/include/core/SkRRect.h" | 16 #include "third_party/skia/include/core/SkRRect.h" |
| 17 #include "third_party/skia/include/effects/SkGradientShader.h" | 17 #include "third_party/skia/include/effects/SkGradientShader.h" |
| 18 #include "ui/base/material_design/material_design_controller.h" |
| 18 #include "ui/gfx/color_palette.h" | 19 #include "ui/gfx/color_palette.h" |
| 19 #include "ui/gfx/geometry/rect.h" | 20 #include "ui/gfx/geometry/rect.h" |
| 20 #include "ui/gfx/shadow_value.h" | 21 #include "ui/gfx/shadow_value.h" |
| 21 #include "ui/gfx/skia_util.h" | 22 #include "ui/gfx/skia_util.h" |
| 22 #include "ui/native_theme/common_theme.h" | 23 #include "ui/native_theme/common_theme.h" |
| 23 | 24 |
| 24 namespace { | 25 namespace { |
| 25 | 26 |
| 26 // Values calculated by reading pixels and solving simultaneous equations | 27 // Values calculated by reading pixels and solving simultaneous equations |
| 27 // derived from "A over B" alpha compositing. Steps: Sample the semi-transparent | 28 // derived from "A over B" alpha compositing. Steps: Sample the semi-transparent |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 return &s_native_theme; | 107 return &s_native_theme; |
| 107 } | 108 } |
| 108 | 109 |
| 109 SkColor NativeThemeMac::GetSystemColor(ColorId color_id) const { | 110 SkColor NativeThemeMac::GetSystemColor(ColorId color_id) const { |
| 110 // TODO(tapted): Add caching for these, and listen for | 111 // TODO(tapted): Add caching for these, and listen for |
| 111 // NSSystemColorsDidChangeNotification. | 112 // NSSystemColorsDidChangeNotification. |
| 112 switch (color_id) { | 113 switch (color_id) { |
| 113 case kColorId_WindowBackground: | 114 case kColorId_WindowBackground: |
| 114 return NSSystemColorToSkColor([NSColor windowBackgroundColor]); | 115 return NSSystemColorToSkColor([NSColor windowBackgroundColor]); |
| 115 case kColorId_DialogBackground: | 116 case kColorId_DialogBackground: |
| 116 return kDialogBackgroundColor; | 117 return ui::MaterialDesignController::IsSecondaryUiMaterial() |
| 118 ? GetAuraColor(color_id, this) |
| 119 : kDialogBackgroundColor; |
| 117 case kColorId_BubbleBackground: | 120 case kColorId_BubbleBackground: |
| 118 return SK_ColorWHITE; | 121 return SK_ColorWHITE; |
| 119 | 122 |
| 120 case kColorId_FocusedBorderColor: | 123 case kColorId_FocusedBorderColor: |
| 121 case kColorId_FocusedMenuButtonBorderColor: | 124 case kColorId_FocusedMenuButtonBorderColor: |
| 122 return NSSystemColorToSkColor([NSColor keyboardFocusIndicatorColor]); | 125 return NSSystemColorToSkColor([NSColor keyboardFocusIndicatorColor]); |
| 123 case kColorId_UnfocusedBorderColor: | 126 case kColorId_UnfocusedBorderColor: |
| 124 return NSSystemColorToSkColor([NSColor controlColor]); | 127 return NSSystemColorToSkColor([NSColor controlColor]); |
| 125 | 128 |
| 126 // Buttons and labels. | 129 // Buttons and labels. |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 canvas->drawDRRect(outer_shape, shape, paint); | 393 canvas->drawDRRect(outer_shape, shape, paint); |
| 391 } | 394 } |
| 392 | 395 |
| 393 NativeThemeMac::NativeThemeMac() { | 396 NativeThemeMac::NativeThemeMac() { |
| 394 } | 397 } |
| 395 | 398 |
| 396 NativeThemeMac::~NativeThemeMac() { | 399 NativeThemeMac::~NativeThemeMac() { |
| 397 } | 400 } |
| 398 | 401 |
| 399 } // namespace ui | 402 } // namespace ui |
| OLD | NEW |