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

Side by Side 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 unified diff | Download patch
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 #ifndef CHROME_BROWSER_THEMES_THEME_SERVICE_H_ 5 #ifndef CHROME_BROWSER_THEMES_THEME_SERVICE_H_
6 #define CHROME_BROWSER_THEMES_THEME_SERVICE_H_ 6 #define CHROME_BROWSER_THEMES_THEME_SERVICE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 208
209 private: 209 private:
210 const ThemeService& theme_service_; 210 const ThemeService& theme_service_;
211 bool incognito_; 211 bool incognito_;
212 212
213 DISALLOW_COPY_AND_ASSIGN(BrowserThemeProvider); 213 DISALLOW_COPY_AND_ASSIGN(BrowserThemeProvider);
214 }; 214 };
215 friend class BrowserThemeProvider; 215 friend class BrowserThemeProvider;
216 friend class theme_service_internal::ThemeServiceTest; 216 friend class theme_service_internal::ThemeServiceTest;
217 217
218 // Key for cache of separator colors; pair is <tab color, frame color>.
219 using SeparatorColorKey = std::pair<SkColor, SkColor>;
220 using SeparatorColorCache = std::map<SeparatorColorKey, SkColor>;
221
222
Evan Stade 2016/03/15 19:05:06 nit: is this extra line intentional?
Peter Kasting 2016/03/16 03:12:59 No.
223 // Computes the "toolbar top separator" color. This color is drawn atop the
224 // frame to separate it from tabs, the toolbar, and the new tab button, as
225 // 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
226 // toolbar. We use semitransparent black or white so as to darken or lighten
227 // the frame, with the goal of contrasting with both the frame color and the
228 // active tab (i.e. toolbar) color. (It's too difficult to try to find colors
229 // that will contrast with both of these as well as the background tab color,
230 // and contrasting with the foreground tab is the most important).
231 static SkColor GetSeparatorColor(SkColor tab_color, SkColor frame_color);
232
218 // These methods provide the implementation for ui::ThemeProvider (exposed 233 // These methods provide the implementation for ui::ThemeProvider (exposed
219 // via BrowserThemeProvider). 234 // via BrowserThemeProvider).
220 gfx::ImageSkia* GetImageSkiaNamed(int id, bool incognito) const; 235 gfx::ImageSkia* GetImageSkiaNamed(int id, bool incognito) const;
221 SkColor GetColor(int id, bool incognito) const; 236 SkColor GetColor(int id, bool incognito) const;
222 int GetDisplayProperty(int id) const; 237 int GetDisplayProperty(int id) const;
223 base::RefCountedMemory* GetRawData(int id, 238 base::RefCountedMemory* GetRawData(int id,
224 ui::ScaleFactor scale_factor) const; 239 ui::ScaleFactor scale_factor) const;
225 #if defined(OS_MACOSX) 240 #if defined(OS_MACOSX)
226 NSImage* GetNSImageNamed(int id, bool incognito) const; 241 NSImage* GetNSImageNamed(int id, bool incognito) const;
227 NSColor* GetNSImageColorNamed(int id, bool incognito) const; 242 NSColor* GetNSImageColorNamed(int id, bool incognito) const;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 // The id of the theme extension which has just been installed but has not 303 // The id of the theme extension which has just been installed but has not
289 // been loaded yet. The theme extension with |installed_pending_load_id_| may 304 // been loaded yet. The theme extension with |installed_pending_load_id_| may
290 // never be loaded if the install is due to updating a disabled theme. 305 // never be loaded if the install is due to updating a disabled theme.
291 // |pending_install_id_| should be set to |kDefaultThemeID| if there are no 306 // |pending_install_id_| should be set to |kDefaultThemeID| if there are no
292 // recently installed theme extensions 307 // recently installed theme extensions
293 std::string installed_pending_load_id_; 308 std::string installed_pending_load_id_;
294 309
295 // The number of infobars currently displayed. 310 // The number of infobars currently displayed.
296 int number_of_infobars_; 311 int number_of_infobars_;
297 312
313 // A cache of already-computed values for COLOR_TOOLBAR_TOP_SEPARATOR, which
314 // can be expensive to compute.
315 mutable SeparatorColorCache separator_color_cache_;
316
298 content::NotificationRegistrar registrar_; 317 content::NotificationRegistrar registrar_;
299 318
300 scoped_ptr<ThemeSyncableService> theme_syncable_service_; 319 scoped_ptr<ThemeSyncableService> theme_syncable_service_;
301 320
302 #if defined(ENABLE_EXTENSIONS) 321 #if defined(ENABLE_EXTENSIONS)
303 class ThemeObserver; 322 class ThemeObserver;
304 scoped_ptr<ThemeObserver> theme_observer_; 323 scoped_ptr<ThemeObserver> theme_observer_;
305 #endif 324 #endif
306 325
307 BrowserThemeProvider original_theme_provider_; 326 BrowserThemeProvider original_theme_provider_;
308 BrowserThemeProvider incognito_theme_provider_; 327 BrowserThemeProvider incognito_theme_provider_;
309 328
310 base::WeakPtrFactory<ThemeService> weak_ptr_factory_; 329 base::WeakPtrFactory<ThemeService> weak_ptr_factory_;
311 330
312 DISALLOW_COPY_AND_ASSIGN(ThemeService); 331 DISALLOW_COPY_AND_ASSIGN(ThemeService);
313 }; 332 };
314 333
315 #endif // CHROME_BROWSER_THEMES_THEME_SERVICE_H_ 334 #endif // CHROME_BROWSER_THEMES_THEME_SERVICE_H_
OLDNEW
« 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