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

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

Issue 2701923002: Gtk3: Fix tab border color and --secondary-ui-md colors (Closed)
Patch Set: Move lambda to function in anonymous namespace Created 3 years, 10 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
« no previous file with comments | « chrome/browser/ui/libgtkui/gtk_ui.h ('k') | chrome/browser/ui/libgtkui/native_theme_gtk3.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/browser/ui/libgtkui/gtk_ui.h" 5 #include "chrome/browser/ui/libgtkui/gtk_ui.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 #include <pango/pango.h> 8 #include <pango/pango.h>
9 #include <X11/Xcursor/Xcursor.h> 9 #include <X11/Xcursor/Xcursor.h>
10 10
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 // Starting with KDE 4.4, windows' titlebars can be dragged with the 372 // Starting with KDE 4.4, windows' titlebars can be dragged with the
373 // middle mouse button to create tab groups. We don't support that in 373 // middle mouse button to create tab groups. We don't support that in
374 // Chrome, but at least avoid lowering windows in response to middle 374 // Chrome, but at least avoid lowering windows in response to middle
375 // clicks to avoid surprising users who expect the KDE behavior. 375 // clicks to avoid surprising users who expect the KDE behavior.
376 return views::LinuxUI::MIDDLE_CLICK_ACTION_NONE; 376 return views::LinuxUI::MIDDLE_CLICK_ACTION_NONE;
377 default: 377 default:
378 return views::LinuxUI::MIDDLE_CLICK_ACTION_LOWER; 378 return views::LinuxUI::MIDDLE_CLICK_ACTION_LOWER;
379 } 379 }
380 } 380 }
381 381
382 #if GTK_MAJOR_VERSION > 2
383 // COLOR_TOOLBAR_TOP_SEPARATOR represents the border between tabs and the
384 // frame, as well as the border between tabs and the toolbar. For this
385 // reason, it is difficult to calculate the One True Color that works well on
386 // all themes and is opaque. However, we can cheat to get a good color that
387 // works well for both borders. The idea is we have two variables: alpha and
388 // lightness. And we have two constraints (on lightness):
389 // 1. the border color, when painted on |header_bg|, should give |header_fg|
390 // 2. the border color, when painted on |toolbar_bg|, should give |toolbar_fg|
391 // This gives the equations:
392 // alpha*lightness + (1 - alpha)*header_bg = header_fg
393 // alpha*lightness + (1 - alpha)*toolbar_bg = toolbar_fg
394 // The algorithm below is just a result of solving those equations for alpha
395 // and lightness. If a problem is encountered, like division by zero, or
396 // |a| or |l| not in [0, 1], then fallback on |header_fg| or |toolbar_fg|.
397 SkColor GetToolbarTopSeparatorColor(SkColor header_fg,
398 SkColor header_bg,
399 SkColor toolbar_fg,
400 SkColor toolbar_bg) {
401 using namespace color_utils;
402
403 SkColor default_color = SkColorGetA(header_fg) ? header_fg : toolbar_fg;
404 if (!SkColorGetA(default_color))
405 return SK_ColorTRANSPARENT;
406
407 auto get_lightness = [](SkColor color) {
408 HSL hsl;
409 SkColorToHSL(color, &hsl);
410 return hsl.l;
411 };
412
413 double f1 = get_lightness(GetResultingPaintColor(header_fg, header_bg));
414 double b1 = get_lightness(header_bg);
415 double f2 = get_lightness(GetResultingPaintColor(toolbar_fg, toolbar_bg));
416 double b2 = get_lightness(toolbar_bg);
417
418 if (b1 == b2)
419 return default_color;
420 double a = (f1 - f2 - b1 + b2) / (b2 - b1);
421 if (a == 0)
422 return default_color;
423 double l = (f1 - (1 - a) * b1) / a;
424 if (a < 0 || a > 1 || l < 0 || l > 1)
425 return default_color;
426 // Take the hue and saturation from |default_color|, but use the
427 // calculated lightness.
428 HSL border;
429 SkColorToHSL(default_color, &border);
430 border.l = l;
431 return HSLToSkColor(border, a * 0xff);
432 }
433 #endif
434
382 } // namespace 435 } // namespace
383 436
384 GtkUi::GtkUi() : middle_click_action_(GetDefaultMiddleClickAction()) { 437 GtkUi::GtkUi() : middle_click_action_(GetDefaultMiddleClickAction()) {
385 GtkInitFromCommandLine(*base::CommandLine::ForCurrentProcess()); 438 GtkInitFromCommandLine(*base::CommandLine::ForCurrentProcess());
386 #if GTK_MAJOR_VERSION == 2 439 #if GTK_MAJOR_VERSION == 2
387 native_theme_ = NativeThemeGtk2::instance(); 440 native_theme_ = NativeThemeGtk2::instance();
388 fake_window_ = chrome_gtk_frame_new(); 441 fake_window_ = chrome_gtk_frame_new();
389 gtk_widget_realize(fake_window_); // Is this necessary? 442 gtk_widget_realize(fake_window_); // Is this necessary?
390 #elif GTK_MAJOR_VERSION == 3 443 #elif GTK_MAJOR_VERSION == 3
391 native_theme_ = NativeThemeGtk3::instance(); 444 native_theme_ = NativeThemeGtk3::instance();
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 814
762 void GtkUi::LoadGtkValues() { 815 void GtkUi::LoadGtkValues() {
763 // TODO(erg): GtkThemeService had a comment here about having to muck with 816 // TODO(erg): GtkThemeService had a comment here about having to muck with
764 // the raw Prefs object to remove prefs::kCurrentThemeImages or else we'd 817 // the raw Prefs object to remove prefs::kCurrentThemeImages or else we'd
765 // regress startup time. Figure out how to do that when we can't access the 818 // regress startup time. Figure out how to do that when we can't access the
766 // prefs system from here. 819 // prefs system from here.
767 820
768 UpdateDeviceScaleFactor(); 821 UpdateDeviceScaleFactor();
769 UpdateCursorTheme(); 822 UpdateCursorTheme();
770 823
771 BuildFrameColors(); 824 #if GTK_MAJOR_VERSION == 2
825 const color_utils::HSL kDefaultFrameShift = {-1, -1, 0.4};
826 SkColor frame_color =
827 native_theme_->GetSystemColor(ui::NativeTheme::kColorId_WindowBackground);
828 frame_color = color_utils::HSLShift(frame_color, kDefaultFrameShift);
829 GetChromeStyleColor("frame-color", &frame_color);
830 colors_[ThemeProperties::COLOR_FRAME] = frame_color;
772 831
773 #if GTK_MAJOR_VERSION == 2 832 GtkStyle* style = gtk_rc_get_style(fake_window_);
833 SkColor temp_color = color_utils::HSLShift(
834 GdkColorToSkColor(style->bg[GTK_STATE_INSENSITIVE]), kDefaultFrameShift);
835 GetChromeStyleColor("inactive-frame-color", &temp_color);
836 colors_[ThemeProperties::COLOR_FRAME_INACTIVE] = temp_color;
837
838 temp_color = color_utils::HSLShift(frame_color, kDefaultTintFrameIncognito);
839 GetChromeStyleColor("incognito-frame-color", &temp_color);
840 colors_[ThemeProperties::COLOR_FRAME_INCOGNITO] = temp_color;
841
842 temp_color =
843 color_utils::HSLShift(frame_color, kDefaultTintFrameIncognitoInactive);
844 GetChromeStyleColor("incognito-inactive-frame-color", &temp_color);
845 colors_[ThemeProperties::COLOR_FRAME_INCOGNITO_INACTIVE] = temp_color;
846
774 SkColor toolbar_color = 847 SkColor toolbar_color =
775 native_theme_->GetSystemColor(ui::NativeTheme::kColorId_DialogBackground); 848 native_theme_->GetSystemColor(ui::NativeTheme::kColorId_DialogBackground);
776 SkColor label_color = native_theme_->GetSystemColor( 849 SkColor label_color = native_theme_->GetSystemColor(
777 ui::NativeTheme::kColorId_LabelEnabledColor); 850 ui::NativeTheme::kColorId_LabelEnabledColor);
778 851
779 colors_[ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON] = 852 colors_[ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON] =
780 color_utils::DeriveDefaultIconColor(label_color); 853 color_utils::DeriveDefaultIconColor(label_color);
781 854
782 colors_[ThemeProperties::COLOR_TAB_TEXT] = label_color; 855 colors_[ThemeProperties::COLOR_TAB_TEXT] = label_color;
783 colors_[ThemeProperties::COLOR_BOOKMARK_TEXT] = label_color; 856 colors_[ThemeProperties::COLOR_BOOKMARK_TEXT] = label_color;
(...skipping 17 matching lines...) Expand all
801 colors_[ThemeProperties::COLOR_NTP_TEXT] = native_theme_->GetSystemColor( 874 colors_[ThemeProperties::COLOR_NTP_TEXT] = native_theme_->GetSystemColor(
802 ui::NativeTheme::kColorId_TextfieldDefaultColor); 875 ui::NativeTheme::kColorId_TextfieldDefaultColor);
803 // The NTP header is the color that surrounds the current active 876 // The NTP header is the color that surrounds the current active
804 // thumbnail on the NTP, and acts as the border of the "Recent 877 // thumbnail on the NTP, and acts as the border of the "Recent
805 // Links" box. It would be awesome if they were separated so we 878 // Links" box. It would be awesome if they were separated so we
806 // could use GetBorderColor() for the border around the "Recent 879 // could use GetBorderColor() for the border around the "Recent
807 // Links" section, but matching the frame color is more important. 880 // Links" section, but matching the frame color is more important.
808 colors_[ThemeProperties::COLOR_NTP_HEADER] = 881 colors_[ThemeProperties::COLOR_NTP_HEADER] =
809 colors_[ThemeProperties::COLOR_FRAME]; 882 colors_[ThemeProperties::COLOR_FRAME];
810 #else 883 #else
884 SkColor frame_color = GetBgColor("#headerbar.header-bar.titlebar");
885 SkColor frame_color_inactive =
886 GetBgColor("#headerbar.header-bar.titlebar:backdrop");
887 colors_[ThemeProperties::COLOR_FRAME] = frame_color;
888 colors_[ThemeProperties::COLOR_FRAME_INACTIVE] = frame_color_inactive;
889 colors_[ThemeProperties::COLOR_FRAME_INCOGNITO] =
890 color_utils::HSLShift(frame_color, kDefaultTintFrameIncognito);
891 colors_[ThemeProperties::COLOR_FRAME_INCOGNITO_INACTIVE] =
892 color_utils::HSLShift(frame_color_inactive, kDefaultTintFrameIncognito);
893
811 SkColor toolbar_color = GetBgColor("GtkToolbar#toolbar"); 894 SkColor toolbar_color = GetBgColor("GtkToolbar#toolbar");
812 SkColor toolbar_text_color = color_utils::GetReadableColor( 895 SkColor toolbar_text_color = color_utils::GetReadableColor(
813 GetFgColor("GtkToolbar#toolbar GtkLabel#label"), 896 GetFgColor("GtkToolbar#toolbar GtkLabel#label"),
814 toolbar_color); 897 toolbar_color);
815 898
816 colors_[ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON] = toolbar_text_color; 899 colors_[ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON] = toolbar_text_color;
817 900
818 // Tabs use the same background color as the toolbar, so use the 901 // Tabs use the same background color as the toolbar, so use the
819 // toolbar text color as the tab text color. 902 // toolbar text color as the tab text color.
820 colors_[ThemeProperties::COLOR_TAB_TEXT] = toolbar_text_color; 903 colors_[ThemeProperties::COLOR_TAB_TEXT] = toolbar_text_color;
821 colors_[ThemeProperties::COLOR_BOOKMARK_TEXT] = toolbar_text_color; 904 colors_[ThemeProperties::COLOR_BOOKMARK_TEXT] = toolbar_text_color;
822 colors_[ThemeProperties::COLOR_BACKGROUND_TAB_TEXT] = 905 colors_[ThemeProperties::COLOR_BACKGROUND_TAB_TEXT] =
823 color_utils::BlendTowardOppositeLuma(toolbar_text_color, 50); 906 color_utils::BlendTowardOppositeLuma(toolbar_text_color, 50);
824 907
825 SkColor location_bar_border = 908 SkColor location_bar_border =
826 GetBorderColor("GtkToolbar#toolbar GtkEntry#entry"); 909 GetBorderColor("GtkToolbar#toolbar GtkEntry#entry");
827 if (SkColorGetA(location_bar_border)) { 910 if (SkColorGetA(location_bar_border))
828 colors_[ThemeProperties::COLOR_LOCATION_BAR_BORDER] = location_bar_border; 911 colors_[ThemeProperties::COLOR_LOCATION_BAR_BORDER] = location_bar_border;
829 }
830 912
831 inactive_selection_bg_color_ = GetSelectedBgColor("GtkEntry#entry:backdrop"); 913 inactive_selection_bg_color_ =
914 GetSelectedBgColor("GtkTextView#textview.view:backdrop");
832 inactive_selection_fg_color_ = 915 inactive_selection_fg_color_ =
833 GetSelectedTextColor("GtkEntry#entry:backdrop"); 916 GetSelectedTextColor("GtkTextView#textview.view:backdrop");
834 917
835 SkColor toolbar_separator_horizontal = 918 SkColor toolbar_button_border =
836 GetSeparatorColor("GtkToolbar#toolbar GtkSeparator#separator.horizontal"); 919 GetBorderColor("GtkToolbar#toolbar GtkButton#button");
837 SkColor toolbar_separator_vertical =
838 GetSeparatorColor("GtkToolbar#toolbar GtkSeparator#separator.vertical");
839 colors_[ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_BACKGROUND] = 920 colors_[ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_BACKGROUND] =
840 toolbar_color; 921 toolbar_color;
841 colors_[ThemeProperties::COLOR_BOOKMARK_BAR_INSTRUCTIONS_TEXT] = 922 colors_[ThemeProperties::COLOR_BOOKMARK_BAR_INSTRUCTIONS_TEXT] =
842 toolbar_text_color; 923 toolbar_text_color;
843 // Separates the toolbar from the bookmark bar or butter bars. 924 // Separates the toolbar from the bookmark bar or butter bars.
844 colors_[ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR] = 925 colors_[ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR] =
845 toolbar_separator_horizontal; 926 toolbar_button_border;
846 // Separates entries in the downloads bar. 927 // Separates entries in the downloads bar.
847 colors_[ThemeProperties::COLOR_TOOLBAR_VERTICAL_SEPARATOR] = 928 colors_[ThemeProperties::COLOR_TOOLBAR_VERTICAL_SEPARATOR] =
848 toolbar_separator_vertical; 929 toolbar_button_border;
849 // Separates the bookmark bar from the web content. 930 // Separates the bookmark bar from the web content.
850 colors_[ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR] = 931 colors_[ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR] =
851 toolbar_separator_horizontal; 932 toolbar_button_border;
852 933
853 // These colors represent the border drawn around tabs and between 934 // These colors represent the border drawn around tabs and between
854 // the tabstrip and toolbar. 935 // the tabstrip and toolbar.
855 SkColor header_button_border = 936 SkColor toolbar_top_separator = GetToolbarTopSeparatorColor(
856 GetBorderColor("#headerbar.header-bar.titlebar GtkButton#button"); 937 GetBorderColor("#headerbar.header-bar.titlebar GtkButton#button"),
857 SkColor header_button_inactive_border = GetBorderColor( 938 frame_color, toolbar_button_border, toolbar_color);
858 "#headerbar.header-bar.titlebar:backdrop GtkButton#button"); 939 SkColor toolbar_top_separator_inactive = GetToolbarTopSeparatorColor(
940 GetBorderColor(
941 "#headerbar.header-bar.titlebar:backdrop GtkButton#button"),
942 frame_color_inactive, toolbar_button_border, toolbar_color);
859 // Unlike with toolbars, we always want a border around tabs, so let 943 // Unlike with toolbars, we always want a border around tabs, so let
860 // ThemeService choose the border color if the theme doesn't provide one. 944 // ThemeService choose the border color if the theme doesn't provide one.
861 if (SkColorGetA(header_button_border) && 945 if (SkColorGetA(toolbar_top_separator) &&
862 SkColorGetA(header_button_inactive_border)) { 946 SkColorGetA(toolbar_top_separator_inactive)) {
863 colors_[ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR] = 947 colors_[ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR] =
864 header_button_border; 948 toolbar_top_separator;
865 colors_[ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR_INACTIVE] = 949 colors_[ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR_INACTIVE] =
866 header_button_inactive_border; 950 toolbar_top_separator_inactive;
867 } 951 }
868 952
869 colors_[ThemeProperties::COLOR_NTP_BACKGROUND] = GetBgColor("GtkEntry#entry"); 953 colors_[ThemeProperties::COLOR_NTP_BACKGROUND] =
870 colors_[ThemeProperties::COLOR_NTP_TEXT] = GetFgColor("GtkEntry#entry"); 954 native_theme_->GetSystemColor(
955 ui::NativeTheme::kColorId_TextfieldDefaultBackground);
956 colors_[ThemeProperties::COLOR_NTP_TEXT] = native_theme_->GetSystemColor(
957 ui::NativeTheme::kColorId_TextfieldDefaultColor);
871 colors_[ThemeProperties::COLOR_NTP_HEADER] = 958 colors_[ThemeProperties::COLOR_NTP_HEADER] =
872 GetBorderColor("GtkButton#button"); 959 GetBorderColor("GtkButton#button");
873 #endif 960 #endif
874 961
875 colors_[ThemeProperties::COLOR_TOOLBAR] = toolbar_color; 962 colors_[ThemeProperties::COLOR_TOOLBAR] = toolbar_color;
876 colors_[ThemeProperties::COLOR_CONTROL_BACKGROUND] = toolbar_color; 963 colors_[ThemeProperties::COLOR_CONTROL_BACKGROUND] = toolbar_color;
877 964
878 colors_[ThemeProperties::COLOR_NTP_LINK] = native_theme_->GetSystemColor( 965 colors_[ThemeProperties::COLOR_NTP_LINK] = native_theme_->GetSystemColor(
879 ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused); 966 ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused);
880 967
881 // Generate the colors that we pass to WebKit. 968 // Generate the colors that we pass to WebKit.
882 SetScrollbarColors(); 969 SetScrollbarColors();
883 focus_ring_color_ = 970 focus_ring_color_ = native_theme_->GetSystemColor(
884 native_theme_->GetSystemColor(ui::NativeTheme::kColorId_LinkEnabled); 971 ui::NativeTheme::kColorId_FocusedBorderColor);
885 972
886 // Some GTK themes only define the text selection colors on the GtkEntry 973 // Some GTK themes only define the text selection colors on the GtkEntry
887 // class, so we need to use that for getting selection colors. 974 // class, so we need to use that for getting selection colors.
888 active_selection_bg_color_ = native_theme_->GetSystemColor( 975 active_selection_bg_color_ = native_theme_->GetSystemColor(
889 ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused); 976 ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused);
890 active_selection_fg_color_ = native_theme_->GetSystemColor( 977 active_selection_fg_color_ = native_theme_->GetSystemColor(
891 ui::NativeTheme::kColorId_TextfieldSelectionColor); 978 ui::NativeTheme::kColorId_TextfieldSelectionColor);
892 979
980 SkColor throbber_spinning = native_theme_->GetSystemColor(
981 ui::NativeTheme::kColorId_ThrobberSpinningColor);
893 colors_[ThemeProperties::COLOR_TAB_THROBBER_SPINNING] = 982 colors_[ThemeProperties::COLOR_TAB_THROBBER_SPINNING] =
894 native_theme_->GetSystemColor( 983 color_utils::GetReadableColor(throbber_spinning, toolbar_color);
895 ui::NativeTheme::kColorId_ThrobberSpinningColor); 984 SkColor throbber_waiting = native_theme_->GetSystemColor(
985 ui::NativeTheme::kColorId_ThrobberWaitingColor);
896 colors_[ThemeProperties::COLOR_TAB_THROBBER_WAITING] = 986 colors_[ThemeProperties::COLOR_TAB_THROBBER_WAITING] =
897 native_theme_->GetSystemColor( 987 color_utils::GetReadableColor(throbber_waiting, toolbar_color);
898 ui::NativeTheme::kColorId_ThrobberWaitingColor);
899 } 988 }
900 989
901 void GtkUi::UpdateCursorTheme() { 990 void GtkUi::UpdateCursorTheme() {
902 GtkSettings* settings = gtk_settings_get_default(); 991 GtkSettings* settings = gtk_settings_get_default();
903 992
904 gchar* theme = nullptr; 993 gchar* theme = nullptr;
905 gint size = 0; 994 gint size = 0;
906 g_object_get(settings, "gtk-cursor-theme-name", &theme, 995 g_object_get(settings, "gtk-cursor-theme-name", &theme,
907 "gtk-cursor-theme-size", &size, nullptr); 996 "gtk-cursor-theme-size", &size, nullptr);
908 997
909 if (theme) 998 if (theme)
910 XcursorSetTheme(gfx::GetXDisplay(), theme); 999 XcursorSetTheme(gfx::GetXDisplay(), theme);
911 if (size) 1000 if (size)
912 XcursorSetDefaultSize(gfx::GetXDisplay(), size); 1001 XcursorSetDefaultSize(gfx::GetXDisplay(), size);
913 1002
914 g_free(theme); 1003 g_free(theme);
915 } 1004 }
916 1005
917 void GtkUi::BuildFrameColors() {
918 #if GTK_MAJOR_VERSION == 2
919 const color_utils::HSL kDefaultFrameShift = {-1, -1, 0.4};
920 SkColor frame_color =
921 native_theme_->GetSystemColor(ui::NativeTheme::kColorId_WindowBackground);
922 frame_color = color_utils::HSLShift(frame_color, kDefaultFrameShift);
923 GetChromeStyleColor("frame-color", &frame_color);
924 colors_[ThemeProperties::COLOR_FRAME] = frame_color;
925
926 GtkStyle* style = gtk_rc_get_style(fake_window_);
927 SkColor temp_color = color_utils::HSLShift(
928 GdkColorToSkColor(style->bg[GTK_STATE_INSENSITIVE]), kDefaultFrameShift);
929 GetChromeStyleColor("inactive-frame-color", &temp_color);
930 colors_[ThemeProperties::COLOR_FRAME_INACTIVE] = temp_color;
931
932 temp_color = color_utils::HSLShift(frame_color, kDefaultTintFrameIncognito);
933 GetChromeStyleColor("incognito-frame-color", &temp_color);
934 colors_[ThemeProperties::COLOR_FRAME_INCOGNITO] = temp_color;
935
936 temp_color =
937 color_utils::HSLShift(frame_color, kDefaultTintFrameIncognitoInactive);
938 GetChromeStyleColor("incognito-inactive-frame-color", &temp_color);
939 colors_[ThemeProperties::COLOR_FRAME_INCOGNITO_INACTIVE] = temp_color;
940 #else
941 SkColor color_frame = GetBgColor("#headerbar.header-bar.titlebar");
942 SkColor color_frame_inactive =
943 GetBgColor("#headerbar.header-bar.titlebar:backdrop");
944 colors_[ThemeProperties::COLOR_FRAME] = color_frame;
945 colors_[ThemeProperties::COLOR_FRAME_INACTIVE] = color_frame_inactive;
946 colors_[ThemeProperties::COLOR_FRAME_INCOGNITO] =
947 color_utils::HSLShift(color_frame, kDefaultTintFrameIncognito);
948 colors_[ThemeProperties::COLOR_FRAME_INCOGNITO_INACTIVE] =
949 color_utils::HSLShift(color_frame_inactive, kDefaultTintFrameIncognito);
950 #endif
951 }
952
953 void GtkUi::UpdateDefaultFont() { 1006 void GtkUi::UpdateDefaultFont() {
954 GtkWidget* fake_label = gtk_label_new(nullptr); 1007 GtkWidget* fake_label = gtk_label_new(nullptr);
955 g_object_ref_sink(fake_label); // Remove the floating reference. 1008 g_object_ref_sink(fake_label); // Remove the floating reference.
956 PangoContext* pc = gtk_widget_get_pango_context(fake_label); 1009 PangoContext* pc = gtk_widget_get_pango_context(fake_label);
957 const PangoFontDescription* desc = pango_context_get_font_description(pc); 1010 const PangoFontDescription* desc = pango_context_get_font_description(pc);
958 1011
959 // Use gfx::FontRenderParams to select a family and determine the rendering 1012 // Use gfx::FontRenderParams to select a family and determine the rendering
960 // settings. 1013 // settings.
961 gfx::FontRenderParamsQuery query; 1014 gfx::FontRenderParamsQuery query;
962 query.families = 1015 query.families =
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 1080
1028 float GtkUi::GetDeviceScaleFactor() const { 1081 float GtkUi::GetDeviceScaleFactor() const {
1029 return device_scale_factor_; 1082 return device_scale_factor_;
1030 } 1083 }
1031 1084
1032 } // namespace libgtkui 1085 } // namespace libgtkui
1033 1086
1034 views::LinuxUI* BuildGtkUi() { 1087 views::LinuxUI* BuildGtkUi() {
1035 return new libgtkui::GtkUi; 1088 return new libgtkui::GtkUi;
1036 } 1089 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/libgtkui/gtk_ui.h ('k') | chrome/browser/ui/libgtkui/native_theme_gtk3.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698