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

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

Issue 2171873002: [top-chrome-md] Allows UpdateMaterialDesignColors to be called before MDC::Initialize() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: Created 4 years, 5 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 | « no previous file | ui/base/material_design/material_design_controller.h » ('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 19da7c8a0bec85964bf02a79764611f340b56413..347239ced9e8ec67330940ab9bb2a621f353e072 100644
--- a/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
+++ b/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
@@ -993,13 +993,18 @@ void Gtk2UI::LoadGtkValues() {
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);
+ // Early return when Material Design Controller is not initialized yet. This
+ // is harmless and the colors will get updated when this method is called
+ // again after the initialization. See http://crbug.com/622234.
+ if (!ui::MaterialDesignController::is_mode_initialized() ||
+ !ui::MaterialDesignController::IsModeMaterial()) {
+ return;
}
+ 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() {
« no previous file with comments | « no previous file | ui/base/material_design/material_design_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698