| 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 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // Values calculated by reading pixels and solving simultaneous equations | 35 // Values calculated by reading pixels and solving simultaneous equations |
| 36 // derived from "A over B" alpha compositing. Steps: Sample the semi-transparent | 36 // derived from "A over B" alpha compositing. Steps: Sample the semi-transparent |
| 37 // pixel over two backgrounds; P1, P2 over backgrounds B1, B2. Use the color | 37 // pixel over two backgrounds; P1, P2 over backgrounds B1, B2. Use the color |
| 38 // value between 0.0 and 1.0 (i.e. divide by 255.0). Then, | 38 // value between 0.0 and 1.0 (i.e. divide by 255.0). Then, |
| 39 // alpha = (P2 - P1 + B1 - B2) / (B1 - B2) | 39 // alpha = (P2 - P1 + B1 - B2) / (B1 - B2) |
| 40 // color = (P1 - B1 + alpha * B1) / alpha. | 40 // color = (P1 - B1 + alpha * B1) / alpha. |
| 41 const SkColor kMenuPopupBackgroundColor = SkColorSetARGB(251, 255, 255, 255); | 41 const SkColor kMenuPopupBackgroundColor = SkColorSetARGB(251, 255, 255, 255); |
| 42 const SkColor kMenuSeparatorColor = SkColorSetARGB(243, 228, 228, 228); | 42 const SkColor kMenuSeparatorColor = SkColorSetARGB(243, 228, 228, 228); |
| 43 const SkColor kMenuBorderColor = SkColorSetARGB(60, 0, 0, 0); | 43 const SkColor kMenuBorderColor = SkColorSetARGB(60, 0, 0, 0); |
| 44 | 44 |
| 45 // Hardcoded color used for some existing dialogs in Chrome's Cocoa UI. | 45 // New "webui-style" bubbles and dialogs on Mac use a white background. |
| 46 const SkColor kDialogBackgroundColor = SkColorSetRGB(251, 251, 251); | 46 const SkColor kDialogBackgroundColor = SK_ColorWHITE; |
| 47 | 47 |
| 48 // On 10.6 and 10.7 there is no way to get components from system colors. Here, | 48 // On 10.6 and 10.7 there is no way to get components from system colors. Here, |
| 49 // system colors are just opaque objects that can paint themselves and otherwise | 49 // system colors are just opaque objects that can paint themselves and otherwise |
| 50 // tell you nothing. In 10.8, some of the system color classes have incomplete | 50 // tell you nothing. In 10.8, some of the system color classes have incomplete |
| 51 // implementations and throw exceptions even attempting to convert using | 51 // implementations and throw exceptions even attempting to convert using |
| 52 // -[NSColor colorUsingColorSpace:], so don't bother there either. | 52 // -[NSColor colorUsingColorSpace:], so don't bother there either. |
| 53 // This function paints a single pixel to a 1x1 swatch and reads it back. | 53 // This function paints a single pixel to a 1x1 swatch and reads it back. |
| 54 SkColor GetSystemColorUsingSwatch(NSColor* color) { | 54 SkColor GetSystemColorUsingSwatch(NSColor* color) { |
| 55 SkColor swatch; | 55 SkColor swatch; |
| 56 base::ScopedCFTypeRef<CGColorSpaceRef> color_space( | 56 base::ScopedCFTypeRef<CGColorSpaceRef> color_space( |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 set_scrollbar_button_length(0); | 363 set_scrollbar_button_length(0); |
| 364 SetScrollbarColors(kScrollerThumbColor, | 364 SetScrollbarColors(kScrollerThumbColor, |
| 365 kScrollerThumbHoverColor, | 365 kScrollerThumbHoverColor, |
| 366 kScrollerTrackGradientColors[0]); | 366 kScrollerTrackGradientColors[0]); |
| 367 } | 367 } |
| 368 | 368 |
| 369 NativeThemeMac::~NativeThemeMac() { | 369 NativeThemeMac::~NativeThemeMac() { |
| 370 } | 370 } |
| 371 | 371 |
| 372 } // namespace ui | 372 } // namespace ui |
| OLD | NEW |