Files.app: Override overflow specifying to use the original scroll bar.
[chromium-blink-merge.git] / ui / native_theme / fallback_theme.cc
blob127243fdde09bf88e5507eaca712f2ca5819fb96
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
3 // found in the LICENSE file.
5 #include "ui/native_theme/fallback_theme.h"
7 #include "base/basictypes.h"
8 #include "base/logging.h"
9 #include "ui/gfx/color_utils.h"
10 #include "ui/native_theme/common_theme.h"
12 namespace ui {
14 FallbackTheme::FallbackTheme() {
17 FallbackTheme::~FallbackTheme() {
20 SkColor FallbackTheme::GetSystemColor(ColorId color_id) const {
21 // This implementation returns hardcoded colors.
23 static const SkColor kInvalidColorIdColor = SkColorSetRGB(255, 0, 128);
24 // Windows:
25 static const SkColor kWindowBackgroundColor = SK_ColorWHITE;
26 // Dialogs:
27 static const SkColor kDialogBackgroundColor = SkColorSetRGB(251, 251, 251);
28 // FocusableBorder:
29 static const SkColor kFocusedBorderColor = SkColorSetRGB(0x4D, 0x90, 0xFE);
30 static const SkColor kUnfocusedBorderColor = SkColorSetRGB(0xD9, 0xD9, 0xD9);
31 // Button:
32 static const SkColor kButtonBackgroundColor = SkColorSetRGB(0xDE, 0xDE, 0xDE);
33 static const SkColor kButtonEnabledColor = SkColorSetRGB(0x22, 0x22, 0x22);
34 static const SkColor kButtonHighlightColor = SkColorSetRGB(0, 0, 0);
35 static const SkColor kButtonHoverColor = kButtonEnabledColor;
36 // Label:
37 static const SkColor kLabelEnabledColor = kButtonEnabledColor;
38 static const SkColor kLabelBackgroundColor = SK_ColorWHITE;
39 // Textfield:
40 static const SkColor kTextfieldDefaultColor = SK_ColorBLACK;
41 static const SkColor kTextfieldDefaultBackground = SK_ColorWHITE;
42 static const SkColor kTextfieldReadOnlyColor = SK_ColorDKGRAY;
43 static const SkColor kTextfieldReadOnlyBackground = SK_ColorWHITE;
44 static const SkColor kTextfieldSelectionBackgroundFocused =
45 SkColorSetARGB(0x54, 0x60, 0xA8, 0xEB);
46 static const SkColor kTextfieldSelectionColor =
47 color_utils::AlphaBlend(SK_ColorBLACK,
48 kTextfieldSelectionBackgroundFocused, 0xdd);
49 // Tooltip
50 static const SkColor kTooltipBackground = 0xFFFFFFCC;
51 static const SkColor kTooltipTextColor = kLabelEnabledColor;
52 // Tree
53 static const SkColor kTreeBackground = SK_ColorWHITE;
54 static const SkColor kTreeTextColor = SK_ColorBLACK;
55 static const SkColor kTreeSelectedTextColor = SK_ColorBLACK;
56 static const SkColor kTreeSelectionBackgroundColor =
57 SkColorSetRGB(0xEE, 0xEE, 0xEE);
58 static const SkColor kTreeArrowColor = SkColorSetRGB(0x7A, 0x7A, 0x7A);
59 // Table
60 static const SkColor kTableBackground = SK_ColorWHITE;
61 static const SkColor kTableTextColor = SK_ColorBLACK;
62 static const SkColor kTableSelectedTextColor = SK_ColorBLACK;
63 static const SkColor kTableSelectionBackgroundColor =
64 SkColorSetRGB(0xEE, 0xEE, 0xEE);
65 static const SkColor kTableGroupingIndicatorColor =
66 SkColorSetRGB(0xCC, 0xCC, 0xCC);
67 // Results Tables
68 static const SkColor kResultsTableHoveredBackground =
69 color_utils::AlphaBlend(kTextfieldSelectionBackgroundFocused,
70 kTextfieldDefaultBackground, 0x40);
71 static const SkColor kResultsTableNormalText = color_utils::AlphaBlend(
72 SK_ColorBLACK, kTextfieldDefaultBackground, 0xDD);
73 static const SkColor kResultsTableHoveredText = color_utils::AlphaBlend(
74 SK_ColorBLACK, kResultsTableHoveredBackground, 0xDD);
75 static const SkColor kResultsTableSelectedText = color_utils::AlphaBlend(
76 SK_ColorBLACK, kTextfieldSelectionBackgroundFocused, 0xDD);
77 static const SkColor kResultsTableNormalDimmedText = color_utils::AlphaBlend(
78 SK_ColorBLACK, kTextfieldDefaultBackground, 0xBB);
79 static const SkColor kResultsTableHoveredDimmedText = color_utils::AlphaBlend(
80 SK_ColorBLACK, kResultsTableHoveredBackground, 0xBB);
81 static const SkColor kResultsTableSelectedDimmedText =
82 color_utils::AlphaBlend(
83 SK_ColorBLACK, kTextfieldSelectionBackgroundFocused, 0xBB);
84 static const SkColor kResultsTableSelectedOrHoveredUrl =
85 SkColorSetARGB(0xff, 0x00, 0x66, 0x22);
86 static const SkColor kResultsTableNormalDivider = color_utils::AlphaBlend(
87 kResultsTableNormalText, kTextfieldDefaultBackground, 0x34);
88 static const SkColor kResultsTableHoveredDivider = color_utils::AlphaBlend(
89 kResultsTableHoveredText, kResultsTableHoveredBackground, 0x34);
90 static const SkColor kResultsTabSelectedDivider = color_utils::AlphaBlend(
91 kResultsTableSelectedText, kTextfieldSelectionBackgroundFocused, 0x34);
93 SkColor color;
94 if (CommonThemeGetSystemColor(color_id, &color))
95 return color;
97 switch (color_id) {
98 // Windows
99 case kColorId_WindowBackground:
100 return kWindowBackgroundColor;
102 // Dialogs
103 case kColorId_DialogBackground:
104 return kDialogBackgroundColor;
106 // FocusableBorder
107 case kColorId_FocusedBorderColor:
108 return kFocusedBorderColor;
109 case kColorId_UnfocusedBorderColor:
110 return kUnfocusedBorderColor;
112 // Button
113 case kColorId_ButtonBackgroundColor:
114 return kButtonBackgroundColor;
115 case kColorId_ButtonEnabledColor:
116 return kButtonEnabledColor;
117 case kColorId_ButtonHighlightColor:
118 return kButtonHighlightColor;
119 case kColorId_ButtonHoverColor:
120 return kButtonHoverColor;
122 // Label
123 case kColorId_LabelEnabledColor:
124 return kLabelEnabledColor;
125 case kColorId_LabelDisabledColor:
126 return GetSystemColor(kColorId_ButtonDisabledColor);
127 case kColorId_LabelBackgroundColor:
128 return kLabelBackgroundColor;
130 // Textfield
131 case kColorId_TextfieldDefaultColor:
132 return kTextfieldDefaultColor;
133 case kColorId_TextfieldDefaultBackground:
134 return kTextfieldDefaultBackground;
135 case kColorId_TextfieldReadOnlyColor:
136 return kTextfieldReadOnlyColor;
137 case kColorId_TextfieldReadOnlyBackground:
138 return kTextfieldReadOnlyBackground;
139 case kColorId_TextfieldSelectionColor:
140 return kTextfieldSelectionColor;
141 case kColorId_TextfieldSelectionBackgroundFocused:
142 return kTextfieldSelectionBackgroundFocused;
144 // Tooltip
145 case kColorId_TooltipBackground:
146 return kTooltipBackground;
147 case kColorId_TooltipText:
148 return kTooltipTextColor;
150 // Tree
151 case kColorId_TreeBackground:
152 return kTreeBackground;
153 case kColorId_TreeText:
154 return kTreeTextColor;
155 case kColorId_TreeSelectedText:
156 case kColorId_TreeSelectedTextUnfocused:
157 return kTreeSelectedTextColor;
158 case kColorId_TreeSelectionBackgroundFocused:
159 case kColorId_TreeSelectionBackgroundUnfocused:
160 return kTreeSelectionBackgroundColor;
161 case kColorId_TreeArrow:
162 return kTreeArrowColor;
164 // Table
165 case kColorId_TableBackground:
166 return kTableBackground;
167 case kColorId_TableText:
168 return kTableTextColor;
169 case kColorId_TableSelectedText:
170 case kColorId_TableSelectedTextUnfocused:
171 return kTableSelectedTextColor;
172 case kColorId_TableSelectionBackgroundFocused:
173 case kColorId_TableSelectionBackgroundUnfocused:
174 return kTableSelectionBackgroundColor;
175 case kColorId_TableGroupingIndicatorColor:
176 return kTableGroupingIndicatorColor;
178 // Results Tables
179 case kColorId_ResultsTableNormalBackground:
180 return kTextfieldDefaultBackground;
181 case kColorId_ResultsTableHoveredBackground:
182 return kResultsTableHoveredBackground;
183 case kColorId_ResultsTableSelectedBackground:
184 return kTextfieldSelectionBackgroundFocused;
185 case kColorId_ResultsTableNormalText:
186 return kResultsTableNormalText;
187 case kColorId_ResultsTableHoveredText:
188 return kResultsTableHoveredText;
189 case kColorId_ResultsTableSelectedText:
190 return kResultsTableSelectedText;
191 case kColorId_ResultsTableNormalDimmedText:
192 return kResultsTableNormalDimmedText;
193 case kColorId_ResultsTableHoveredDimmedText:
194 return kResultsTableHoveredDimmedText;
195 case kColorId_ResultsTableSelectedDimmedText:
196 return kResultsTableSelectedDimmedText;
197 case kColorId_ResultsTableNormalUrl:
198 return kTextfieldSelectionColor;
199 case kColorId_ResultsTableHoveredUrl:
200 case kColorId_ResultsTableSelectedUrl:
201 return kResultsTableSelectedOrHoveredUrl;
202 case kColorId_ResultsTableNormalDivider:
203 return kResultsTableNormalDivider;
204 case kColorId_ResultsTableHoveredDivider:
205 return kResultsTableHoveredDivider;
206 case kColorId_ResultsTableSelectedDivider:
207 return kResultsTabSelectedDivider;
209 default:
210 NOTREACHED();
211 break;
214 return kInvalidColorIdColor;
217 } // namespace ui