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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | ui/base/material_design/material_design_controller.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/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 <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 986
987 colors_[ThemeProperties::COLOR_TAB_THROBBER_SPINNING] = 987 colors_[ThemeProperties::COLOR_TAB_THROBBER_SPINNING] =
988 theme->GetSystemColor(ui::NativeTheme::kColorId_ThrobberSpinningColor); 988 theme->GetSystemColor(ui::NativeTheme::kColorId_ThrobberSpinningColor);
989 colors_[ThemeProperties::COLOR_TAB_THROBBER_WAITING] = 989 colors_[ThemeProperties::COLOR_TAB_THROBBER_WAITING] =
990 theme->GetSystemColor(ui::NativeTheme::kColorId_ThrobberWaitingColor); 990 theme->GetSystemColor(ui::NativeTheme::kColorId_ThrobberWaitingColor);
991 } 991 }
992 992
993 void Gtk2UI::UpdateMaterialDesignColors() { 993 void Gtk2UI::UpdateMaterialDesignColors() {
994 // TODO(varkha): This should be merged back into LoadGtkValues() once Material 994 // TODO(varkha): This should be merged back into LoadGtkValues() once Material
995 // Design is on unconditionally. 995 // Design is on unconditionally.
996 if (ui::MaterialDesignController::IsModeMaterial()) { 996 // Early return when Material Design Controller is not initialized yet. This
997 NativeThemeGtk2* theme = NativeThemeGtk2::instance(); 997 // is harmless and the colors will get updated when this method is called
998 SkColor label_color = 998 // again after the initialization. See http://crbug.com/622234.
999 theme->GetSystemColor(ui::NativeTheme::kColorId_LabelEnabledColor); 999 if (!ui::MaterialDesignController::is_mode_initialized() ||
1000 colors_[ThemeProperties::COLOR_BACKGROUND_TAB_TEXT] = 1000 !ui::MaterialDesignController::IsModeMaterial()) {
1001 color_utils::BlendTowardOppositeLuma(label_color, 50); 1001 return;
1002 } 1002 }
1003 NativeThemeGtk2* theme = NativeThemeGtk2::instance();
1004 SkColor label_color =
1005 theme->GetSystemColor(ui::NativeTheme::kColorId_LabelEnabledColor);
1006 colors_[ThemeProperties::COLOR_BACKGROUND_TAB_TEXT] =
1007 color_utils::BlendTowardOppositeLuma(label_color, 50);
1003 } 1008 }
1004 1009
1005 SkColor Gtk2UI::BuildFrameColors() { 1010 SkColor Gtk2UI::BuildFrameColors() {
1006 NativeThemeGtk2* theme = NativeThemeGtk2::instance(); 1011 NativeThemeGtk2* theme = NativeThemeGtk2::instance();
1007 SkColor frame_color = 1012 SkColor frame_color =
1008 theme->GetSystemColor(ui::NativeTheme::kColorId_WindowBackground); 1013 theme->GetSystemColor(ui::NativeTheme::kColorId_WindowBackground);
1009 SkColor temp_color; 1014 SkColor temp_color;
1010 1015
1011 #if GTK_MAJOR_VERSION == 2 1016 #if GTK_MAJOR_VERSION == 2
1012 color_utils::HSL kDefaultFrameShift = { -1, -1, 0.4 }; 1017 color_utils::HSL kDefaultFrameShift = { -1, -1, 0.4 };
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
1401 // Blacklist scaling factors <130% (crbug.com/484400) and round 1406 // Blacklist scaling factors <130% (crbug.com/484400) and round
1402 // to 1 decimal to prevent rendering problems (crbug.com/485183). 1407 // to 1 decimal to prevent rendering problems (crbug.com/485183).
1403 return scale < 1.3f ? 1.0f : roundf(scale * 10) / 10; 1408 return scale < 1.3f ? 1.0f : roundf(scale * 10) / 10;
1404 } 1409 }
1405 1410
1406 } // namespace libgtk2ui 1411 } // namespace libgtk2ui
1407 1412
1408 views::LinuxUI* BuildGtk2UI() { 1413 views::LinuxUI* BuildGtk2UI() {
1409 return new libgtk2ui::Gtk2UI; 1414 return new libgtk2ui::Gtk2UI;
1410 } 1415 }
OLDNEW
« 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