Chromium Code Reviews| 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" |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 36 | 36 |
| 37 const SkColor kMenuPopupBackgroundColorMavericks = | 37 const SkColor kMenuPopupBackgroundColorMavericks = |
| 38 SkColorSetARGB(255, 255, 255, 255); | 38 SkColorSetARGB(255, 255, 255, 255); |
| 39 const SkColor kMenuSeparatorColorMavericks = SkColorSetARGB(243, 228, 228, 228); | 39 const SkColor kMenuSeparatorColorMavericks = SkColorSetARGB(243, 228, 228, 228); |
| 40 | 40 |
| 41 // Hardcoded color used for some existing dialogs in Chrome's Cocoa UI. | 41 // Hardcoded color used for some existing dialogs in Chrome's Cocoa UI. |
| 42 const SkColor kDialogBackgroundColor = SkColorSetRGB(251, 251, 251); | 42 const SkColor kDialogBackgroundColor = SkColorSetRGB(251, 251, 251); |
| 43 | 43 |
| 44 // Color for the highlighted text in a control when that control doesn't have | 44 // Color for the highlighted text in a control when that control doesn't have |
| 45 // keyboard focus. | 45 // keyboard focus. |
| 46 const SkColor kUnfocusedSelectedTextBackgroundColor = | 46 const SkColor kUnfocusedSelectedTextBackgroundColor = |
|
tapted
2016/09/20 06:57:55
Can you use this?
Patti Lor
2016/10/12 05:53:00
Yes! Thanks for finding it, I totally missed it.
| |
| 47 SkColorSetRGB(220, 220, 220); | 47 SkColorSetRGB(220, 220, 220); |
| 48 | 48 |
| 49 // Helper to make indexing an array by an enum class easier. | 49 // Helper to make indexing an array by an enum class easier. |
| 50 template <class KEY, class VALUE> | 50 template <class KEY, class VALUE> |
| 51 struct EnumArray { | 51 struct EnumArray { |
| 52 VALUE& operator[](const KEY& key) { return array[static_cast<size_t>(key)]; } | 52 VALUE& operator[](const KEY& key) { return array[static_cast<size_t>(key)]; } |
| 53 VALUE array[static_cast<size_t>(KEY::COUNT)]; | 53 VALUE array[static_cast<size_t>(KEY::COUNT)]; |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 // NSColor has a number of methods that return system colors (i.e. controlled by | 56 // NSColor has a number of methods that return system colors (i.e. controlled by |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 207 case kColorId_TextfieldDefaultColor: | 207 case kColorId_TextfieldDefaultColor: |
| 208 case kColorId_TextfieldReadOnlyColor: | 208 case kColorId_TextfieldReadOnlyColor: |
| 209 return NSSystemColorToSkColor([NSColor textColor]); | 209 return NSSystemColorToSkColor([NSColor textColor]); |
| 210 case kColorId_TextfieldDefaultBackground: | 210 case kColorId_TextfieldDefaultBackground: |
| 211 case kColorId_TextfieldReadOnlyBackground: | 211 case kColorId_TextfieldReadOnlyBackground: |
| 212 return NSSystemColorToSkColor([NSColor textBackgroundColor]); | 212 return NSSystemColorToSkColor([NSColor textBackgroundColor]); |
| 213 case kColorId_TextfieldSelectionColor: | 213 case kColorId_TextfieldSelectionColor: |
| 214 return NSSystemColorToSkColor([NSColor selectedTextColor]); | 214 return NSSystemColorToSkColor([NSColor selectedTextColor]); |
| 215 case kColorId_TextfieldSelectionBackgroundFocused: | 215 case kColorId_TextfieldSelectionBackgroundFocused: |
| 216 return NSSystemColorToSkColor([NSColor selectedTextBackgroundColor]); | 216 return NSSystemColorToSkColor([NSColor selectedTextBackgroundColor]); |
| 217 case kColorId_TextfieldSelectionBackgroundUnfocused: | |
| 218 return NSSystemColorToSkColor( | |
| 219 [NSColor colorWithSRGBRed:220 green:220 blue:220 alpha:1]); | |
| 217 | 220 |
| 218 // Trees/Tables. For focused text, use the alternate* versions, which | 221 // Trees/Tables. For focused text, use the alternate* versions, which |
| 219 // NSColor documents as "the table and list view equivalent to the | 222 // NSColor documents as "the table and list view equivalent to the |
| 220 // selectedControlTextColor". | 223 // selectedControlTextColor". |
| 221 case kColorId_TreeBackground: | 224 case kColorId_TreeBackground: |
| 222 case kColorId_TableBackground: | 225 case kColorId_TableBackground: |
| 223 return NSSystemColorToSkColor([NSColor controlBackgroundColor]); | 226 return NSSystemColorToSkColor([NSColor controlBackgroundColor]); |
| 224 case kColorId_TreeText: | 227 case kColorId_TreeText: |
| 225 case kColorId_TableText: | 228 case kColorId_TableText: |
| 226 case kColorId_TableSelectedTextUnfocused: | 229 case kColorId_TableSelectedTextUnfocused: |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 429 canvas->drawDRRect(outer_shape, shape, paint); | 432 canvas->drawDRRect(outer_shape, shape, paint); |
| 430 } | 433 } |
| 431 | 434 |
| 432 NativeThemeMac::NativeThemeMac() { | 435 NativeThemeMac::NativeThemeMac() { |
| 433 } | 436 } |
| 434 | 437 |
| 435 NativeThemeMac::~NativeThemeMac() { | 438 NativeThemeMac::~NativeThemeMac() { |
| 436 } | 439 } |
| 437 | 440 |
| 438 } // namespace ui | 441 } // namespace ui |
| OLD | NEW |