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

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: Exclude test on Mac 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
« no previous file with comments | « no previous file | chrome/browser/themes/theme_service.cc » ('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 #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 // Computes the "toolbar top separator" color. This color is drawn atop the
223 // frame to separate it from tabs, the toolbar, and the new tab button, as
224 // well as atop background tabs to separate them from other tabs or the
225 // toolbar. We use semitransparent black or white so as to darken or lighten
226 // the frame, with the goal of contrasting with both the frame color and the
227 // active tab (i.e. toolbar) color. (It's too difficult to try to find colors
228 // that will contrast with both of these as well as the background tab color,
229 // and contrasting with the foreground tab is the most important).
230 static SkColor GetSeparatorColor(SkColor tab_color, SkColor frame_color);
231
218 // These methods provide the implementation for ui::ThemeProvider (exposed 232 // These methods provide the implementation for ui::ThemeProvider (exposed
219 // via BrowserThemeProvider). 233 // via BrowserThemeProvider).
220 gfx::ImageSkia* GetImageSkiaNamed(int id, bool incognito) const; 234 gfx::ImageSkia* GetImageSkiaNamed(int id, bool incognito) const;
221 SkColor GetColor(int id, bool incognito) const; 235 SkColor GetColor(int id, bool incognito) const;
222 int GetDisplayProperty(int id) const; 236 int GetDisplayProperty(int id) const;
223 base::RefCountedMemory* GetRawData(int id, 237 base::RefCountedMemory* GetRawData(int id,
224 ui::ScaleFactor scale_factor) const; 238 ui::ScaleFactor scale_factor) const;
225 #if defined(OS_MACOSX) 239 #if defined(OS_MACOSX)
226 NSImage* GetNSImageNamed(int id, bool incognito) const; 240 NSImage* GetNSImageNamed(int id, bool incognito) const;
227 NSColor* GetNSImageColorNamed(int id, bool incognito) const; 241 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 302 // 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 303 // 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. 304 // 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 305 // |pending_install_id_| should be set to |kDefaultThemeID| if there are no
292 // recently installed theme extensions 306 // recently installed theme extensions
293 std::string installed_pending_load_id_; 307 std::string installed_pending_load_id_;
294 308
295 // The number of infobars currently displayed. 309 // The number of infobars currently displayed.
296 int number_of_infobars_; 310 int number_of_infobars_;
297 311
312 // A cache of already-computed values for COLOR_TOOLBAR_TOP_SEPARATOR, which
313 // can be expensive to compute.
314 mutable SeparatorColorCache separator_color_cache_;
315
298 content::NotificationRegistrar registrar_; 316 content::NotificationRegistrar registrar_;
299 317
300 scoped_ptr<ThemeSyncableService> theme_syncable_service_; 318 scoped_ptr<ThemeSyncableService> theme_syncable_service_;
301 319
302 #if defined(ENABLE_EXTENSIONS) 320 #if defined(ENABLE_EXTENSIONS)
303 class ThemeObserver; 321 class ThemeObserver;
304 scoped_ptr<ThemeObserver> theme_observer_; 322 scoped_ptr<ThemeObserver> theme_observer_;
305 #endif 323 #endif
306 324
307 BrowserThemeProvider original_theme_provider_; 325 BrowserThemeProvider original_theme_provider_;
308 BrowserThemeProvider incognito_theme_provider_; 326 BrowserThemeProvider incognito_theme_provider_;
309 327
310 base::WeakPtrFactory<ThemeService> weak_ptr_factory_; 328 base::WeakPtrFactory<ThemeService> weak_ptr_factory_;
311 329
312 DISALLOW_COPY_AND_ASSIGN(ThemeService); 330 DISALLOW_COPY_AND_ASSIGN(ThemeService);
313 }; 331 };
314 332
315 #endif // CHROME_BROWSER_THEMES_THEME_SERVICE_H_ 333 #endif // CHROME_BROWSER_THEMES_THEME_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/themes/theme_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698