| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 // True if the theme service is ready to be used. | 168 // True if the theme service is ready to be used. |
| 169 // TODO(pkotwicz): Add DCHECKS to the theme service's getters once | 169 // TODO(pkotwicz): Add DCHECKS to the theme service's getters once |
| 170 // ThemeSource no longer uses the ThemeService when it is not ready. | 170 // ThemeSource no longer uses the ThemeService when it is not ready. |
| 171 bool ready_; | 171 bool ready_; |
| 172 | 172 |
| 173 private: | 173 private: |
| 174 // This class implements ui::ThemeProvider on behalf of ThemeService and keeps | 174 // This class implements ui::ThemeProvider on behalf of ThemeService and keeps |
| 175 // track of the incognito state of the calling code. | 175 // track of the incognito state of the calling code. |
| 176 class BrowserThemeProvider : public ui::ThemeProvider { | 176 class BrowserThemeProvider : public ui::ThemeProvider { |
| 177 public: | 177 public: |
| 178 BrowserThemeProvider(const ThemeService& theme_service, | 178 BrowserThemeProvider(const ThemeService& theme_service, bool incognito); |
| 179 bool off_the_record); | |
| 180 ~BrowserThemeProvider() override; | 179 ~BrowserThemeProvider() override; |
| 181 | 180 |
| 182 // Overridden from ui::ThemeProvider: | 181 // Overridden from ui::ThemeProvider: |
| 183 gfx::ImageSkia* GetImageSkiaNamed(int id) const override; | 182 gfx::ImageSkia* GetImageSkiaNamed(int id) const override; |
| 184 SkColor GetColor(int original_id) const override; | 183 SkColor GetColor(int original_id) const override; |
| 185 int GetDisplayProperty(int id) const override; | 184 int GetDisplayProperty(int id) const override; |
| 186 bool ShouldUseNativeFrame() const override; | 185 bool ShouldUseNativeFrame() const override; |
| 187 bool HasCustomImage(int id) const override; | 186 bool HasCustomImage(int id) const override; |
| 188 base::RefCountedMemory* GetRawData(int id, ui::ScaleFactor scale_factor) | 187 base::RefCountedMemory* GetRawData(int id, ui::ScaleFactor scale_factor) |
| 189 const override; | 188 const override; |
| 190 #if defined(OS_MACOSX) | 189 #if defined(OS_MACOSX) |
| 191 bool UsingSystemTheme() const override; | 190 bool UsingSystemTheme() const override; |
| 192 NSImage* GetNSImageNamed(int id) const override; | 191 NSImage* GetNSImageNamed(int id) const override; |
| 193 NSColor* GetNSImageColorNamed(int id) const override; | 192 NSColor* GetNSImageColorNamed(int id) const override; |
| 194 NSColor* GetNSColor(int id) const override; | 193 NSColor* GetNSColor(int id) const override; |
| 195 NSColor* GetNSColorTint(int id) const override; | 194 NSColor* GetNSColorTint(int id) const override; |
| 196 NSGradient* GetNSGradient(int id) const override; | 195 NSGradient* GetNSGradient(int id) const override; |
| 197 #endif | 196 #endif |
| 198 | 197 |
| 199 private: | 198 private: |
| 200 const ThemeService& theme_service_; | 199 const ThemeService& theme_service_; |
| 201 bool off_the_record_; | 200 bool incognito_; |
| 202 | 201 |
| 203 DISALLOW_COPY_AND_ASSIGN(BrowserThemeProvider); | 202 DISALLOW_COPY_AND_ASSIGN(BrowserThemeProvider); |
| 204 }; | 203 }; |
| 205 friend class BrowserThemeProvider; | 204 friend class BrowserThemeProvider; |
| 206 friend class theme_service_internal::ThemeServiceTest; | 205 friend class theme_service_internal::ThemeServiceTest; |
| 207 | 206 |
| 208 const ui::ThemeProvider& GetOrCreateThemeProviderForProfile(Profile* profile); | 207 const ui::ThemeProvider& GetOrCreateThemeProviderForProfile(Profile* profile); |
| 209 | 208 |
| 210 // These methods provide the implementation for ui::ThemeProvider (exposed | 209 // These methods provide the implementation for ui::ThemeProvider (exposed |
| 211 // via BrowserThemeProvider). | 210 // via BrowserThemeProvider). |
| 212 gfx::ImageSkia* GetImageSkiaNamed(int id) const; | 211 gfx::ImageSkia* GetImageSkiaNamed(int id) const; |
| 213 SkColor GetColor(int id, bool off_the_record) const; | 212 SkColor GetColor(int id, bool incognito) const; |
| 214 int GetDisplayProperty(int id) const; | 213 int GetDisplayProperty(int id) const; |
| 215 bool ShouldUseNativeFrame() const; | 214 bool ShouldUseNativeFrame() const; |
| 216 bool HasCustomImage(int id) const; | 215 bool HasCustomImage(int id) const; |
| 217 base::RefCountedMemory* GetRawData(int id, | 216 base::RefCountedMemory* GetRawData(int id, |
| 218 ui::ScaleFactor scale_factor) const; | 217 ui::ScaleFactor scale_factor) const; |
| 219 #if defined(OS_MACOSX) | 218 #if defined(OS_MACOSX) |
| 220 NSImage* GetNSImageNamed(int id) const; | 219 NSImage* GetNSImageNamed(int id) const; |
| 221 NSColor* GetNSImageColorNamed(int id) const; | 220 NSColor* GetNSImageColorNamed(int id) const; |
| 222 NSColor* GetNSColor(int id) const; | 221 NSColor* GetNSColor(int id) const; |
| 223 NSColor* GetNSColorTint(int id) const; | 222 NSColor* GetNSColorTint(int id) const; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 | 298 |
| 300 BrowserThemeProvider original_theme_provider_; | 299 BrowserThemeProvider original_theme_provider_; |
| 301 BrowserThemeProvider otr_theme_provider_; | 300 BrowserThemeProvider otr_theme_provider_; |
| 302 | 301 |
| 303 base::WeakPtrFactory<ThemeService> weak_ptr_factory_; | 302 base::WeakPtrFactory<ThemeService> weak_ptr_factory_; |
| 304 | 303 |
| 305 DISALLOW_COPY_AND_ASSIGN(ThemeService); | 304 DISALLOW_COPY_AND_ASSIGN(ThemeService); |
| 306 }; | 305 }; |
| 307 | 306 |
| 308 #endif // CHROME_BROWSER_THEMES_THEME_SERVICE_H_ | 307 #endif // CHROME_BROWSER_THEMES_THEME_SERVICE_H_ |
| OLD | NEW |