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

Unified Diff: chrome/browser/themes/theme_service.h

Issue 1785613004: Dynamically compute tab/frame separator color. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments 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
« no previous file with comments | « no previous file | chrome/browser/themes/theme_service.cc » ('j') | chrome/browser/themes/theme_service.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/themes/theme_service.h
diff --git a/chrome/browser/themes/theme_service.h b/chrome/browser/themes/theme_service.h
index 7f4cf1e8f074ada397a488bab476f4f03260a51f..0625bd48fb12429f0720f0ffd019a15ffb411f37 100644
--- a/chrome/browser/themes/theme_service.h
+++ b/chrome/browser/themes/theme_service.h
@@ -215,6 +215,21 @@ class ThemeService : public base::NonThreadSafe,
friend class BrowserThemeProvider;
friend class theme_service_internal::ThemeServiceTest;
+ // Key for cache of separator colors; pair is <tab color, frame color>.
+ using SeparatorColorKey = std::pair<SkColor, SkColor>;
+ using SeparatorColorCache = std::map<SeparatorColorKey, SkColor>;
+
+
Evan Stade 2016/03/15 19:05:06 nit: is this extra line intentional?
Peter Kasting 2016/03/16 03:12:59 No.
+ // Computes the "toolbar top separator" color. This color is drawn atop the
+ // frame to separate it from tabs, the toolbar, and the new tab button, as
+ // well as atop background tabs to separate them from other tabs or the
Evan Stade 2016/03/15 19:05:06 hmm, so this color is drawn on top of the backgrou
Peter Kasting 2016/03/16 03:12:59 It's drawn on both. It's drawn on the frame aroun
+ // toolbar. We use semitransparent black or white so as to darken or lighten
+ // the frame, with the goal of contrasting with both the frame color and the
+ // active tab (i.e. toolbar) color. (It's too difficult to try to find colors
+ // that will contrast with both of these as well as the background tab color,
+ // and contrasting with the foreground tab is the most important).
+ static SkColor GetSeparatorColor(SkColor tab_color, SkColor frame_color);
+
// These methods provide the implementation for ui::ThemeProvider (exposed
// via BrowserThemeProvider).
gfx::ImageSkia* GetImageSkiaNamed(int id, bool incognito) const;
@@ -295,6 +310,10 @@ class ThemeService : public base::NonThreadSafe,
// The number of infobars currently displayed.
int number_of_infobars_;
+ // A cache of already-computed values for COLOR_TOOLBAR_TOP_SEPARATOR, which
+ // can be expensive to compute.
+ mutable SeparatorColorCache separator_color_cache_;
+
content::NotificationRegistrar registrar_;
scoped_ptr<ThemeSyncableService> theme_syncable_service_;
« no previous file with comments | « no previous file | chrome/browser/themes/theme_service.cc » ('j') | chrome/browser/themes/theme_service.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698