| OLD | NEW |
| 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 <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/leak_annotations.h" | 10 #include "base/debug/leak_annotations.h" |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 | 239 |
| 240 color_utils::HSL background_tint; | 240 color_utils::HSL background_tint; |
| 241 color_utils::SkColorToHSL(libgtk2ui::GdkColorToSkColor(background_color), | 241 color_utils::SkColorToHSL(libgtk2ui::GdkColorToSkColor(background_color), |
| 242 &background_tint); | 242 &background_tint); |
| 243 | 243 |
| 244 // If the accent color is gray, then our normal HSL tomfoolery will bring out | 244 // If the accent color is gray, then our normal HSL tomfoolery will bring out |
| 245 // whatever color is oddly dominant (for example, in rgb space [125, 128, | 245 // whatever color is oddly dominant (for example, in rgb space [125, 128, |
| 246 // 125] will tint green instead of gray). Slight differences (+/-10 (4%) to | 246 // 125] will tint green instead of gray). Slight differences (+/-10 (4%) to |
| 247 // all color components) should be interpreted as this color being gray and | 247 // all color components) should be interpreted as this color being gray and |
| 248 // we should switch into a special grayscale mode. | 248 // we should switch into a special grayscale mode. |
| 249 int rb_diff = abs(SkColorGetR(accent_color) - SkColorGetB(accent_color)); | 249 int rb_diff = abs(static_cast<int>(SkColorGetR(accent_color)) - |
| 250 int rg_diff = abs(SkColorGetR(accent_color) - SkColorGetG(accent_color)); | 250 static_cast<int>(SkColorGetB(accent_color))); |
| 251 int bg_diff = abs(SkColorGetB(accent_color) - SkColorGetG(accent_color)); | 251 int rg_diff = abs(static_cast<int>(SkColorGetR(accent_color)) - |
| 252 static_cast<int>(SkColorGetG(accent_color))); |
| 253 int bg_diff = abs(static_cast<int>(SkColorGetB(accent_color)) - |
| 254 static_cast<int>(SkColorGetG(accent_color))); |
| 252 if (rb_diff < 10 && rg_diff < 10 && bg_diff < 10) { | 255 if (rb_diff < 10 && rg_diff < 10 && bg_diff < 10) { |
| 253 // Our accent is white/gray/black. Only the luminance of the accent color | 256 // Our accent is white/gray/black. Only the luminance of the accent color |
| 254 // matters. | 257 // matters. |
| 255 tint->h = -1; | 258 tint->h = -1; |
| 256 | 259 |
| 257 // Use the saturation of the text. | 260 // Use the saturation of the text. |
| 258 tint->s = text_tint.s; | 261 tint->s = text_tint.s; |
| 259 | 262 |
| 260 // Use the luminance of the accent color UNLESS there isn't enough | 263 // Use the luminance of the accent color UNLESS there isn't enough |
| 261 // luminance contrast between the accent color and the base color. | 264 // luminance contrast between the accent color and the base color. |
| (...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1383 ClearAllThemeData(); | 1386 ClearAllThemeData(); |
| 1384 LoadGtkValues(); | 1387 LoadGtkValues(); |
| 1385 NativeThemeGtk2::instance()->NotifyObservers(); | 1388 NativeThemeGtk2::instance()->NotifyObservers(); |
| 1386 } | 1389 } |
| 1387 | 1390 |
| 1388 } // namespace libgtk2ui | 1391 } // namespace libgtk2ui |
| 1389 | 1392 |
| 1390 views::LinuxUI* BuildGtk2UI() { | 1393 views::LinuxUI* BuildGtk2UI() { |
| 1391 return new libgtk2ui::Gtk2UI; | 1394 return new libgtk2ui::Gtk2UI; |
| 1392 } | 1395 } |
| OLD | NEW |