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

Side by Side Diff: chrome/browser/ui/libgtk2ui/gtk2_ui.cc

Issue 2382443007: Clean up NativeTheme (particularly CommonTheme). (Closed)
Patch Set: two slight fixes Created 4 years, 2 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
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/libgtk2ui/gtk2_ui.h" 5 #include "chrome/browser/ui/libgtk2ui/gtk2_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 #include <set> 10 #include <set>
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 806
807 void Gtk2UI::LoadGtkValues() { 807 void Gtk2UI::LoadGtkValues() {
808 // TODO(erg): GtkThemeService had a comment here about having to muck with 808 // TODO(erg): GtkThemeService had a comment here about having to muck with
809 // the raw Prefs object to remove prefs::kCurrentThemeImages or else we'd 809 // the raw Prefs object to remove prefs::kCurrentThemeImages or else we'd
810 // regress startup time. Figure out how to do that when we can't access the 810 // regress startup time. Figure out how to do that when we can't access the
811 // prefs system from here. 811 // prefs system from here.
812 812
813 NativeThemeGtk2* theme = NativeThemeGtk2::instance(); 813 NativeThemeGtk2* theme = NativeThemeGtk2::instance();
814 814
815 SkColor toolbar_color = 815 SkColor toolbar_color =
816 theme->GetSystemColor(ui::NativeTheme::kColorId_LabelBackgroundColor); 816 theme->GetSystemColor(ui::NativeTheme::kColorId_DialogBackground);
817 SkColor label_color = 817 SkColor label_color =
818 theme->GetSystemColor(ui::NativeTheme::kColorId_LabelEnabledColor); 818 theme->GetSystemColor(ui::NativeTheme::kColorId_LabelEnabledColor);
819 819
820 colors_[ThemeProperties::COLOR_CONTROL_BACKGROUND] = toolbar_color; 820 colors_[ThemeProperties::COLOR_CONTROL_BACKGROUND] = toolbar_color;
821 colors_[ThemeProperties::COLOR_TOOLBAR] = toolbar_color; 821 colors_[ThemeProperties::COLOR_TOOLBAR] = toolbar_color;
822 822
823 colors_[ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON] = 823 colors_[ThemeProperties::COLOR_TOOLBAR_BUTTON_ICON] =
824 color_utils::DeriveDefaultIconColor(label_color); 824 color_utils::DeriveDefaultIconColor(label_color);
825 825
826 colors_[ThemeProperties::COLOR_TAB_TEXT] = label_color; 826 colors_[ThemeProperties::COLOR_TAB_TEXT] = label_color;
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 set_frame_color(ThemeProperties::COLOR_FRAME_INACTIVE); 1026 set_frame_color(ThemeProperties::COLOR_FRAME_INACTIVE);
1027 set_frame_color(ThemeProperties::COLOR_FRAME_INCOGNITO); 1027 set_frame_color(ThemeProperties::COLOR_FRAME_INCOGNITO);
1028 set_frame_color(ThemeProperties::COLOR_FRAME_INCOGNITO_INACTIVE); 1028 set_frame_color(ThemeProperties::COLOR_FRAME_INCOGNITO_INACTIVE);
1029 #endif 1029 #endif
1030 } 1030 }
1031 1031
1032 void Gtk2UI::GetNormalButtonTintHSL(color_utils::HSL* tint) const { 1032 void Gtk2UI::GetNormalButtonTintHSL(color_utils::HSL* tint) const {
1033 NativeThemeGtk2* theme = NativeThemeGtk2::instance(); 1033 NativeThemeGtk2* theme = NativeThemeGtk2::instance();
1034 1034
1035 SkColor accent_color = 1035 SkColor accent_color =
1036 theme->GetSystemColor( 1036 theme->GetSystemColor(ui::NativeTheme::kColorId_ProminentButtonColor);
1037 ui::NativeTheme::kColorId_ButtonHighlightColor);
1038 SkColor text_color = 1037 SkColor text_color =
1039 theme->GetSystemColor( 1038 theme->GetSystemColor(
1040 ui::NativeTheme::kColorId_LabelEnabledColor); 1039 ui::NativeTheme::kColorId_LabelEnabledColor);
1041 SkColor base_color = 1040 SkColor base_color =
1042 theme->GetSystemColor( 1041 theme->GetSystemColor(ui::NativeTheme::kColorId_DialogBackground);
1043 ui::NativeTheme::kColorId_LabelBackgroundColor);
1044 1042
1045 PickButtonTintFromColors(accent_color, text_color, base_color, tint); 1043 PickButtonTintFromColors(accent_color, text_color, base_color, tint);
1046 } 1044 }
1047 1045
1048 void Gtk2UI::GetNormalEntryForegroundHSL(color_utils::HSL* tint) const { 1046 void Gtk2UI::GetNormalEntryForegroundHSL(color_utils::HSL* tint) const {
1049 NativeThemeGtk2* theme = NativeThemeGtk2::instance(); 1047 NativeThemeGtk2* theme = NativeThemeGtk2::instance();
1050 1048
1051 SkColor accent_color = 1049 SkColor accent_color =
1052 theme->GetSystemColor( 1050 theme->GetSystemColor(ui::NativeTheme::kColorId_ProminentButtonColor);
1053 ui::NativeTheme::kColorId_ButtonHighlightColor);
1054 SkColor text_color = 1051 SkColor text_color =
1055 theme->GetSystemColor( 1052 theme->GetSystemColor(
1056 ui::NativeTheme::kColorId_TextfieldDefaultColor); 1053 ui::NativeTheme::kColorId_TextfieldDefaultColor);
1057 SkColor base_color = 1054 SkColor base_color =
1058 theme->GetSystemColor( 1055 theme->GetSystemColor(
1059 ui::NativeTheme::kColorId_TextfieldDefaultBackground); 1056 ui::NativeTheme::kColorId_TextfieldDefaultBackground);
1060 1057
1061 PickButtonTintFromColors(accent_color, text_color, base_color, tint); 1058 PickButtonTintFromColors(accent_color, text_color, base_color, tint);
1062 } 1059 }
1063 1060
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 // Blacklist scaling factors <130% (crbug.com/484400) and round 1131 // Blacklist scaling factors <130% (crbug.com/484400) and round
1135 // to 1 decimal to prevent rendering problems (crbug.com/485183). 1132 // to 1 decimal to prevent rendering problems (crbug.com/485183).
1136 return scale < 1.3f ? 1.0f : roundf(scale * 10) / 10; 1133 return scale < 1.3f ? 1.0f : roundf(scale * 10) / 10;
1137 } 1134 }
1138 1135
1139 } // namespace libgtk2ui 1136 } // namespace libgtk2ui
1140 1137
1141 views::LinuxUI* BuildGtk2UI() { 1138 views::LinuxUI* BuildGtk2UI() {
1142 return new libgtk2ui::Gtk2UI; 1139 return new libgtk2ui::Gtk2UI;
1143 } 1140 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698