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

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

Issue 1878943002: Revert of Makes MaterialDesignController initialization explicit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « chrome/browser/ui/libgtk2ui/gtk2_ui.h ('k') | chrome/browser/ui/startup/bad_flags_prompt.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 12ee4bce2d7d9143609645d293dad4bcedcba29a..0b1923e4dbbd706de468f6199535dff975297751 100644
--- a/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
+++ b/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
@@ -516,10 +516,6 @@
Gtk2EventLoop::GetInstance();
}
-void Gtk2UI::MaterialDesignControllerReady() {
- UpdateMaterialDesignColors();
-}
-
Gtk2UI::~Gtk2UI() {
ClearAllThemeData();
}
@@ -905,20 +901,25 @@
GetSelectedEntryForegroundHSL(&selected_entry_tint_);
SkColor frame_color = BuildFrameColors();
- // 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);
+ 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);
+ }
// 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
@@ -977,18 +978,6 @@
theme->GetSystemColor(ui::NativeTheme::kColorId_ThrobberSpinningColor);
colors_[ThemeProperties::COLOR_TAB_THROBBER_WAITING] =
theme->GetSystemColor(ui::NativeTheme::kColorId_ThrobberWaitingColor);
-}
-
-void Gtk2UI::UpdateMaterialDesignColors() {
- // TODO(varkha): This should be merged back into LoadGtkValues() once Material
- // Design is on unconditionally.
- 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() {
@@ -1371,9 +1360,6 @@
void Gtk2UI::ResetStyle() {
ClearAllThemeData();
LoadGtkValues();
- // TODO(varkha): There will be no need to call UpdateMaterialDesignColors()
- // once Material Design is on unconditionally.
- UpdateMaterialDesignColors();
NativeThemeGtk2::instance()->NotifyObservers();
}
« no previous file with comments | « chrome/browser/ui/libgtk2ui/gtk2_ui.h ('k') | chrome/browser/ui/startup/bad_flags_prompt.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698