sync/glue: Simplify initialization of BookmarkModel.
[chromium-blink-merge.git] / ui / native_theme / fallback_theme.cc
blobccb59e88ee5cb870237fa6eb912dc13a44017429
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, 0x0b, 0x80, 0x43);
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);
92 const SkColor kPositiveTextColor = SkColorSetRGB(0x0b, 0x80, 0x43);
93 const SkColor kNegativeTextColor = SkColorSetRGB(0xc5, 0x39, 0x29);
94 static const SkColor kResultsTablePositiveText = color_utils::AlphaBlend(
95 kPositiveTextColor, kTextfieldDefaultBackground, 0xDD);
96 static const SkColor kResultsTablePositiveHoveredText =
97 color_utils::AlphaBlend(kPositiveTextColor,
98 kResultsTableHoveredBackground, 0xDD);
99 static const SkColor kResultsTablePositiveSelectedText =
100 color_utils::AlphaBlend(kPositiveTextColor,
101 kTextfieldSelectionBackgroundFocused, 0xDD);
102 static const SkColor kResultsTableNegativeText = color_utils::AlphaBlend(
103 kNegativeTextColor, kTextfieldDefaultBackground, 0xDD);
104 static const SkColor kResultsTableNegativeHoveredText =
105 color_utils::AlphaBlend(kNegativeTextColor,
106 kResultsTableHoveredBackground, 0xDD);
107 static const SkColor kResultsTableNegativeSelectedText =
108 color_utils::AlphaBlend(kNegativeTextColor,
109 kTextfieldSelectionBackgroundFocused, 0xDD);
111 SkColor color;
112 if (CommonThemeGetSystemColor(color_id, &color))
113 return color;
115 switch (color_id) {
116 // Windows
117 case kColorId_WindowBackground:
118 return kWindowBackgroundColor;
120 // Dialogs
121 case kColorId_DialogBackground:
122 return kDialogBackgroundColor;
124 // FocusableBorder
125 case kColorId_FocusedBorderColor:
126 return kFocusedBorderColor;
127 case kColorId_UnfocusedBorderColor:
128 return kUnfocusedBorderColor;
130 // Button
131 case kColorId_ButtonBackgroundColor:
132 return kButtonBackgroundColor;
133 case kColorId_ButtonEnabledColor:
134 return kButtonEnabledColor;
135 case kColorId_ButtonHighlightColor:
136 return kButtonHighlightColor;
137 case kColorId_ButtonHoverColor:
138 return kButtonHoverColor;
140 // Label
141 case kColorId_LabelEnabledColor:
142 return kLabelEnabledColor;
143 case kColorId_LabelDisabledColor:
144 return GetSystemColor(kColorId_ButtonDisabledColor);
145 case kColorId_LabelBackgroundColor:
146 return kLabelBackgroundColor;
148 // Textfield
149 case kColorId_TextfieldDefaultColor:
150 return kTextfieldDefaultColor;
151 case kColorId_TextfieldDefaultBackground:
152 return kTextfieldDefaultBackground;
153 case kColorId_TextfieldReadOnlyColor:
154 return kTextfieldReadOnlyColor;
155 case kColorId_TextfieldReadOnlyBackground:
156 return kTextfieldReadOnlyBackground;
157 case kColorId_TextfieldSelectionColor:
158 return kTextfieldSelectionColor;
159 case kColorId_TextfieldSelectionBackgroundFocused:
160 return kTextfieldSelectionBackgroundFocused;
162 // Tooltip
163 case kColorId_TooltipBackground:
164 return kTooltipBackground;
165 case kColorId_TooltipText:
166 return kTooltipTextColor;
168 // Tree
169 case kColorId_TreeBackground:
170 return kTreeBackground;
171 case kColorId_TreeText:
172 return kTreeTextColor;
173 case kColorId_TreeSelectedText:
174 case kColorId_TreeSelectedTextUnfocused:
175 return kTreeSelectedTextColor;
176 case kColorId_TreeSelectionBackgroundFocused:
177 case kColorId_TreeSelectionBackgroundUnfocused:
178 return kTreeSelectionBackgroundColor;
179 case kColorId_TreeArrow:
180 return kTreeArrowColor;
182 // Table
183 case kColorId_TableBackground:
184 return kTableBackground;
185 case kColorId_TableText:
186 return kTableTextColor;
187 case kColorId_TableSelectedText:
188 case kColorId_TableSelectedTextUnfocused:
189 return kTableSelectedTextColor;
190 case kColorId_TableSelectionBackgroundFocused:
191 case kColorId_TableSelectionBackgroundUnfocused:
192 return kTableSelectionBackgroundColor;
193 case kColorId_TableGroupingIndicatorColor:
194 return kTableGroupingIndicatorColor;
196 // Results Tables
197 case kColorId_ResultsTableNormalBackground:
198 return kTextfieldDefaultBackground;
199 case kColorId_ResultsTableHoveredBackground:
200 return kResultsTableHoveredBackground;
201 case kColorId_ResultsTableSelectedBackground:
202 return kTextfieldSelectionBackgroundFocused;
203 case kColorId_ResultsTableNormalText:
204 return kResultsTableNormalText;
205 case kColorId_ResultsTableHoveredText:
206 return kResultsTableHoveredText;
207 case kColorId_ResultsTableSelectedText:
208 return kResultsTableSelectedText;
209 case kColorId_ResultsTableNormalDimmedText:
210 return kResultsTableNormalDimmedText;
211 case kColorId_ResultsTableHoveredDimmedText:
212 return kResultsTableHoveredDimmedText;
213 case kColorId_ResultsTableSelectedDimmedText:
214 return kResultsTableSelectedDimmedText;
215 case kColorId_ResultsTableNormalUrl:
216 return kTextfieldSelectionColor;
217 case kColorId_ResultsTableHoveredUrl:
218 case kColorId_ResultsTableSelectedUrl:
219 return kResultsTableSelectedOrHoveredUrl;
220 case kColorId_ResultsTableNormalDivider:
221 return kResultsTableNormalDivider;
222 case kColorId_ResultsTableHoveredDivider:
223 return kResultsTableHoveredDivider;
224 case kColorId_ResultsTableSelectedDivider:
225 return kResultsTabSelectedDivider;
226 case kColorId_ResultsTablePositiveText:
227 return kResultsTablePositiveText;
228 case kColorId_ResultsTablePositiveHoveredText:
229 return kResultsTablePositiveHoveredText;
230 case kColorId_ResultsTablePositiveSelectedText:
231 return kResultsTablePositiveSelectedText;
232 case kColorId_ResultsTableNegativeText:
233 return kResultsTableNegativeText;
234 case kColorId_ResultsTableNegativeHoveredText:
235 return kResultsTableNegativeHoveredText;
236 case kColorId_ResultsTableNegativeSelectedText:
237 return kResultsTableNegativeSelectedText;
239 default:
240 NOTREACHED();
241 break;
244 return kInvalidColorIdColor;
247 } // namespace ui