Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: chrome/browser/ui/libgtkui/native_theme_gtk3.cc

Issue 2784413002: Gtk3: Use Gtk window bg color as Chrome toolbar color (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 : "GtkTextView.view:selected"); 227 : "GtkTextView.view:selected");
228 case ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused: 228 case ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused:
229 return GetSelectionBgColor( 229 return GetSelectionBgColor(
230 GtkVersionCheck(3, 20) ? "GtkTextView#textview.view #text #selection" 230 GtkVersionCheck(3, 20) ? "GtkTextView#textview.view #text #selection"
231 : "GtkTextView.view:selected"); 231 : "GtkTextView.view:selected");
232 232
233 // Tooltips 233 // Tooltips
234 case ui::NativeTheme::kColorId_TooltipBackground: 234 case ui::NativeTheme::kColorId_TooltipBackground:
235 return GetBgColor("GtkTooltip#tooltip"); 235 return GetBgColor("GtkTooltip#tooltip");
236 case ui::NativeTheme::kColorId_TooltipText: 236 case ui::NativeTheme::kColorId_TooltipText:
237 return color_utils::GetReadableColor(GetFgColor("GtkTooltip#tooltip"), 237 return GetFgColor("GtkTooltip#tooltip GtkLabel");
238 GetBgColor("GtkTooltip#tooltip"));
239 238
240 // Trees and Tables (implemented on GTK using the same class) 239 // Trees and Tables (implemented on GTK using the same class)
241 case ui::NativeTheme::kColorId_TableBackground: 240 case ui::NativeTheme::kColorId_TableBackground:
242 case ui::NativeTheme::kColorId_TreeBackground: 241 case ui::NativeTheme::kColorId_TreeBackground:
243 return GetBgColor( 242 return GetBgColor(
244 "GtkTreeView#treeview.view GtkTreeView#treeview.view.cell"); 243 "GtkTreeView#treeview.view GtkTreeView#treeview.view.cell");
245 case ui::NativeTheme::kColorId_TableText: 244 case ui::NativeTheme::kColorId_TableText:
246 case ui::NativeTheme::kColorId_TreeText: 245 case ui::NativeTheme::kColorId_TreeText:
247 case ui::NativeTheme::kColorId_TableGroupingIndicatorColor: 246 case ui::NativeTheme::kColorId_TableGroupingIndicatorColor:
248 return GetFgColor( 247 return GetFgColor(
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 ui::NativeTheme::kColorId_TextfieldDefaultBackground)); 339 ui::NativeTheme::kColorId_TextfieldDefaultBackground));
341 case ui::NativeTheme::kColorId_ResultsTableNegativeSelectedText: 340 case ui::NativeTheme::kColorId_ResultsTableNegativeSelectedText:
342 return color_utils::GetReadableColor( 341 return color_utils::GetReadableColor(
343 kNegativeTextColor, 342 kNegativeTextColor,
344 SkColorFromColorId( 343 SkColorFromColorId(
345 ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused)); 344 ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused));
346 345
347 // Throbber 346 // Throbber
348 // TODO(thomasanderson): Render GtkSpinner directly. 347 // TODO(thomasanderson): Render GtkSpinner directly.
349 case ui::NativeTheme::kColorId_ThrobberSpinningColor: 348 case ui::NativeTheme::kColorId_ThrobberSpinningColor:
349 return GetFgColor("GtkSpinner#spinner");
350 case ui::NativeTheme::kColorId_ThrobberWaitingColor: 350 case ui::NativeTheme::kColorId_ThrobberWaitingColor:
351 return GetFgColor("GtkMenu#menu GtkSpinner#spinner");
352 case ui::NativeTheme::kColorId_ThrobberLightColor: 351 case ui::NativeTheme::kColorId_ThrobberLightColor:
353 return GetFgColor("GtkMenu#menu GtkSpinner#spinner:disabled"); 352 return GetFgColor("GtkSpinner#spinner:disabled");
354 353
355 // Alert icons 354 // Alert icons
356 // Fallback to the same colors as Aura. 355 // Fallback to the same colors as Aura.
357 case ui::NativeTheme::kColorId_AlertSeverityLow: 356 case ui::NativeTheme::kColorId_AlertSeverityLow:
358 case ui::NativeTheme::kColorId_AlertSeverityMedium: 357 case ui::NativeTheme::kColorId_AlertSeverityMedium:
359 case ui::NativeTheme::kColorId_AlertSeverityHigh: { 358 case ui::NativeTheme::kColorId_AlertSeverityHigh: {
360 // Alert icons appear on the toolbar, so use the toolbar BG 359 // Alert icons appear on the toolbar, so use the toolbar BG
361 // color to determine if the dark Aura theme should be used. 360 // color (the GTK window bg color) to determine if the dark Aura
361 // theme should be used.
362 ui::NativeTheme* fallback_theme = 362 ui::NativeTheme* fallback_theme =
363 color_utils::IsDark(GetBgColor("GtkToolbar#toolbar")) 363 color_utils::IsDark(GetBgColor(""))
364 ? ui::NativeTheme::GetInstanceForNativeUi() 364 ? ui::NativeTheme::GetInstanceForNativeUi()
365 : ui::NativeThemeDarkAura::instance(); 365 : ui::NativeThemeDarkAura::instance();
366 return fallback_theme->GetSystemColor(color_id); 366 return fallback_theme->GetSystemColor(color_id);
367 } 367 }
368 368
369 case ui::NativeTheme::kColorId_NumColors: 369 case ui::NativeTheme::kColorId_NumColors:
370 NOTREACHED(); 370 NOTREACHED();
371 break; 371 break;
372 } 372 }
373 return kInvalidColorIdColor; 373 return kInvalidColorIdColor;
(...skipping 22 matching lines...) Expand all
396 g_type_class_unref(g_type_class_ref(gtk_label_get_type())); 396 g_type_class_unref(g_type_class_ref(gtk_label_get_type()));
397 g_type_class_unref(g_type_class_ref(gtk_menu_get_type())); 397 g_type_class_unref(g_type_class_ref(gtk_menu_get_type()));
398 g_type_class_unref(g_type_class_ref(gtk_menu_bar_get_type())); 398 g_type_class_unref(g_type_class_ref(gtk_menu_bar_get_type()));
399 g_type_class_unref(g_type_class_ref(gtk_menu_item_get_type())); 399 g_type_class_unref(g_type_class_ref(gtk_menu_item_get_type()));
400 g_type_class_unref(g_type_class_ref(gtk_range_get_type())); 400 g_type_class_unref(g_type_class_ref(gtk_range_get_type()));
401 g_type_class_unref(g_type_class_ref(gtk_scrollbar_get_type())); 401 g_type_class_unref(g_type_class_ref(gtk_scrollbar_get_type()));
402 g_type_class_unref(g_type_class_ref(gtk_scrolled_window_get_type())); 402 g_type_class_unref(g_type_class_ref(gtk_scrolled_window_get_type()));
403 g_type_class_unref(g_type_class_ref(gtk_separator_get_type())); 403 g_type_class_unref(g_type_class_ref(gtk_separator_get_type()));
404 g_type_class_unref(g_type_class_ref(gtk_spinner_get_type())); 404 g_type_class_unref(g_type_class_ref(gtk_spinner_get_type()));
405 g_type_class_unref(g_type_class_ref(gtk_text_view_get_type())); 405 g_type_class_unref(g_type_class_ref(gtk_text_view_get_type()));
406 g_type_class_unref(g_type_class_ref(gtk_toolbar_get_type()));
407 g_type_class_unref(g_type_class_ref(gtk_tooltip_get_type())); 406 g_type_class_unref(g_type_class_ref(gtk_tooltip_get_type()));
408 g_type_class_unref(g_type_class_ref(gtk_tree_view_get_type())); 407 g_type_class_unref(g_type_class_ref(gtk_tree_view_get_type()));
409 g_type_class_unref(g_type_class_ref(gtk_window_get_type())); 408 g_type_class_unref(g_type_class_ref(gtk_window_get_type()));
410 409
411 g_signal_connect_after(gtk_settings_get_default(), "notify::gtk-theme-name", 410 g_signal_connect_after(gtk_settings_get_default(), "notify::gtk-theme-name",
412 G_CALLBACK(OnThemeChanged), this); 411 G_CALLBACK(OnThemeChanged), this);
413 } 412 }
414 413
415 // This doesn't actually get called 414 // This doesn't actually get called
416 NativeThemeGtk3::~NativeThemeGtk3() {} 415 NativeThemeGtk3::~NativeThemeGtk3() {}
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 592
594 if (frame_top_area.incognito) { 593 if (frame_top_area.incognito) {
595 bitmap = SkBitmapOperations::CreateHSLShiftedBitmap( 594 bitmap = SkBitmapOperations::CreateHSLShiftedBitmap(
596 bitmap, kDefaultTintFrameIncognito); 595 bitmap, kDefaultTintFrameIncognito);
597 } 596 }
598 597
599 canvas->drawBitmap(bitmap, rect.x(), rect.y()); 598 canvas->drawBitmap(bitmap, rect.x(), rect.y());
600 } 599 }
601 600
602 } // namespace libgtkui 601 } // namespace libgtkui
OLDNEW
« chrome/browser/ui/libgtkui/gtk_ui.cc ('K') | « chrome/browser/ui/libgtkui/gtk_ui.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698