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 #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 Loading... |
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 |
218 // These methods provide the implementation for ui::ThemeProvider (exposed | 222 // These methods provide the implementation for ui::ThemeProvider (exposed |
219 // via BrowserThemeProvider). | 223 // via BrowserThemeProvider). |
220 gfx::ImageSkia* GetImageSkiaNamed(int id, bool incognito) const; | 224 gfx::ImageSkia* GetImageSkiaNamed(int id, bool incognito) const; |
221 SkColor GetColor(int id, bool incognito) const; | 225 SkColor GetColor(int id, bool incognito) const; |
222 int GetDisplayProperty(int id) const; | 226 int GetDisplayProperty(int id) const; |
223 base::RefCountedMemory* GetRawData(int id, | 227 base::RefCountedMemory* GetRawData(int id, |
224 ui::ScaleFactor scale_factor) const; | 228 ui::ScaleFactor scale_factor) const; |
225 #if defined(OS_MACOSX) | 229 #if defined(OS_MACOSX) |
226 NSImage* GetNSImageNamed(int id, bool incognito) const; | 230 NSImage* GetNSImageNamed(int id, bool incognito) const; |
227 NSColor* GetNSImageColorNamed(int id, bool incognito) const; | 231 NSColor* GetNSImageColorNamed(int id, bool incognito) const; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 // The id of the theme extension which has just been installed but has not | 292 // 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 | 293 // 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. | 294 // 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 | 295 // |pending_install_id_| should be set to |kDefaultThemeID| if there are no |
292 // recently installed theme extensions | 296 // recently installed theme extensions |
293 std::string installed_pending_load_id_; | 297 std::string installed_pending_load_id_; |
294 | 298 |
295 // The number of infobars currently displayed. | 299 // The number of infobars currently displayed. |
296 int number_of_infobars_; | 300 int number_of_infobars_; |
297 | 301 |
| 302 // A cache of already-computed values for COLOR_TOOLBAR_TOP_SEPARATOR, which |
| 303 // can be expensive to compute. |
| 304 mutable SeparatorColorCache separator_color_cache_; |
| 305 |
298 content::NotificationRegistrar registrar_; | 306 content::NotificationRegistrar registrar_; |
299 | 307 |
300 scoped_ptr<ThemeSyncableService> theme_syncable_service_; | 308 scoped_ptr<ThemeSyncableService> theme_syncable_service_; |
301 | 309 |
302 #if defined(ENABLE_EXTENSIONS) | 310 #if defined(ENABLE_EXTENSIONS) |
303 class ThemeObserver; | 311 class ThemeObserver; |
304 scoped_ptr<ThemeObserver> theme_observer_; | 312 scoped_ptr<ThemeObserver> theme_observer_; |
305 #endif | 313 #endif |
306 | 314 |
307 BrowserThemeProvider original_theme_provider_; | 315 BrowserThemeProvider original_theme_provider_; |
308 BrowserThemeProvider incognito_theme_provider_; | 316 BrowserThemeProvider incognito_theme_provider_; |
309 | 317 |
310 base::WeakPtrFactory<ThemeService> weak_ptr_factory_; | 318 base::WeakPtrFactory<ThemeService> weak_ptr_factory_; |
311 | 319 |
312 DISALLOW_COPY_AND_ASSIGN(ThemeService); | 320 DISALLOW_COPY_AND_ASSIGN(ThemeService); |
313 }; | 321 }; |
314 | 322 |
315 #endif // CHROME_BROWSER_THEMES_THEME_SERVICE_H_ | 323 #endif // CHROME_BROWSER_THEMES_THEME_SERVICE_H_ |
OLD | NEW |