| 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 | |
| 237 SkBitmap* ThemeService::GetBitmapNamed(int id) const { | 223 SkBitmap* ThemeService::GetBitmapNamed(int id) const { |
| 238 DCHECK(CalledOnValidThread()); | 224 DCHECK(CalledOnValidThread()); |
| 239 | 225 |
| 240 SkBitmap* bitmap = NULL; | 226 SkBitmap* bitmap = NULL; |
| 241 | 227 |
| 242 if (theme_pack_.get()) | 228 if (theme_pack_.get()) |
| 243 bitmap = theme_pack_->GetBitmapNamed(id); | 229 bitmap = theme_pack_->GetBitmapNamed(id); |
| 244 | 230 |
| 245 if (!bitmap) | 231 if (!bitmap) |
| 246 bitmap = rb_.GetBitmapNamed(id); | 232 bitmap = rb_.GetBitmapNamed(id); |
| (...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 void ThemeService::OnInfobarDisplayed() { | 655 void ThemeService::OnInfobarDisplayed() { |
| 670 number_of_infobars_++; | 656 number_of_infobars_++; |
| 671 } | 657 } |
| 672 | 658 |
| 673 void ThemeService::OnInfobarDestroyed() { | 659 void ThemeService::OnInfobarDestroyed() { |
| 674 number_of_infobars_--; | 660 number_of_infobars_--; |
| 675 | 661 |
| 676 if (number_of_infobars_ == 0) | 662 if (number_of_infobars_ == 0) |
| 677 RemoveUnusedThemes(); | 663 RemoveUnusedThemes(); |
| 678 } | 664 } |
| OLD | NEW |