Chromium Code Reviews| 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_win.h" | 5 #include "ui/native_theme/native_theme_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <uxtheme.h> | 9 #include <uxtheme.h> |
| 10 #include <vsstyle.h> | 10 #include <vsstyle.h> |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 139 return true; | 139 return true; |
| 140 } | 140 } |
| 141 | 141 |
| 142 private: | 142 private: |
| 143 base::win::ScopedCreateDC dc_; | 143 base::win::ScopedCreateDC dc_; |
| 144 base::win::ScopedBitmap bitmap_; | 144 base::win::ScopedBitmap bitmap_; |
| 145 | 145 |
| 146 DISALLOW_COPY_AND_ASSIGN(ScopedCreateDCWithBitmap); | 146 DISALLOW_COPY_AND_ASSIGN(ScopedCreateDCWithBitmap); |
| 147 }; | 147 }; |
| 148 | 148 |
| 149 SkColor GetUnfocusedSelectionBackgroundColor( | |
|
tapted
2016/10/24 06:04:16
Can we make this a (const) member function of Nati
Patti Lor
2016/10/27 00:17:27
Done.
| |
| 150 std::map<int, SkColor> system_colors, | |
| 151 bool high_contrast) { | |
| 152 return system_colors[high_contrast ? COLOR_MENUHIGHLIGHT : COLOR_BTNFACE]; | |
| 153 } | |
| 154 | |
| 149 } // namespace | 155 } // namespace |
| 150 | 156 |
| 151 namespace ui { | 157 namespace ui { |
| 152 | 158 |
| 153 bool NativeThemeWin::IsThemingActive() const { | 159 bool NativeThemeWin::IsThemingActive() const { |
| 154 return is_theme_active_ && is_theme_active_(); | 160 return is_theme_active_ && is_theme_active_(); |
| 155 } | 161 } |
| 156 | 162 |
| 157 bool NativeThemeWin::IsUsingHighContrastTheme() const { | 163 bool NativeThemeWin::IsUsingHighContrastTheme() const { |
| 158 if (is_using_high_contrast_valid_) | 164 if (is_using_high_contrast_valid_) |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 556 case kColorId_TextfieldDefaultBackground: | 562 case kColorId_TextfieldDefaultBackground: |
| 557 return system_colors_[COLOR_WINDOW]; | 563 return system_colors_[COLOR_WINDOW]; |
| 558 case kColorId_TextfieldReadOnlyColor: | 564 case kColorId_TextfieldReadOnlyColor: |
| 559 return system_colors_[COLOR_GRAYTEXT]; | 565 return system_colors_[COLOR_GRAYTEXT]; |
| 560 case kColorId_TextfieldReadOnlyBackground: | 566 case kColorId_TextfieldReadOnlyBackground: |
| 561 return system_colors_[COLOR_3DFACE]; | 567 return system_colors_[COLOR_3DFACE]; |
| 562 case kColorId_TextfieldSelectionColor: | 568 case kColorId_TextfieldSelectionColor: |
| 563 return system_colors_[COLOR_HIGHLIGHTTEXT]; | 569 return system_colors_[COLOR_HIGHLIGHTTEXT]; |
| 564 case kColorId_TextfieldSelectionBackgroundFocused: | 570 case kColorId_TextfieldSelectionBackgroundFocused: |
| 565 return system_colors_[COLOR_HIGHLIGHT]; | 571 return system_colors_[COLOR_HIGHLIGHT]; |
| 572 case kColorId_TextfieldSelectionBackgroundUnfocused: | |
| 573 return GetUnfocusedSelectionBackgroundColor(system_colors_, | |
| 574 IsUsingHighContrastTheme()); | |
| 566 | 575 |
| 567 // Tooltip | 576 // Tooltip |
| 568 case kColorId_TooltipBackground: | 577 case kColorId_TooltipBackground: |
| 569 case kColorId_TooltipText: | 578 case kColorId_TooltipText: |
| 570 NOTREACHED(); | 579 NOTREACHED(); |
| 571 return gfx::kPlaceholderColor; | 580 return gfx::kPlaceholderColor; |
| 572 | 581 |
| 573 // Tree | 582 // Tree |
| 574 // NOTE: these aren't right for all themes, but as close as I could get. | 583 // NOTE: these aren't right for all themes, but as close as I could get. |
| 575 case kColorId_TreeBackground: | 584 case kColorId_TreeBackground: |
| 576 return system_colors_[COLOR_WINDOW]; | 585 return system_colors_[COLOR_WINDOW]; |
| 577 case kColorId_TreeText: | 586 case kColorId_TreeText: |
| 578 return system_colors_[COLOR_WINDOWTEXT]; | 587 return system_colors_[COLOR_WINDOWTEXT]; |
| 579 case kColorId_TreeSelectedText: | 588 case kColorId_TreeSelectedText: |
| 580 return system_colors_[COLOR_HIGHLIGHTTEXT]; | 589 return system_colors_[COLOR_HIGHLIGHTTEXT]; |
| 581 case kColorId_TreeSelectedTextUnfocused: | 590 case kColorId_TreeSelectedTextUnfocused: |
| 582 return system_colors_[COLOR_BTNTEXT]; | 591 return system_colors_[COLOR_BTNTEXT]; |
| 583 case kColorId_TreeSelectionBackgroundFocused: | 592 case kColorId_TreeSelectionBackgroundFocused: |
| 584 return system_colors_[COLOR_HIGHLIGHT]; | 593 return system_colors_[COLOR_HIGHLIGHT]; |
| 585 case kColorId_TreeSelectionBackgroundUnfocused: | 594 case kColorId_TreeSelectionBackgroundUnfocused: |
| 586 return system_colors_[IsUsingHighContrastTheme() ? | 595 return GetUnfocusedSelectionBackgroundColor(system_colors_, |
| 587 COLOR_MENUHIGHLIGHT : COLOR_BTNFACE]; | 596 IsUsingHighContrastTheme()); |
| 588 case kColorId_TreeArrow: | 597 case kColorId_TreeArrow: |
| 589 return system_colors_[COLOR_WINDOWTEXT]; | 598 return system_colors_[COLOR_WINDOWTEXT]; |
| 590 | 599 |
| 591 // Table | 600 // Table |
| 592 case kColorId_TableBackground: | 601 case kColorId_TableBackground: |
| 593 return system_colors_[COLOR_WINDOW]; | 602 return system_colors_[COLOR_WINDOW]; |
| 594 case kColorId_TableText: | 603 case kColorId_TableText: |
| 595 return system_colors_[COLOR_WINDOWTEXT]; | 604 return system_colors_[COLOR_WINDOWTEXT]; |
| 596 case kColorId_TableSelectedText: | 605 case kColorId_TableSelectedText: |
| 597 return system_colors_[COLOR_HIGHLIGHTTEXT]; | 606 return system_colors_[COLOR_HIGHLIGHTTEXT]; |
| 598 case kColorId_TableSelectedTextUnfocused: | 607 case kColorId_TableSelectedTextUnfocused: |
| 599 return system_colors_[COLOR_BTNTEXT]; | 608 return system_colors_[COLOR_BTNTEXT]; |
| 600 case kColorId_TableSelectionBackgroundFocused: | 609 case kColorId_TableSelectionBackgroundFocused: |
| 601 return system_colors_[COLOR_HIGHLIGHT]; | 610 return system_colors_[COLOR_HIGHLIGHT]; |
| 602 case kColorId_TableSelectionBackgroundUnfocused: | 611 case kColorId_TableSelectionBackgroundUnfocused: |
| 603 return system_colors_[IsUsingHighContrastTheme() ? | 612 return GetUnfocusedSelectionBackgroundColor(system_colors_, |
| 604 COLOR_MENUHIGHLIGHT : COLOR_BTNFACE]; | 613 IsUsingHighContrastTheme()); |
| 605 case kColorId_TableGroupingIndicatorColor: | 614 case kColorId_TableGroupingIndicatorColor: |
| 606 return system_colors_[COLOR_GRAYTEXT]; | 615 return system_colors_[COLOR_GRAYTEXT]; |
| 607 | 616 |
| 608 // Results Tables | 617 // Results Tables |
| 609 case kColorId_ResultsTableNormalBackground: | 618 case kColorId_ResultsTableNormalBackground: |
| 610 return system_colors_[COLOR_WINDOW]; | 619 return system_colors_[COLOR_WINDOW]; |
| 611 case kColorId_ResultsTableHoveredBackground: | 620 case kColorId_ResultsTableHoveredBackground: |
| 612 return color_utils::AlphaBlend(system_colors_[COLOR_HIGHLIGHT], | 621 return color_utils::AlphaBlend(system_colors_[COLOR_HIGHLIGHT], |
| 613 system_colors_[COLOR_WINDOW], 0x40); | 622 system_colors_[COLOR_WINDOW], 0x40); |
| 614 case kColorId_ResultsTableSelectedBackground: | 623 case kColorId_ResultsTableSelectedBackground: |
| (...skipping 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2112 break; | 2121 break; |
| 2113 case LAST: | 2122 case LAST: |
| 2114 NOTREACHED(); | 2123 NOTREACHED(); |
| 2115 break; | 2124 break; |
| 2116 } | 2125 } |
| 2117 theme_handles_[theme_name] = handle; | 2126 theme_handles_[theme_name] = handle; |
| 2118 return handle; | 2127 return handle; |
| 2119 } | 2128 } |
| 2120 | 2129 |
| 2121 } // namespace ui | 2130 } // namespace ui |
| OLD | NEW |