OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/ui/libgtkui/native_theme_gtk3.h" | 5 #include "chrome/browser/ui/libgtkui/native_theme_gtk3.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include "chrome/browser/ui/libgtkui/chrome_gtk_frame.h" | 9 #include "chrome/browser/ui/libgtkui/chrome_gtk_frame.h" |
10 #include "chrome/browser/ui/libgtkui/chrome_gtk_menu_subclasses.h" | 10 #include "chrome/browser/ui/libgtkui/chrome_gtk_menu_subclasses.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 "GtkMenu#menu GtkSeparator#separator.horizontal"); | 136 "GtkMenu#menu GtkSeparator#separator.horizontal"); |
137 } | 137 } |
138 return GetFgColor("GtkMenu#menu GtkMenuItem#menuitem.separator"); | 138 return GetFgColor("GtkMenu#menu GtkMenuItem#menuitem.separator"); |
139 | 139 |
140 // Label | 140 // Label |
141 case ui::NativeTheme::kColorId_LabelEnabledColor: | 141 case ui::NativeTheme::kColorId_LabelEnabledColor: |
142 return GetFgColor("GtkLabel"); | 142 return GetFgColor("GtkLabel"); |
143 case ui::NativeTheme::kColorId_LabelDisabledColor: | 143 case ui::NativeTheme::kColorId_LabelDisabledColor: |
144 return GetFgColor("GtkLabel:disabled"); | 144 return GetFgColor("GtkLabel:disabled"); |
145 case ui::NativeTheme::kColorId_LabelTextSelectionColor: | 145 case ui::NativeTheme::kColorId_LabelTextSelectionColor: |
146 return GetSelectedTextColor("GtkLabel"); | 146 return GetFgColor(GtkVersionCheck(3, 20) ? "GtkLabel #selection" |
| 147 : "GtkLabel:selected"); |
147 case ui::NativeTheme::kColorId_LabelTextSelectionBackgroundFocused: | 148 case ui::NativeTheme::kColorId_LabelTextSelectionBackgroundFocused: |
148 return GetSelectedBgColor("GtkLabel"); | 149 return GetSelectionBgColor(GtkVersionCheck(3, 20) ? "GtkLabel #selection" |
| 150 : "GtkLabel:selected"); |
149 | 151 |
150 // Link | 152 // Link |
151 case ui::NativeTheme::kColorId_LinkDisabled: | 153 case ui::NativeTheme::kColorId_LinkDisabled: |
152 return SkColorSetA( | 154 return SkColorSetA( |
153 SkColorFromColorId(ui::NativeTheme::kColorId_LinkEnabled), 0xBB); | 155 SkColorFromColorId(ui::NativeTheme::kColorId_LinkEnabled), 0xBB); |
154 case ui::NativeTheme::kColorId_LinkPressed: | 156 case ui::NativeTheme::kColorId_LinkPressed: |
155 if (GtkVersionCheck(3, 12)) | 157 if (GtkVersionCheck(3, 12)) |
156 return GetFgColor("GtkLabel.link:link:hover:active"); | 158 return GetFgColor("GtkLabel.link:link:hover:active"); |
157 // fallthrough | 159 // fallthrough |
158 case ui::NativeTheme::kColorId_LinkEnabled: { | 160 case ui::NativeTheme::kColorId_LinkEnabled: { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 return GetBgColor( | 218 return GetBgColor( |
217 "GtkTreeView#treeview.view " | 219 "GtkTreeView#treeview.view " |
218 "GtkTreeView#treeview.view.cell:selected:focus"); | 220 "GtkTreeView#treeview.view.cell:selected:focus"); |
219 case ui::NativeTheme::kColorId_TextOnProminentButtonColor: | 221 case ui::NativeTheme::kColorId_TextOnProminentButtonColor: |
220 return GetFgColor( | 222 return GetFgColor( |
221 "GtkTreeView#treeview.view " | 223 "GtkTreeView#treeview.view " |
222 "GtkTreeview#treeview.view.cell:selected:focus GtkLabel"); | 224 "GtkTreeview#treeview.view.cell:selected:focus GtkLabel"); |
223 | 225 |
224 // Textfield | 226 // Textfield |
225 case ui::NativeTheme::kColorId_TextfieldDefaultColor: | 227 case ui::NativeTheme::kColorId_TextfieldDefaultColor: |
226 return GetFgColor("GtkTextView#textview.view"); | 228 return GetFgColor(GtkVersionCheck(3, 20) |
| 229 ? "GtkTextView#textview.view #text" |
| 230 : "GtkTextView"); |
227 case ui::NativeTheme::kColorId_TextfieldDefaultBackground: | 231 case ui::NativeTheme::kColorId_TextfieldDefaultBackground: |
228 return GetBgColor("GtkTextView#textview.view"); | 232 return GetBgColor(GtkVersionCheck(3, 20) ? "GtkTextView#textview.view" |
| 233 : "GtkTextView"); |
229 case ui::NativeTheme::kColorId_TextfieldReadOnlyColor: | 234 case ui::NativeTheme::kColorId_TextfieldReadOnlyColor: |
230 return GetFgColor("GtkTextView#textview.view:disabled"); | 235 return GetFgColor(GtkVersionCheck(3, 20) |
| 236 ? "GtkTextView#textview.view:disabled #text" |
| 237 : "GtkTextView:disabled"); |
231 case ui::NativeTheme::kColorId_TextfieldReadOnlyBackground: | 238 case ui::NativeTheme::kColorId_TextfieldReadOnlyBackground: |
232 return GetBgColor("GtkTextView#textview.view:disabled"); | 239 return GetBgColor(GtkVersionCheck(3, 20) |
| 240 ? "GtkTextView#textview.view:disabled" |
| 241 : "GtkTextView:disabled"); |
233 case ui::NativeTheme::kColorId_TextfieldSelectionColor: | 242 case ui::NativeTheme::kColorId_TextfieldSelectionColor: |
234 return GetSelectedTextColor("GtkTextView#textview.view"); | 243 return GetFgColor(GtkVersionCheck(3, 20) |
| 244 ? "GtkTextView#textview.view #text #selection" |
| 245 : "GtkTextView:selected"); |
235 case ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused: | 246 case ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused: |
236 return GetSelectedBgColor("GtkTextView#textview.view"); | 247 return GetSelectionBgColor( |
| 248 GtkVersionCheck(3, 20) ? "GtkTextView#textview.view #text #selection" |
| 249 : "GtkTextView:selected"); |
237 | 250 |
238 // Tooltips | 251 // Tooltips |
239 case ui::NativeTheme::kColorId_TooltipBackground: | 252 case ui::NativeTheme::kColorId_TooltipBackground: |
240 return GetBgColor("GtkTooltip#tooltip"); | 253 return GetBgColor("GtkTooltip#tooltip"); |
241 case ui::NativeTheme::kColorId_TooltipText: | 254 case ui::NativeTheme::kColorId_TooltipText: |
242 return color_utils::GetReadableColor(GetFgColor("GtkTooltip#tooltip"), | 255 return color_utils::GetReadableColor(GetFgColor("GtkTooltip#tooltip"), |
243 GetBgColor("GtkTooltip#tooltip")); | 256 GetBgColor("GtkTooltip#tooltip")); |
244 | 257 |
245 // Trees and Tables (implemented on GTK using the same class) | 258 // Trees and Tables (implemented on GTK using the same class) |
246 case ui::NativeTheme::kColorId_TableBackground: | 259 case ui::NativeTheme::kColorId_TableBackground: |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 | 604 |
592 if (frame_top_area.incognito) { | 605 if (frame_top_area.incognito) { |
593 bitmap = SkBitmapOperations::CreateHSLShiftedBitmap( | 606 bitmap = SkBitmapOperations::CreateHSLShiftedBitmap( |
594 bitmap, kDefaultTintFrameIncognito); | 607 bitmap, kDefaultTintFrameIncognito); |
595 } | 608 } |
596 | 609 |
597 canvas->drawBitmap(bitmap, rect.x(), rect.y()); | 610 canvas->drawBitmap(bitmap, rect.x(), rect.y()); |
598 } | 611 } |
599 | 612 |
600 } // namespace libgtkui | 613 } // namespace libgtkui |
OLD | NEW |