Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 761 | 761 |
| 762 void GtkUi::LoadGtkValues() { | 762 void GtkUi::LoadGtkValues() { |
| 763 // TODO(erg): GtkThemeService had a comment here about having to muck with | 763 // 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 | 764 // 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 | 765 // regress startup time. Figure out how to do that when we can't access the |
| 766 // prefs system from here. | 766 // prefs system from here. |
| 767 | 767 |
| 768 UpdateDeviceScaleFactor(); | 768 UpdateDeviceScaleFactor(); |
| 769 UpdateCursorTheme(); | 769 UpdateCursorTheme(); |
| 770 | 770 |
| 771 BuildFrameColors(); | 771 #if GTK_MAJOR_VERSION == 2 |
| 772 const color_utils::HSL kDefaultFrameShift = {-1, -1, 0.4}; | |
| 773 SkColor frame_color = | |
| 774 native_theme_->GetSystemColor(ui::NativeTheme::kColorId_WindowBackground); | |
| 775 frame_color = color_utils::HSLShift(frame_color, kDefaultFrameShift); | |
| 776 GetChromeStyleColor("frame-color", &frame_color); | |
| 777 colors_[ThemeProperties::COLOR_FRAME] = frame_color; | |
| 772 | 778 |
| 773 #if GTK_MAJOR_VERSION == 2 | 779 GtkStyle* style = gtk_rc_get_style(fake_window_); |
| 780 SkColor temp_color = color_utils::HSLShift( | |
| 781 GdkColorToSkColor(style->bg[GTK_STATE_INSENSITIVE]), kDefaultFrameShift); | |
| 782 GetChromeStyleColor("inactive-frame-color", &temp_color); | |
| 783 colors_[ThemeProperties::COLOR_FRAME_INACTIVE] = temp_color; | |
| 784 | |
| 785 temp_color = color_utils::HSLShift(frame_color, kDefaultTintFrameIncognito); | |
| 786 GetChromeStyleColor("incognito-frame-color", &temp_color); | |
| 787 colors_[ThemeProperties::COLOR_FRAME_INCOGNITO] = temp_color; | |
| 788 | |
| 789 temp_color = | |
| 790 color_utils::HSLShift(frame_color, kDefaultTintFrameIncognitoInactive); | |
| 791 GetChromeStyleColor("incognito-inactive-frame-color", &temp_color); | |
| 792 colors_[ThemeProperties::COLOR_FRAME_INCOGNITO_INACTIVE] = temp_color; | |
| 793 | |
| 774 SkColor toolbar_color = | 794 SkColor toolbar_color = |
| 775 native_theme_->GetSystemColor(ui::NativeTheme::kColorId_DialogBackground); | 795 native_theme_->GetSystemColor(ui::NativeTheme::kColorId_DialogBackground); |
| 776 SkColor label_color = native_theme_->GetSystemColor( | 796 SkColor label_color = native_theme_->GetSystemColor( |
| 777 ui::NativeTheme::kColorId_LabelEnabledColor); | 797 ui::NativeTheme::kColorId_LabelEnabledColor); |
| 778 | 798 |
| 779 colors_[ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON] = | 799 colors_[ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON] = |
| 780 color_utils::DeriveDefaultIconColor(label_color); | 800 color_utils::DeriveDefaultIconColor(label_color); |
| 781 | 801 |
| 782 colors_[ThemeProperties::COLOR_TAB_TEXT] = label_color; | 802 colors_[ThemeProperties::COLOR_TAB_TEXT] = label_color; |
| 783 colors_[ThemeProperties::COLOR_BOOKMARK_TEXT] = label_color; | 803 colors_[ThemeProperties::COLOR_BOOKMARK_TEXT] = label_color; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 801 colors_[ThemeProperties::COLOR_NTP_TEXT] = native_theme_->GetSystemColor( | 821 colors_[ThemeProperties::COLOR_NTP_TEXT] = native_theme_->GetSystemColor( |
| 802 ui::NativeTheme::kColorId_TextfieldDefaultColor); | 822 ui::NativeTheme::kColorId_TextfieldDefaultColor); |
| 803 // The NTP header is the color that surrounds the current active | 823 // The NTP header is the color that surrounds the current active |
| 804 // thumbnail on the NTP, and acts as the border of the "Recent | 824 // 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 | 825 // Links" box. It would be awesome if they were separated so we |
| 806 // could use GetBorderColor() for the border around the "Recent | 826 // could use GetBorderColor() for the border around the "Recent |
| 807 // Links" section, but matching the frame color is more important. | 827 // Links" section, but matching the frame color is more important. |
| 808 colors_[ThemeProperties::COLOR_NTP_HEADER] = | 828 colors_[ThemeProperties::COLOR_NTP_HEADER] = |
| 809 colors_[ThemeProperties::COLOR_FRAME]; | 829 colors_[ThemeProperties::COLOR_FRAME]; |
| 810 #else | 830 #else |
| 831 SkColor frame_color = GetBgColor("#headerbar.header-bar.titlebar"); | |
| 832 SkColor frame_color_inactive = | |
| 833 GetBgColor("#headerbar.header-bar.titlebar:backdrop"); | |
| 834 colors_[ThemeProperties::COLOR_FRAME] = frame_color; | |
| 835 colors_[ThemeProperties::COLOR_FRAME_INACTIVE] = frame_color_inactive; | |
| 836 colors_[ThemeProperties::COLOR_FRAME_INCOGNITO] = | |
| 837 color_utils::HSLShift(frame_color, kDefaultTintFrameIncognito); | |
| 838 colors_[ThemeProperties::COLOR_FRAME_INCOGNITO_INACTIVE] = | |
| 839 color_utils::HSLShift(frame_color_inactive, kDefaultTintFrameIncognito); | |
| 840 | |
| 811 SkColor toolbar_color = GetBgColor("GtkToolbar#toolbar"); | 841 SkColor toolbar_color = GetBgColor("GtkToolbar#toolbar"); |
| 812 SkColor toolbar_text_color = color_utils::GetReadableColor( | 842 SkColor toolbar_text_color = color_utils::GetReadableColor( |
| 813 GetFgColor("GtkToolbar#toolbar GtkLabel#label"), | 843 GetFgColor("GtkToolbar#toolbar GtkLabel#label"), |
| 814 toolbar_color); | 844 toolbar_color); |
| 815 | 845 |
| 816 colors_[ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON] = toolbar_text_color; | 846 colors_[ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON] = toolbar_text_color; |
| 817 | 847 |
| 818 // Tabs use the same background color as the toolbar, so use the | 848 // Tabs use the same background color as the toolbar, so use the |
| 819 // toolbar text color as the tab text color. | 849 // toolbar text color as the tab text color. |
| 820 colors_[ThemeProperties::COLOR_TAB_TEXT] = toolbar_text_color; | 850 colors_[ThemeProperties::COLOR_TAB_TEXT] = toolbar_text_color; |
| 821 colors_[ThemeProperties::COLOR_BOOKMARK_TEXT] = toolbar_text_color; | 851 colors_[ThemeProperties::COLOR_BOOKMARK_TEXT] = toolbar_text_color; |
| 822 colors_[ThemeProperties::COLOR_BACKGROUND_TAB_TEXT] = | 852 colors_[ThemeProperties::COLOR_BACKGROUND_TAB_TEXT] = |
| 823 color_utils::BlendTowardOppositeLuma(toolbar_text_color, 50); | 853 color_utils::BlendTowardOppositeLuma(toolbar_text_color, 50); |
| 824 | 854 |
| 825 SkColor location_bar_border = | 855 SkColor location_bar_border = |
| 826 GetBorderColor("GtkToolbar#toolbar GtkEntry#entry"); | 856 GetBorderColor("GtkToolbar#toolbar GtkEntry#entry"); |
| 827 if (SkColorGetA(location_bar_border)) { | 857 if (SkColorGetA(location_bar_border)) |
| 828 colors_[ThemeProperties::COLOR_LOCATION_BAR_BORDER] = location_bar_border; | 858 colors_[ThemeProperties::COLOR_LOCATION_BAR_BORDER] = location_bar_border; |
| 829 } | |
| 830 | 859 |
| 831 inactive_selection_bg_color_ = GetSelectedBgColor("GtkEntry#entry:backdrop"); | 860 inactive_selection_bg_color_ = |
| 861 GetSelectedBgColor("GtkTextView#textview.view:backdrop"); | |
| 832 inactive_selection_fg_color_ = | 862 inactive_selection_fg_color_ = |
| 833 GetSelectedTextColor("GtkEntry#entry:backdrop"); | 863 GetSelectedTextColor("GtkTextView#textview.view:backdrop"); |
| 834 | 864 |
| 835 SkColor toolbar_separator_horizontal = | 865 SkColor toolbar_button_border = |
| 836 GetSeparatorColor("GtkToolbar#toolbar GtkSeparator#separator.horizontal"); | 866 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] = | 867 colors_[ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_BACKGROUND] = |
| 840 toolbar_color; | 868 toolbar_color; |
| 841 colors_[ThemeProperties::COLOR_BOOKMARK_BAR_INSTRUCTIONS_TEXT] = | 869 colors_[ThemeProperties::COLOR_BOOKMARK_BAR_INSTRUCTIONS_TEXT] = |
| 842 toolbar_text_color; | 870 toolbar_text_color; |
| 843 // Separates the toolbar from the bookmark bar or butter bars. | 871 // Separates the toolbar from the bookmark bar or butter bars. |
| 844 colors_[ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR] = | 872 colors_[ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR] = |
| 845 toolbar_separator_horizontal; | 873 toolbar_button_border; |
| 846 // Separates entries in the downloads bar. | 874 // Separates entries in the downloads bar. |
| 847 colors_[ThemeProperties::COLOR_TOOLBAR_VERTICAL_SEPARATOR] = | 875 colors_[ThemeProperties::COLOR_TOOLBAR_VERTICAL_SEPARATOR] = |
| 848 toolbar_separator_vertical; | 876 toolbar_button_border; |
| 849 // Separates the bookmark bar from the web content. | 877 // Separates the bookmark bar from the web content. |
| 850 colors_[ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR] = | 878 colors_[ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR] = |
| 851 toolbar_separator_horizontal; | 879 toolbar_button_border; |
| 880 | |
| 881 // COLOR_TOOLBAR_TOP_SEPARATOR represents the border between tabs and the | |
| 882 // frame, as well as the border between tabs and the toolbar. For this | |
| 883 // reason, it is difficult to calculate the One True Color that works well on | |
| 884 // all themes and is opaque. However, we can cheat to get a good color that | |
| 885 // works well for both borders. The idea is we have two variables: alpha and | |
| 886 // lightness. And we have two constraints (on lightness): | |
| 887 // 1. the border color, when painted on |header_bg|, should give |header_fg| | |
| 888 // 2. the border color, when painted on |toolbar_bg|, should give |toolbar_fg| | |
| 889 // This gives the equations: | |
| 890 // alpha*lightness + (1 - alpha)*header_bg = header_fg | |
| 891 // alpha*lightness + (1 - alpha)*toolbar_bg = toolbar_fg | |
| 892 // The algorithm below is just a result of solving those equations for alpha | |
| 893 // and lightness. If a problem is encountered, like division by zero, or | |
| 894 // |a| or |l| not in [0, 1], then fallback on |header_fg| or |toolbar_fg|. | |
| 895 auto get_toolbar_top_separator = [](SkColor header_fg, SkColor header_bg, | |
|
Elliot Glaysher
2017/02/21 20:24:00
prefer a named function in an anonymous namespace
Tom (Use chromium acct)
2017/02/21 20:29:04
Done.
| |
| 896 SkColor toolbar_fg, | |
| 897 SkColor toolbar_bg) -> SkColor { | |
| 898 using namespace color_utils; | |
| 899 | |
| 900 SkColor default_color = SkColorGetA(header_fg) ? header_fg : toolbar_fg; | |
| 901 if (!SkColorGetA(default_color)) | |
| 902 return SK_ColorTRANSPARENT; | |
| 903 | |
| 904 auto get_lightness = [](SkColor color) { | |
| 905 HSL hsl; | |
| 906 SkColorToHSL(color, &hsl); | |
| 907 return hsl.l; | |
| 908 }; | |
| 909 | |
| 910 double f1 = get_lightness(GetResultingPaintColor(header_fg, header_bg)); | |
| 911 double b1 = get_lightness(header_bg); | |
| 912 double f2 = get_lightness(GetResultingPaintColor(toolbar_fg, toolbar_bg)); | |
| 913 double b2 = get_lightness(toolbar_bg); | |
| 914 | |
| 915 if (b1 == b2) | |
| 916 return default_color; | |
| 917 double a = (f1 - f2 - b1 + b2) / (b2 - b1); | |
| 918 if (a == 0) | |
| 919 return default_color; | |
| 920 double l = (f1 - (1 - a) * b1) / a; | |
| 921 if (a < 0 || a > 1 || l < 0 || l > 1) | |
| 922 return default_color; | |
| 923 // Take the hue and saturation from |default_color|, but use the | |
| 924 // calculated lightness. | |
| 925 HSL border; | |
| 926 SkColorToHSL(default_color, &border); | |
| 927 border.l = l; | |
| 928 return HSLToSkColor(border, a * 0xff); | |
| 929 }; | |
| 852 | 930 |
| 853 // These colors represent the border drawn around tabs and between | 931 // These colors represent the border drawn around tabs and between |
| 854 // the tabstrip and toolbar. | 932 // the tabstrip and toolbar. |
| 855 SkColor header_button_border = | 933 SkColor toolbar_top_separator = get_toolbar_top_separator( |
| 856 GetBorderColor("#headerbar.header-bar.titlebar GtkButton#button"); | 934 GetBorderColor("#headerbar.header-bar.titlebar GtkButton#button"), |
| 857 SkColor header_button_inactive_border = GetBorderColor( | 935 frame_color, toolbar_button_border, toolbar_color); |
| 858 "#headerbar.header-bar.titlebar:backdrop GtkButton#button"); | 936 SkColor toolbar_top_separator_inactive = get_toolbar_top_separator( |
| 937 GetBorderColor( | |
| 938 "#headerbar.header-bar.titlebar:backdrop GtkButton#button"), | |
| 939 frame_color_inactive, toolbar_button_border, toolbar_color); | |
| 859 // Unlike with toolbars, we always want a border around tabs, so let | 940 // 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. | 941 // ThemeService choose the border color if the theme doesn't provide one. |
| 861 if (SkColorGetA(header_button_border) && | 942 if (SkColorGetA(toolbar_top_separator) && |
| 862 SkColorGetA(header_button_inactive_border)) { | 943 SkColorGetA(toolbar_top_separator_inactive)) { |
| 863 colors_[ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR] = | 944 colors_[ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR] = |
| 864 header_button_border; | 945 toolbar_top_separator; |
| 865 colors_[ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR_INACTIVE] = | 946 colors_[ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR_INACTIVE] = |
| 866 header_button_inactive_border; | 947 toolbar_top_separator_inactive; |
| 867 } | 948 } |
| 868 | 949 |
| 869 colors_[ThemeProperties::COLOR_NTP_BACKGROUND] = GetBgColor("GtkEntry#entry"); | 950 colors_[ThemeProperties::COLOR_NTP_BACKGROUND] = |
| 870 colors_[ThemeProperties::COLOR_NTP_TEXT] = GetFgColor("GtkEntry#entry"); | 951 native_theme_->GetSystemColor( |
| 952 ui::NativeTheme::kColorId_TextfieldDefaultBackground); | |
| 953 colors_[ThemeProperties::COLOR_NTP_TEXT] = native_theme_->GetSystemColor( | |
| 954 ui::NativeTheme::kColorId_TextfieldDefaultColor); | |
| 871 colors_[ThemeProperties::COLOR_NTP_HEADER] = | 955 colors_[ThemeProperties::COLOR_NTP_HEADER] = |
| 872 GetBorderColor("GtkButton#button"); | 956 GetBorderColor("GtkButton#button"); |
| 873 #endif | 957 #endif |
| 874 | 958 |
| 875 colors_[ThemeProperties::COLOR_TOOLBAR] = toolbar_color; | 959 colors_[ThemeProperties::COLOR_TOOLBAR] = toolbar_color; |
| 876 colors_[ThemeProperties::COLOR_CONTROL_BACKGROUND] = toolbar_color; | 960 colors_[ThemeProperties::COLOR_CONTROL_BACKGROUND] = toolbar_color; |
| 877 | 961 |
| 878 colors_[ThemeProperties::COLOR_NTP_LINK] = native_theme_->GetSystemColor( | 962 colors_[ThemeProperties::COLOR_NTP_LINK] = native_theme_->GetSystemColor( |
| 879 ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused); | 963 ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused); |
| 880 | 964 |
| 881 // Generate the colors that we pass to WebKit. | 965 // Generate the colors that we pass to WebKit. |
| 882 SetScrollbarColors(); | 966 SetScrollbarColors(); |
| 883 focus_ring_color_ = | 967 focus_ring_color_ = native_theme_->GetSystemColor( |
| 884 native_theme_->GetSystemColor(ui::NativeTheme::kColorId_LinkEnabled); | 968 ui::NativeTheme::kColorId_FocusedBorderColor); |
| 885 | 969 |
| 886 // Some GTK themes only define the text selection colors on the GtkEntry | 970 // Some GTK themes only define the text selection colors on the GtkEntry |
| 887 // class, so we need to use that for getting selection colors. | 971 // class, so we need to use that for getting selection colors. |
| 888 active_selection_bg_color_ = native_theme_->GetSystemColor( | 972 active_selection_bg_color_ = native_theme_->GetSystemColor( |
| 889 ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused); | 973 ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused); |
| 890 active_selection_fg_color_ = native_theme_->GetSystemColor( | 974 active_selection_fg_color_ = native_theme_->GetSystemColor( |
| 891 ui::NativeTheme::kColorId_TextfieldSelectionColor); | 975 ui::NativeTheme::kColorId_TextfieldSelectionColor); |
| 892 | 976 |
| 977 SkColor throbber_spinning = native_theme_->GetSystemColor( | |
| 978 ui::NativeTheme::kColorId_ThrobberSpinningColor); | |
| 893 colors_[ThemeProperties::COLOR_TAB_THROBBER_SPINNING] = | 979 colors_[ThemeProperties::COLOR_TAB_THROBBER_SPINNING] = |
| 894 native_theme_->GetSystemColor( | 980 color_utils::GetReadableColor(throbber_spinning, toolbar_color); |
| 895 ui::NativeTheme::kColorId_ThrobberSpinningColor); | 981 SkColor throbber_waiting = native_theme_->GetSystemColor( |
| 982 ui::NativeTheme::kColorId_ThrobberWaitingColor); | |
| 896 colors_[ThemeProperties::COLOR_TAB_THROBBER_WAITING] = | 983 colors_[ThemeProperties::COLOR_TAB_THROBBER_WAITING] = |
| 897 native_theme_->GetSystemColor( | 984 color_utils::GetReadableColor(throbber_waiting, toolbar_color); |
| 898 ui::NativeTheme::kColorId_ThrobberWaitingColor); | |
| 899 } | 985 } |
| 900 | 986 |
| 901 void GtkUi::UpdateCursorTheme() { | 987 void GtkUi::UpdateCursorTheme() { |
| 902 GtkSettings* settings = gtk_settings_get_default(); | 988 GtkSettings* settings = gtk_settings_get_default(); |
| 903 | 989 |
| 904 gchar* theme = nullptr; | 990 gchar* theme = nullptr; |
| 905 gint size = 0; | 991 gint size = 0; |
| 906 g_object_get(settings, "gtk-cursor-theme-name", &theme, | 992 g_object_get(settings, "gtk-cursor-theme-name", &theme, |
| 907 "gtk-cursor-theme-size", &size, nullptr); | 993 "gtk-cursor-theme-size", &size, nullptr); |
| 908 | 994 |
| 909 if (theme) | 995 if (theme) |
| 910 XcursorSetTheme(gfx::GetXDisplay(), theme); | 996 XcursorSetTheme(gfx::GetXDisplay(), theme); |
| 911 if (size) | 997 if (size) |
| 912 XcursorSetDefaultSize(gfx::GetXDisplay(), size); | 998 XcursorSetDefaultSize(gfx::GetXDisplay(), size); |
| 913 | 999 |
| 914 g_free(theme); | 1000 g_free(theme); |
| 915 } | 1001 } |
| 916 | 1002 |
| 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() { | 1003 void GtkUi::UpdateDefaultFont() { |
| 954 GtkWidget* fake_label = gtk_label_new(nullptr); | 1004 GtkWidget* fake_label = gtk_label_new(nullptr); |
| 955 g_object_ref_sink(fake_label); // Remove the floating reference. | 1005 g_object_ref_sink(fake_label); // Remove the floating reference. |
| 956 PangoContext* pc = gtk_widget_get_pango_context(fake_label); | 1006 PangoContext* pc = gtk_widget_get_pango_context(fake_label); |
| 957 const PangoFontDescription* desc = pango_context_get_font_description(pc); | 1007 const PangoFontDescription* desc = pango_context_get_font_description(pc); |
| 958 | 1008 |
| 959 // Use gfx::FontRenderParams to select a family and determine the rendering | 1009 // Use gfx::FontRenderParams to select a family and determine the rendering |
| 960 // settings. | 1010 // settings. |
| 961 gfx::FontRenderParamsQuery query; | 1011 gfx::FontRenderParamsQuery query; |
| 962 query.families = | 1012 query.families = |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1027 | 1077 |
| 1028 float GtkUi::GetDeviceScaleFactor() const { | 1078 float GtkUi::GetDeviceScaleFactor() const { |
| 1029 return device_scale_factor_; | 1079 return device_scale_factor_; |
| 1030 } | 1080 } |
| 1031 | 1081 |
| 1032 } // namespace libgtkui | 1082 } // namespace libgtkui |
| 1033 | 1083 |
| 1034 views::LinuxUI* BuildGtkUi() { | 1084 views::LinuxUI* BuildGtkUi() { |
| 1035 return new libgtkui::GtkUi; | 1085 return new libgtkui::GtkUi; |
| 1036 } | 1086 } |
| OLD | NEW |