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 <X11/Xcursor/Xcursor.h> | 7 #include <X11/Xcursor/Xcursor.h> |
| 8 #include <dlfcn.h> | 8 #include <dlfcn.h> |
| 9 #include <math.h> | 9 #include <math.h> |
| 10 #include <pango/pango.h> | 10 #include <pango/pango.h> |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 350 } | 350 } |
| 351 | 351 |
| 352 #if GTK_MAJOR_VERSION > 2 | 352 #if GTK_MAJOR_VERSION > 2 |
| 353 // COLOR_TOOLBAR_TOP_SEPARATOR represents the border between tabs and the | 353 // COLOR_TOOLBAR_TOP_SEPARATOR represents the border between tabs and the |
| 354 // frame, as well as the border between tabs and the toolbar. For this | 354 // frame, as well as the border between tabs and the toolbar. For this |
| 355 // reason, it is difficult to calculate the One True Color that works well on | 355 // reason, it is difficult to calculate the One True Color that works well on |
| 356 // all themes and is opaque. However, we can cheat to get a good color that | 356 // all themes and is opaque. However, we can cheat to get a good color that |
| 357 // works well for both borders. The idea is we have two variables: alpha and | 357 // works well for both borders. The idea is we have two variables: alpha and |
| 358 // lightness. And we have two constraints (on lightness): | 358 // lightness. And we have two constraints (on lightness): |
| 359 // 1. the border color, when painted on |header_bg|, should give |header_fg| | 359 // 1. the border color, when painted on |header_bg|, should give |header_fg| |
| 360 // 2. the border color, when painted on |toolbar_bg|, should give |toolbar_fg| | 360 // 2. the border color, when painted on |tab_bg|, should give |tab_fg| |
| 361 // This gives the equations: | 361 // This gives the equations: |
| 362 // alpha*lightness + (1 - alpha)*header_bg = header_fg | 362 // alpha*lightness + (1 - alpha)*header_bg = header_fg |
| 363 // alpha*lightness + (1 - alpha)*toolbar_bg = toolbar_fg | 363 // alpha*lightness + (1 - alpha)*tab_bg = tab_fg |
| 364 // The algorithm below is just a result of solving those equations for alpha | 364 // The algorithm below is just a result of solving those equations for alpha |
| 365 // and lightness. If a problem is encountered, like division by zero, or | 365 // and lightness. If a problem is encountered, like division by zero, or |
| 366 // |a| or |l| not in [0, 1], then fallback on |header_fg| or |toolbar_fg|. | 366 // |a| or |l| not in [0, 1], then fallback on |header_fg| or |tab_fg|. |
| 367 SkColor GetToolbarTopSeparatorColor(SkColor header_fg, | 367 SkColor GetToolbarTopSeparatorColor(SkColor header_fg, |
| 368 SkColor header_bg, | 368 SkColor header_bg, |
| 369 SkColor toolbar_fg, | 369 SkColor tab_fg, |
| 370 SkColor toolbar_bg) { | 370 SkColor tab_bg) { |
| 371 using namespace color_utils; | 371 using namespace color_utils; |
| 372 | 372 |
| 373 SkColor default_color = SkColorGetA(header_fg) ? header_fg : toolbar_fg; | 373 SkColor default_color = SkColorGetA(header_fg) ? header_fg : tab_fg; |
| 374 if (!SkColorGetA(default_color)) | 374 if (!SkColorGetA(default_color)) |
| 375 return SK_ColorTRANSPARENT; | 375 return SK_ColorTRANSPARENT; |
| 376 | 376 |
| 377 auto get_lightness = [](SkColor color) { | 377 auto get_lightness = [](SkColor color) { |
| 378 HSL hsl; | 378 HSL hsl; |
| 379 SkColorToHSL(color, &hsl); | 379 SkColorToHSL(color, &hsl); |
| 380 return hsl.l; | 380 return hsl.l; |
| 381 }; | 381 }; |
| 382 | 382 |
| 383 double f1 = get_lightness(GetResultingPaintColor(header_fg, header_bg)); | 383 double f1 = get_lightness(GetResultingPaintColor(header_fg, header_bg)); |
| 384 double b1 = get_lightness(header_bg); | 384 double b1 = get_lightness(header_bg); |
| 385 double f2 = get_lightness(GetResultingPaintColor(toolbar_fg, toolbar_bg)); | 385 double f2 = get_lightness(GetResultingPaintColor(tab_fg, tab_bg)); |
| 386 double b2 = get_lightness(toolbar_bg); | 386 double b2 = get_lightness(tab_bg); |
| 387 | 387 |
| 388 if (b1 == b2) | 388 if (b1 == b2) |
| 389 return default_color; | 389 return default_color; |
| 390 double a = (f1 - f2 - b1 + b2) / (b2 - b1); | 390 double a = (f1 - f2 - b1 + b2) / (b2 - b1); |
| 391 if (a == 0) | 391 if (a == 0) |
| 392 return default_color; | 392 return default_color; |
| 393 double l = (f1 - (1 - a) * b1) / a; | 393 double l = (f1 - (1 - a) * b1) / a; |
| 394 if (a < 0 || a > 1 || l < 0 || l > 1) | 394 if (a < 0 || a > 1 || l < 0 || l > 1) |
| 395 return default_color; | 395 return default_color; |
| 396 // Take the hue and saturation from |default_color|, but use the | 396 // Take the hue and saturation from |default_color|, but use the |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 820 | 820 |
| 821 temp_color = color_utils::HSLShift(frame_color, kDefaultTintFrameIncognito); | 821 temp_color = color_utils::HSLShift(frame_color, kDefaultTintFrameIncognito); |
| 822 GetChromeStyleColor("incognito-frame-color", &temp_color); | 822 GetChromeStyleColor("incognito-frame-color", &temp_color); |
| 823 colors_[ThemeProperties::COLOR_FRAME_INCOGNITO] = temp_color; | 823 colors_[ThemeProperties::COLOR_FRAME_INCOGNITO] = temp_color; |
| 824 | 824 |
| 825 temp_color = | 825 temp_color = |
| 826 color_utils::HSLShift(frame_color, kDefaultTintFrameIncognitoInactive); | 826 color_utils::HSLShift(frame_color, kDefaultTintFrameIncognitoInactive); |
| 827 GetChromeStyleColor("incognito-inactive-frame-color", &temp_color); | 827 GetChromeStyleColor("incognito-inactive-frame-color", &temp_color); |
| 828 colors_[ThemeProperties::COLOR_FRAME_INCOGNITO_INACTIVE] = temp_color; | 828 colors_[ThemeProperties::COLOR_FRAME_INCOGNITO_INACTIVE] = temp_color; |
| 829 | 829 |
| 830 SkColor toolbar_color = | 830 SkColor tab_color = |
| 831 native_theme_->GetSystemColor(ui::NativeTheme::kColorId_DialogBackground); | 831 native_theme_->GetSystemColor(ui::NativeTheme::kColorId_DialogBackground); |
| 832 SkColor label_color = native_theme_->GetSystemColor( | 832 SkColor label_color = native_theme_->GetSystemColor( |
| 833 ui::NativeTheme::kColorId_LabelEnabledColor); | 833 ui::NativeTheme::kColorId_LabelEnabledColor); |
| 834 | 834 |
| 835 colors_[ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON] = | 835 colors_[ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON] = |
| 836 color_utils::DeriveDefaultIconColor(label_color); | 836 color_utils::DeriveDefaultIconColor(label_color); |
| 837 | 837 |
| 838 colors_[ThemeProperties::COLOR_TAB_TEXT] = label_color; | 838 colors_[ThemeProperties::COLOR_TAB_TEXT] = label_color; |
| 839 colors_[ThemeProperties::COLOR_BOOKMARK_TEXT] = label_color; | 839 colors_[ThemeProperties::COLOR_BOOKMARK_TEXT] = label_color; |
| 840 colors_[ThemeProperties::COLOR_BACKGROUND_TAB_TEXT] = | 840 colors_[ThemeProperties::COLOR_BACKGROUND_TAB_TEXT] = |
| 841 color_utils::BlendTowardOppositeLuma(label_color, 50); | 841 color_utils::BlendTowardOppositeLuma(label_color, 50); |
| 842 | 842 |
| 843 inactive_selection_bg_color_ = native_theme_->GetSystemColor( | 843 inactive_selection_bg_color_ = native_theme_->GetSystemColor( |
| 844 ui::NativeTheme::kColorId_TextfieldReadOnlyBackground); | 844 ui::NativeTheme::kColorId_TextfieldReadOnlyBackground); |
| 845 inactive_selection_fg_color_ = native_theme_->GetSystemColor( | 845 inactive_selection_fg_color_ = native_theme_->GetSystemColor( |
| 846 ui::NativeTheme::kColorId_TextfieldReadOnlyColor); | 846 ui::NativeTheme::kColorId_TextfieldReadOnlyColor); |
| 847 | 847 |
| 848 // We pick the text and background colors for the NTP out of the | 848 // We pick the text and background colors for the NTP out of the |
| 849 // colors for a GtkEntry. We do this because GtkEntries background | 849 // colors for a GtkEntry. We do this because GtkEntries background |
| 850 // color is never the same as |toolbar_color|, is usually a white, | 850 // color is never the same as |tab_color|, is usually a white, |
| 851 // and when it isn't a white, provides sufficient contrast to | 851 // and when it isn't a white, provides sufficient contrast to |
| 852 // |toolbar_color|. Try this out with Darklooks, HighContrastInverse | 852 // |tab_color|. Try this out with Darklooks, HighContrastInverse |
| 853 // or ThinIce. | 853 // or ThinIce. |
| 854 colors_[ThemeProperties::COLOR_NTP_BACKGROUND] = | 854 colors_[ThemeProperties::COLOR_NTP_BACKGROUND] = |
| 855 native_theme_->GetSystemColor( | 855 native_theme_->GetSystemColor( |
| 856 ui::NativeTheme::kColorId_TextfieldDefaultBackground); | 856 ui::NativeTheme::kColorId_TextfieldDefaultBackground); |
| 857 colors_[ThemeProperties::COLOR_NTP_TEXT] = native_theme_->GetSystemColor( | 857 colors_[ThemeProperties::COLOR_NTP_TEXT] = native_theme_->GetSystemColor( |
| 858 ui::NativeTheme::kColorId_TextfieldDefaultColor); | 858 ui::NativeTheme::kColorId_TextfieldDefaultColor); |
| 859 // The NTP header is the color that surrounds the current active | 859 // The NTP header is the color that surrounds the current active |
| 860 // thumbnail on the NTP, and acts as the border of the "Recent | 860 // thumbnail on the NTP, and acts as the border of the "Recent |
| 861 // Links" box. It would be awesome if they were separated so we | 861 // Links" box. It would be awesome if they were separated so we |
| 862 // could use GetBorderColor() for the border around the "Recent | 862 // could use GetBorderColor() for the border around the "Recent |
| 863 // Links" section, but matching the frame color is more important. | 863 // Links" section, but matching the frame color is more important. |
| 864 colors_[ThemeProperties::COLOR_NTP_HEADER] = | 864 colors_[ThemeProperties::COLOR_NTP_HEADER] = |
| 865 colors_[ThemeProperties::COLOR_FRAME]; | 865 colors_[ThemeProperties::COLOR_FRAME]; |
| 866 #else | 866 #else |
| 867 std::string header_selector = GtkVersionCheck(3, 10) | 867 std::string header_selector = GtkVersionCheck(3, 10) |
| 868 ? "#headerbar.header-bar.titlebar" | 868 ? "#headerbar.header-bar.titlebar" |
| 869 : "GtkMenuBar#menubar"; | 869 : "GtkMenuBar#menubar"; |
| 870 SkColor frame_color = GetBgColor(header_selector); | 870 SkColor frame_color = GetBgColor(header_selector); |
| 871 SkColor frame_color_inactive = GetBgColor(header_selector + ":backdrop"); | 871 SkColor frame_color_inactive = GetBgColor(header_selector + ":backdrop"); |
| 872 colors_[ThemeProperties::COLOR_FRAME] = frame_color; | 872 colors_[ThemeProperties::COLOR_FRAME] = frame_color; |
| 873 colors_[ThemeProperties::COLOR_FRAME_INACTIVE] = frame_color_inactive; | 873 colors_[ThemeProperties::COLOR_FRAME_INACTIVE] = frame_color_inactive; |
| 874 colors_[ThemeProperties::COLOR_FRAME_INCOGNITO] = | 874 colors_[ThemeProperties::COLOR_FRAME_INCOGNITO] = |
| 875 color_utils::HSLShift(frame_color, kDefaultTintFrameIncognito); | 875 color_utils::HSLShift(frame_color, kDefaultTintFrameIncognito); |
| 876 colors_[ThemeProperties::COLOR_FRAME_INCOGNITO_INACTIVE] = | 876 colors_[ThemeProperties::COLOR_FRAME_INCOGNITO_INACTIVE] = |
| 877 color_utils::HSLShift(frame_color_inactive, kDefaultTintFrameIncognito); | 877 color_utils::HSLShift(frame_color_inactive, kDefaultTintFrameIncognito); |
| 878 | 878 |
| 879 SkColor toolbar_color = GetBgColor("GtkToolbar#toolbar"); | 879 SkColor tab_color = GetBgColor(""); |
|
Elliot Glaysher
2017/03/30 20:34:19
Slightly surprised that this can be empty; I would
Tom (Use chromium acct)
2017/03/30 20:40:26
https://cs.chromium.org/chromium/src/chrome/browse
| |
| 880 SkColor toolbar_text_color = color_utils::GetReadableColor( | 880 SkColor tab_text_color = GetFgColor("GtkLabel"); |
| 881 GetFgColor("GtkToolbar#toolbar GtkLabel#label"), | |
| 882 toolbar_color); | |
| 883 | 881 |
| 884 colors_[ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON] = toolbar_text_color; | 882 colors_[ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON] = tab_text_color; |
| 885 | 883 |
| 886 // Tabs use the same background color as the toolbar, so use the | 884 colors_[ThemeProperties::COLOR_TAB_TEXT] = tab_text_color; |
| 887 // toolbar text color as the tab text color. | 885 colors_[ThemeProperties::COLOR_BOOKMARK_TEXT] = tab_text_color; |
| 888 colors_[ThemeProperties::COLOR_TAB_TEXT] = toolbar_text_color; | |
| 889 colors_[ThemeProperties::COLOR_BOOKMARK_TEXT] = toolbar_text_color; | |
| 890 colors_[ThemeProperties::COLOR_BACKGROUND_TAB_TEXT] = | 886 colors_[ThemeProperties::COLOR_BACKGROUND_TAB_TEXT] = |
| 891 color_utils::BlendTowardOppositeLuma(toolbar_text_color, 50); | 887 color_utils::BlendTowardOppositeLuma(tab_text_color, 50); |
| 892 | 888 |
| 893 SkColor location_bar_border = | 889 SkColor location_bar_border = GetBorderColor("GtkEntry#entry"); |
| 894 GetBorderColor("GtkToolbar#toolbar GtkEntry#entry"); | |
| 895 if (SkColorGetA(location_bar_border)) | 890 if (SkColorGetA(location_bar_border)) |
| 896 colors_[ThemeProperties::COLOR_LOCATION_BAR_BORDER] = location_bar_border; | 891 colors_[ThemeProperties::COLOR_LOCATION_BAR_BORDER] = location_bar_border; |
| 897 | 892 |
| 898 inactive_selection_bg_color_ = GetSelectionBgColor( | 893 inactive_selection_bg_color_ = GetSelectionBgColor( |
| 899 GtkVersionCheck(3, 20) ? "GtkTextView#textview.view:backdrop " | 894 GtkVersionCheck(3, 20) ? "GtkTextView#textview.view:backdrop " |
| 900 "#text:backdrop #selection:backdrop" | 895 "#text:backdrop #selection:backdrop" |
| 901 : "GtkTextView.view:selected:backdrop"); | 896 : "GtkTextView.view:selected:backdrop"); |
| 902 inactive_selection_fg_color_ = | 897 inactive_selection_fg_color_ = |
| 903 GetFgColor(GtkVersionCheck(3, 20) ? "GtkTextView#textview.view:backdrop " | 898 GetFgColor(GtkVersionCheck(3, 20) ? "GtkTextView#textview.view:backdrop " |
| 904 "#text:backdrop #selection:backdrop" | 899 "#text:backdrop #selection:backdrop" |
| 905 : "GtkTextView.view:selected:backdrop"); | 900 : "GtkTextView.view:selected:backdrop"); |
| 906 | 901 |
| 907 SkColor toolbar_button_border = | 902 SkColor tab_border = GetBorderColor("GtkButton#button"); |
| 908 GetBorderColor("GtkToolbar#toolbar GtkButton#button"); | 903 colors_[ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_BACKGROUND] = tab_color; |
| 909 colors_[ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_BACKGROUND] = | |
| 910 toolbar_color; | |
| 911 colors_[ThemeProperties::COLOR_BOOKMARK_BAR_INSTRUCTIONS_TEXT] = | 904 colors_[ThemeProperties::COLOR_BOOKMARK_BAR_INSTRUCTIONS_TEXT] = |
| 912 toolbar_text_color; | 905 tab_text_color; |
| 913 // Separates the toolbar from the bookmark bar or butter bars. | 906 // Separates the toolbar from the bookmark bar or butter bars. |
| 914 colors_[ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR] = | 907 colors_[ThemeProperties::COLOR_TOOLBAR_BOTTOM_SEPARATOR] = tab_border; |
| 915 toolbar_button_border; | |
| 916 // Separates entries in the downloads bar. | 908 // Separates entries in the downloads bar. |
| 917 colors_[ThemeProperties::COLOR_TOOLBAR_VERTICAL_SEPARATOR] = | 909 colors_[ThemeProperties::COLOR_TOOLBAR_VERTICAL_SEPARATOR] = tab_border; |
| 918 toolbar_button_border; | |
| 919 // Separates the bookmark bar from the web content. | 910 // Separates the bookmark bar from the web content. |
| 920 colors_[ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR] = | 911 colors_[ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR] = tab_border; |
| 921 toolbar_button_border; | |
| 922 | 912 |
| 923 // These colors represent the border drawn around tabs and between | 913 // These colors represent the border drawn around tabs and between |
| 924 // the tabstrip and toolbar. | 914 // the tabstrip and toolbar. |
| 925 SkColor toolbar_top_separator = GetToolbarTopSeparatorColor( | 915 SkColor toolbar_top_separator = GetToolbarTopSeparatorColor( |
| 926 GetBorderColor(header_selector + " GtkButton#button"), frame_color, | 916 GetBorderColor(header_selector + " GtkButton#button"), frame_color, |
| 927 toolbar_button_border, toolbar_color); | 917 tab_border, tab_color); |
| 928 SkColor toolbar_top_separator_inactive = GetToolbarTopSeparatorColor( | 918 SkColor toolbar_top_separator_inactive = GetToolbarTopSeparatorColor( |
| 929 GetBorderColor(header_selector + ":backdrop GtkButton#button"), | 919 GetBorderColor(header_selector + ":backdrop GtkButton#button"), |
| 930 frame_color_inactive, toolbar_button_border, toolbar_color); | 920 frame_color_inactive, tab_border, tab_color); |
| 931 // Unlike with toolbars, we always want a border around tabs, so let | 921 // Unlike with toolbars, we always want a border around tabs, so let |
| 932 // ThemeService choose the border color if the theme doesn't provide one. | 922 // ThemeService choose the border color if the theme doesn't provide one. |
| 933 if (SkColorGetA(toolbar_top_separator) && | 923 if (SkColorGetA(toolbar_top_separator) && |
| 934 SkColorGetA(toolbar_top_separator_inactive)) { | 924 SkColorGetA(toolbar_top_separator_inactive)) { |
| 935 colors_[ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR] = | 925 colors_[ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR] = |
| 936 toolbar_top_separator; | 926 toolbar_top_separator; |
| 937 colors_[ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR_INACTIVE] = | 927 colors_[ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR_INACTIVE] = |
| 938 toolbar_top_separator_inactive; | 928 toolbar_top_separator_inactive; |
| 939 } | 929 } |
| 940 | 930 |
| 941 colors_[ThemeProperties::COLOR_NTP_BACKGROUND] = | 931 colors_[ThemeProperties::COLOR_NTP_BACKGROUND] = |
| 942 native_theme_->GetSystemColor( | 932 native_theme_->GetSystemColor( |
| 943 ui::NativeTheme::kColorId_TextfieldDefaultBackground); | 933 ui::NativeTheme::kColorId_TextfieldDefaultBackground); |
| 944 colors_[ThemeProperties::COLOR_NTP_TEXT] = native_theme_->GetSystemColor( | 934 colors_[ThemeProperties::COLOR_NTP_TEXT] = native_theme_->GetSystemColor( |
| 945 ui::NativeTheme::kColorId_TextfieldDefaultColor); | 935 ui::NativeTheme::kColorId_TextfieldDefaultColor); |
| 946 colors_[ThemeProperties::COLOR_NTP_HEADER] = | 936 colors_[ThemeProperties::COLOR_NTP_HEADER] = |
| 947 GetBorderColor("GtkButton#button"); | 937 GetBorderColor("GtkButton#button"); |
| 948 #endif | 938 #endif |
| 949 | 939 |
| 950 colors_[ThemeProperties::COLOR_TOOLBAR] = toolbar_color; | 940 colors_[ThemeProperties::COLOR_TOOLBAR] = tab_color; |
| 951 colors_[ThemeProperties::COLOR_CONTROL_BACKGROUND] = toolbar_color; | 941 colors_[ThemeProperties::COLOR_CONTROL_BACKGROUND] = tab_color; |
| 952 | 942 |
| 953 colors_[ThemeProperties::COLOR_NTP_LINK] = native_theme_->GetSystemColor( | 943 colors_[ThemeProperties::COLOR_NTP_LINK] = native_theme_->GetSystemColor( |
| 954 ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused); | 944 ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused); |
| 955 | 945 |
| 956 // Generate the colors that we pass to WebKit. | 946 // Generate the colors that we pass to WebKit. |
| 957 SetScrollbarColors(); | 947 SetScrollbarColors(); |
| 958 focus_ring_color_ = native_theme_->GetSystemColor( | 948 focus_ring_color_ = native_theme_->GetSystemColor( |
| 959 ui::NativeTheme::kColorId_FocusedBorderColor); | 949 ui::NativeTheme::kColorId_FocusedBorderColor); |
| 960 | 950 |
| 961 // Some GTK themes only define the text selection colors on the GtkEntry | 951 // Some GTK themes only define the text selection colors on the GtkEntry |
| 962 // class, so we need to use that for getting selection colors. | 952 // class, so we need to use that for getting selection colors. |
| 963 active_selection_bg_color_ = native_theme_->GetSystemColor( | 953 active_selection_bg_color_ = native_theme_->GetSystemColor( |
| 964 ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused); | 954 ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused); |
| 965 active_selection_fg_color_ = native_theme_->GetSystemColor( | 955 active_selection_fg_color_ = native_theme_->GetSystemColor( |
| 966 ui::NativeTheme::kColorId_TextfieldSelectionColor); | 956 ui::NativeTheme::kColorId_TextfieldSelectionColor); |
| 967 | 957 |
| 968 SkColor throbber_spinning = native_theme_->GetSystemColor( | |
| 969 ui::NativeTheme::kColorId_ThrobberSpinningColor); | |
| 970 colors_[ThemeProperties::COLOR_TAB_THROBBER_SPINNING] = | 958 colors_[ThemeProperties::COLOR_TAB_THROBBER_SPINNING] = |
| 971 color_utils::GetReadableColor(throbber_spinning, toolbar_color); | 959 native_theme_->GetSystemColor( |
| 972 SkColor throbber_waiting = native_theme_->GetSystemColor( | 960 ui::NativeTheme::kColorId_ThrobberSpinningColor); |
| 973 ui::NativeTheme::kColorId_ThrobberWaitingColor); | |
| 974 colors_[ThemeProperties::COLOR_TAB_THROBBER_WAITING] = | 961 colors_[ThemeProperties::COLOR_TAB_THROBBER_WAITING] = |
| 975 color_utils::GetReadableColor(throbber_waiting, toolbar_color); | 962 native_theme_->GetSystemColor( |
| 963 ui::NativeTheme::kColorId_ThrobberWaitingColor); | |
| 976 } | 964 } |
| 977 | 965 |
| 978 void GtkUi::UpdateCursorTheme() { | 966 void GtkUi::UpdateCursorTheme() { |
| 979 GtkSettings* settings = gtk_settings_get_default(); | 967 GtkSettings* settings = gtk_settings_get_default(); |
| 980 | 968 |
| 981 gchar* theme = nullptr; | 969 gchar* theme = nullptr; |
| 982 gint size = 0; | 970 gint size = 0; |
| 983 g_object_get(settings, "gtk-cursor-theme-name", &theme, | 971 g_object_get(settings, "gtk-cursor-theme-name", &theme, |
| 984 "gtk-cursor-theme-size", &size, nullptr); | 972 "gtk-cursor-theme-size", &size, nullptr); |
| 985 | 973 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1070 | 1058 |
| 1071 float GtkUi::GetDeviceScaleFactor() const { | 1059 float GtkUi::GetDeviceScaleFactor() const { |
| 1072 return device_scale_factor_; | 1060 return device_scale_factor_; |
| 1073 } | 1061 } |
| 1074 | 1062 |
| 1075 } // namespace libgtkui | 1063 } // namespace libgtkui |
| 1076 | 1064 |
| 1077 views::LinuxUI* BuildGtkUi() { | 1065 views::LinuxUI* BuildGtkUi() { |
| 1078 return new libgtkui::GtkUi; | 1066 return new libgtkui::GtkUi; |
| 1079 } | 1067 } |
| OLD | NEW |