| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/themes/theme_service.h" | 5 #include "chrome/browser/themes/theme_service.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/string_split.h" | 8 #include "base/string_split.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 // the extension cannot yet be found via GetExtensionById() if it is | 213 // the extension cannot yet be found via GetExtensionById() if it is |
| 214 // installed but not loaded (which may confuse listeners to | 214 // installed but not loaded (which may confuse listeners to |
| 215 // BROWSER_THEME_CHANGED). | 215 // BROWSER_THEME_CHANGED). |
| 216 registrar_.Add(this, | 216 registrar_.Add(this, |
| 217 chrome::NOTIFICATION_EXTENSION_LOADED, | 217 chrome::NOTIFICATION_EXTENSION_LOADED, |
| 218 content::Source<Profile>(profile_)); | 218 content::Source<Profile>(profile_)); |
| 219 | 219 |
| 220 LoadThemePrefs(); | 220 LoadThemePrefs(); |
| 221 } | 221 } |
| 222 | 222 |
| 223 const gfx::Image* ThemeService::GetImageNamed(int id) const { |
| 224 DCHECK(CalledOnValidThread()); |
| 225 |
| 226 const gfx::Image* image = NULL; |
| 227 |
| 228 if (theme_pack_.get()) |
| 229 image = theme_pack_->GetImageNamed(id); |
| 230 |
| 231 if (!image) |
| 232 image = &rb_.GetNativeImageNamed(id); |
| 233 |
| 234 return image; |
| 235 } |
| 236 |
| 223 SkBitmap* ThemeService::GetBitmapNamed(int id) const { | 237 SkBitmap* ThemeService::GetBitmapNamed(int id) const { |
| 224 DCHECK(CalledOnValidThread()); | 238 DCHECK(CalledOnValidThread()); |
| 225 | 239 |
| 226 SkBitmap* bitmap = NULL; | 240 SkBitmap* bitmap = NULL; |
| 227 | 241 |
| 228 if (theme_pack_.get()) | 242 if (theme_pack_.get()) |
| 229 bitmap = theme_pack_->GetBitmapNamed(id); | 243 bitmap = theme_pack_->GetBitmapNamed(id); |
| 230 | 244 |
| 231 if (!bitmap) | 245 if (!bitmap) |
| 232 bitmap = rb_.GetBitmapNamed(id); | 246 bitmap = rb_.GetBitmapNamed(id); |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 void ThemeService::OnInfobarDisplayed() { | 669 void ThemeService::OnInfobarDisplayed() { |
| 656 number_of_infobars_++; | 670 number_of_infobars_++; |
| 657 } | 671 } |
| 658 | 672 |
| 659 void ThemeService::OnInfobarDestroyed() { | 673 void ThemeService::OnInfobarDestroyed() { |
| 660 number_of_infobars_--; | 674 number_of_infobars_--; |
| 661 | 675 |
| 662 if (number_of_infobars_ == 0) | 676 if (number_of_infobars_ == 0) |
| 663 RemoveUnusedThemes(); | 677 RemoveUnusedThemes(); |
| 664 } | 678 } |
| OLD | NEW |