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

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

Issue 2683953005: Gtk3: More fixes and refactorings (Closed)
Patch Set: Remove lambda 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 | « no previous file | chrome/browser/ui/libgtkui/gtk_util.h » ('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 823 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 834
835 colors_[ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON] = toolbar_text_color; 835 colors_[ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON] = toolbar_text_color;
836 836
837 // Tabs use the same background color as the toolbar, so use the 837 // Tabs use the same background color as the toolbar, so use the
838 // toolbar text color as the tab text color. 838 // toolbar text color as the tab text color.
839 colors_[ThemeProperties::COLOR_TAB_TEXT] = toolbar_text_color; 839 colors_[ThemeProperties::COLOR_TAB_TEXT] = toolbar_text_color;
840 colors_[ThemeProperties::COLOR_BOOKMARK_TEXT] = toolbar_text_color; 840 colors_[ThemeProperties::COLOR_BOOKMARK_TEXT] = toolbar_text_color;
841 colors_[ThemeProperties::COLOR_BACKGROUND_TAB_TEXT] = 841 colors_[ThemeProperties::COLOR_BACKGROUND_TAB_TEXT] =
842 color_utils::BlendTowardOppositeLuma(toolbar_text_color, 50); 842 color_utils::BlendTowardOppositeLuma(toolbar_text_color, 50);
843 843
844 // Color drawn around the location bar. 844 SkColor location_bar_border =
845 colors_[ThemeProperties::COLOR_LOCATION_BAR_BORDER] =
846 GetBorderColor("GtkToolbar#toolbar GtkEntry#entry"); 845 GetBorderColor("GtkToolbar#toolbar GtkEntry#entry");
846 if (SkColorGetA(location_bar_border)) {
847 colors_[ThemeProperties::COLOR_LOCATION_BAR_BORDER] = location_bar_border;
848 }
847 849
848 inactive_selection_bg_color_ = 850 inactive_selection_bg_color_ = GetSelectedBgColor("GtkEntry#entry:backdrop");
849 GetBgColor("GtkEntry#entry:backdrop #selection:selected");
850 inactive_selection_fg_color_ = 851 inactive_selection_fg_color_ =
851 GetFgColor("GtkEntry#entry:backdrop #selection:selected"); 852 GetSelectedTextColor("GtkEntry#entry:backdrop");
852 853
853 SkColor toolbar_separator_horizontal = 854 SkColor toolbar_separator_horizontal =
854 GetSeparatorColor("GtkToolbar#toolbar GtkSeparator#separator.horizontal"); 855 GetSeparatorColor("GtkToolbar#toolbar GtkSeparator#separator.horizontal");
855 SkColor toolbar_separator_vertical = 856 SkColor toolbar_separator_vertical =
856 GetSeparatorColor("GtkToolbar#toolbar GtkSeparator#separator.vertical"); 857 GetSeparatorColor("GtkToolbar#toolbar GtkSeparator#separator.vertical");
857 colors_[ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_BACKGROUND] = 858 colors_[ThemeProperties::COLOR_DETACHED_BOOKMARK_BAR_BACKGROUND] =
858 toolbar_color; 859 toolbar_color;
859 colors_[ThemeProperties::COLOR_BOOKMARK_BAR_INSTRUCTIONS_TEXT] = 860 colors_[ThemeProperties::COLOR_BOOKMARK_BAR_INSTRUCTIONS_TEXT] =
860 toolbar_text_color; 861 toolbar_text_color;
861 // Separates the toolbar from the bookmark bar or butter bars. 862 // Separates the toolbar from the bookmark bar or butter bars.
(...skipping 15 matching lines...) Expand all
877 // Unlike with toolbars, we always want a border around tabs, so let 878 // Unlike with toolbars, we always want a border around tabs, so let
878 // ThemeService choose the border color if the theme doesn't provide one. 879 // ThemeService choose the border color if the theme doesn't provide one.
879 if (SkColorGetA(header_button_border) && 880 if (SkColorGetA(header_button_border) &&
880 SkColorGetA(header_button_inactive_border)) { 881 SkColorGetA(header_button_inactive_border)) {
881 colors_[ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR] = 882 colors_[ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR] =
882 header_button_border; 883 header_button_border;
883 colors_[ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR_INACTIVE] = 884 colors_[ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR_INACTIVE] =
884 header_button_inactive_border; 885 header_button_inactive_border;
885 } 886 }
886 887
887 SkColor ntp_bg = GetBgColor(""); 888 colors_[ThemeProperties::COLOR_NTP_BACKGROUND] = GetBgColor("GtkEntry#entry");
888 colors_[ThemeProperties::COLOR_NTP_BACKGROUND] = ntp_bg; 889 colors_[ThemeProperties::COLOR_NTP_TEXT] = GetFgColor("GtkEntry#entry");
889 colors_[ThemeProperties::COLOR_NTP_TEXT] =
890 color_utils::GetReadableColor(GetFgColor("GtkLabel#label"), ntp_bg);
891 colors_[ThemeProperties::COLOR_NTP_HEADER] = 890 colors_[ThemeProperties::COLOR_NTP_HEADER] =
892 GetBorderColor("GtkButton#button"); 891 GetBorderColor("GtkButton#button");
893 #endif 892 #endif
894 893
895 colors_[ThemeProperties::COLOR_TOOLBAR] = toolbar_color; 894 colors_[ThemeProperties::COLOR_TOOLBAR] = toolbar_color;
896 colors_[ThemeProperties::COLOR_CONTROL_BACKGROUND] = toolbar_color; 895 colors_[ThemeProperties::COLOR_CONTROL_BACKGROUND] = toolbar_color;
897 896
898 colors_[ThemeProperties::COLOR_NTP_LINK] = 897 colors_[ThemeProperties::COLOR_NTP_LINK] = native_theme_->GetSystemColor(
899 native_theme_->GetSystemColor(ui::NativeTheme::kColorId_LinkEnabled); 898 ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused);
900 899
901 // Generate the colors that we pass to WebKit. 900 // Generate the colors that we pass to WebKit.
902 SetScrollbarColors(); 901 SetScrollbarColors();
903 focus_ring_color_ = native_theme_->GetSystemColor( 902 focus_ring_color_ =
904 ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused); 903 native_theme_->GetSystemColor(ui::NativeTheme::kColorId_LinkEnabled);
905 904
906 // Some GTK themes only define the text selection colors on the GtkEntry 905 // Some GTK themes only define the text selection colors on the GtkEntry
907 // class, so we need to use that for getting selection colors. 906 // class, so we need to use that for getting selection colors.
908 active_selection_bg_color_ = native_theme_->GetSystemColor( 907 active_selection_bg_color_ = native_theme_->GetSystemColor(
909 ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused); 908 ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused);
910 active_selection_fg_color_ = native_theme_->GetSystemColor( 909 active_selection_fg_color_ = native_theme_->GetSystemColor(
911 ui::NativeTheme::kColorId_TextfieldSelectionColor); 910 ui::NativeTheme::kColorId_TextfieldSelectionColor);
912 911
913 colors_[ThemeProperties::COLOR_TAB_THROBBER_SPINNING] = 912 colors_[ThemeProperties::COLOR_TAB_THROBBER_SPINNING] =
914 native_theme_->GetSystemColor( 913 native_theme_->GetSystemColor(
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1047 1046
1048 float GtkUi::GetDeviceScaleFactor() const { 1047 float GtkUi::GetDeviceScaleFactor() const {
1049 return device_scale_factor_; 1048 return device_scale_factor_;
1050 } 1049 }
1051 1050
1052 } // namespace libgtkui 1051 } // namespace libgtkui
1053 1052
1054 views::LinuxUI* BuildGtkUi() { 1053 views::LinuxUI* BuildGtkUi() {
1055 return new libgtkui::GtkUi; 1054 return new libgtkui::GtkUi;
1056 } 1055 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/libgtkui/gtk_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698