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 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 SkColor frame_color = GetBgColor("#headerbar.header-bar.titlebar"); | 867 std::string header_selector = GtkVersionCheck(3, 10) |
| 868 SkColor frame_color_inactive = | 868 ? "#headerbar.header-bar.titlebar" |
| 869 GetBgColor("#headerbar.header-bar.titlebar:backdrop"); | 869 : "GtkMenuBar#menubar"; |
| 870 header_selector = "GtkMenuBar#menubar"; | |
|
Elliot Glaysher
2017/03/27 22:31:56
Is this a typo? You're setting header_selector imm
Tom (Use chromium acct)
2017/03/27 22:36:11
oops, I accidentally committed this during testing
| |
| 871 SkColor frame_color = GetBgColor(header_selector); | |
| 872 SkColor frame_color_inactive = GetBgColor(header_selector + ":backdrop"); | |
| 870 colors_[ThemeProperties::COLOR_FRAME] = frame_color; | 873 colors_[ThemeProperties::COLOR_FRAME] = frame_color; |
| 871 colors_[ThemeProperties::COLOR_FRAME_INACTIVE] = frame_color_inactive; | 874 colors_[ThemeProperties::COLOR_FRAME_INACTIVE] = frame_color_inactive; |
| 872 colors_[ThemeProperties::COLOR_FRAME_INCOGNITO] = | 875 colors_[ThemeProperties::COLOR_FRAME_INCOGNITO] = |
| 873 color_utils::HSLShift(frame_color, kDefaultTintFrameIncognito); | 876 color_utils::HSLShift(frame_color, kDefaultTintFrameIncognito); |
| 874 colors_[ThemeProperties::COLOR_FRAME_INCOGNITO_INACTIVE] = | 877 colors_[ThemeProperties::COLOR_FRAME_INCOGNITO_INACTIVE] = |
| 875 color_utils::HSLShift(frame_color_inactive, kDefaultTintFrameIncognito); | 878 color_utils::HSLShift(frame_color_inactive, kDefaultTintFrameIncognito); |
| 876 | 879 |
| 877 SkColor toolbar_color = GetBgColor("GtkToolbar#toolbar"); | 880 SkColor toolbar_color = GetBgColor("GtkToolbar#toolbar"); |
| 878 SkColor toolbar_text_color = color_utils::GetReadableColor( | 881 SkColor toolbar_text_color = color_utils::GetReadableColor( |
| 879 GetFgColor("GtkToolbar#toolbar GtkLabel#label"), | 882 GetFgColor("GtkToolbar#toolbar GtkLabel#label"), |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 914 // Separates entries in the downloads bar. | 917 // Separates entries in the downloads bar. |
| 915 colors_[ThemeProperties::COLOR_TOOLBAR_VERTICAL_SEPARATOR] = | 918 colors_[ThemeProperties::COLOR_TOOLBAR_VERTICAL_SEPARATOR] = |
| 916 toolbar_button_border; | 919 toolbar_button_border; |
| 917 // Separates the bookmark bar from the web content. | 920 // Separates the bookmark bar from the web content. |
| 918 colors_[ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR] = | 921 colors_[ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_SEPARATOR] = |
| 919 toolbar_button_border; | 922 toolbar_button_border; |
| 920 | 923 |
| 921 // These colors represent the border drawn around tabs and between | 924 // These colors represent the border drawn around tabs and between |
| 922 // the tabstrip and toolbar. | 925 // the tabstrip and toolbar. |
| 923 SkColor toolbar_top_separator = GetToolbarTopSeparatorColor( | 926 SkColor toolbar_top_separator = GetToolbarTopSeparatorColor( |
| 924 GetBorderColor("#headerbar.header-bar.titlebar GtkButton#button"), | 927 GetBorderColor(header_selector + " GtkButton#button"), frame_color, |
| 925 frame_color, toolbar_button_border, toolbar_color); | 928 toolbar_button_border, toolbar_color); |
| 926 SkColor toolbar_top_separator_inactive = GetToolbarTopSeparatorColor( | 929 SkColor toolbar_top_separator_inactive = GetToolbarTopSeparatorColor( |
| 927 GetBorderColor( | 930 GetBorderColor(header_selector + ":backdrop GtkButton#button"), |
| 928 "#headerbar.header-bar.titlebar:backdrop GtkButton#button"), | |
| 929 frame_color_inactive, toolbar_button_border, toolbar_color); | 931 frame_color_inactive, toolbar_button_border, toolbar_color); |
| 930 // Unlike with toolbars, we always want a border around tabs, so let | 932 // Unlike with toolbars, we always want a border around tabs, so let |
| 931 // ThemeService choose the border color if the theme doesn't provide one. | 933 // ThemeService choose the border color if the theme doesn't provide one. |
| 932 if (SkColorGetA(toolbar_top_separator) && | 934 if (SkColorGetA(toolbar_top_separator) && |
| 933 SkColorGetA(toolbar_top_separator_inactive)) { | 935 SkColorGetA(toolbar_top_separator_inactive)) { |
| 934 colors_[ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR] = | 936 colors_[ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR] = |
| 935 toolbar_top_separator; | 937 toolbar_top_separator; |
| 936 colors_[ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR_INACTIVE] = | 938 colors_[ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR_INACTIVE] = |
| 937 toolbar_top_separator_inactive; | 939 toolbar_top_separator_inactive; |
| 938 } | 940 } |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1069 | 1071 |
| 1070 float GtkUi::GetDeviceScaleFactor() const { | 1072 float GtkUi::GetDeviceScaleFactor() const { |
| 1071 return device_scale_factor_; | 1073 return device_scale_factor_; |
| 1072 } | 1074 } |
| 1073 | 1075 |
| 1074 } // namespace libgtkui | 1076 } // namespace libgtkui |
| 1075 | 1077 |
| 1076 views::LinuxUI* BuildGtkUi() { | 1078 views::LinuxUI* BuildGtkUi() { |
| 1077 return new libgtkui::GtkUi; | 1079 return new libgtkui::GtkUi; |
| 1078 } | 1080 } |
| OLD | NEW |