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

Unified Diff: chrome/browser/ui/libgtk2ui/gtk2_ui.cc

Issue 1845343005: Makes MaterialDesignController initialization explicit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added UpdatewithLocalState call to update colors after MD flag is added to the command line Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/libgtk2ui/gtk2_ui.cc
diff --git a/chrome/browser/ui/libgtk2ui/gtk2_ui.cc b/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
index 0b1923e4dbbd706de468f6199535dff975297751..f5d90d09af8c3cac9cf41e9f69a3a007e9822cda 100644
--- a/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
+++ b/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
@@ -516,6 +516,10 @@ void Gtk2UI::Initialize() {
Gtk2EventLoop::GetInstance();
}
+void Gtk2UI::UpdateWithLocalState() {
+ UpdateColors();
+}
+
Gtk2UI::~Gtk2UI() {
ClearAllThemeData();
}
@@ -901,25 +905,20 @@ void Gtk2UI::LoadGtkValues() {
GetSelectedEntryForegroundHSL(&selected_entry_tint_);
SkColor frame_color = BuildFrameColors();
- if (ui::MaterialDesignController::IsModeMaterial()) {
- colors_[ThemeProperties::COLOR_BACKGROUND_TAB_TEXT] =
- color_utils::BlendTowardOppositeLuma(label_color, 50);
- } else {
- // The inactive frame color never occurs naturally in the theme, as it is a
- // tinted version of |frame_color|. We generate another color based on the
- // background tab color, with the lightness and saturation moved in the
- // opposite direction. (We don't touch the hue, since there should be subtle
- // hints of the color in the text.)
- color_utils::HSL inactive_tab_text_hsl;
- color_utils::SkColorToHSL(
- theme->GetSystemColor(ui::NativeTheme::kColorId_WindowBackground),
- &inactive_tab_text_hsl);
- inactive_tab_text_hsl.s = kInactiveLuminance;
- inactive_tab_text_hsl.l = kInactiveSaturation;
-
- colors_[ThemeProperties::COLOR_BACKGROUND_TAB_TEXT] =
- color_utils::HSLToSkColor(inactive_tab_text_hsl, 255);
- }
+ // The inactive frame color never occurs naturally in the theme, as it is a
+ // tinted version of |frame_color|. We generate another color based on the
+ // background tab color, with the lightness and saturation moved in the
+ // opposite direction. (We don't touch the hue, since there should be subtle
+ // hints of the color in the text.)
+ color_utils::HSL inactive_tab_text_hsl;
+ color_utils::SkColorToHSL(
+ theme->GetSystemColor(ui::NativeTheme::kColorId_WindowBackground),
+ &inactive_tab_text_hsl);
+ inactive_tab_text_hsl.s = kInactiveLuminance;
+ inactive_tab_text_hsl.l = kInactiveSaturation;
+
+ colors_[ThemeProperties::COLOR_BACKGROUND_TAB_TEXT] =
+ color_utils::HSLToSkColor(inactive_tab_text_hsl, 255);
// We pick the text and background colors for the NTP out of the colors for a
// GtkEntry. We do this because GtkEntries background color is never the same
@@ -980,6 +979,16 @@ void Gtk2UI::LoadGtkValues() {
theme->GetSystemColor(ui::NativeTheme::kColorId_ThrobberWaitingColor);
}
+void Gtk2UI::UpdateColors() {
+ if (ui::MaterialDesignController::IsModeMaterial()) {
+ NativeThemeGtk2* theme = NativeThemeGtk2::instance();
+ SkColor label_color =
+ theme->GetSystemColor(ui::NativeTheme::kColorId_LabelEnabledColor);
+ colors_[ThemeProperties::COLOR_BACKGROUND_TAB_TEXT] =
+ color_utils::BlendTowardOppositeLuma(label_color, 50);
+ }
+}
+
SkColor Gtk2UI::BuildFrameColors() {
NativeThemeGtk2* theme = NativeThemeGtk2::instance();
SkColor frame_color =
« no previous file with comments | « chrome/browser/ui/libgtk2ui/gtk2_ui.h ('k') | chrome/browser/ui/views/chrome_browser_main_extra_parts_views_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698