| 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 #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/memory/ref_counted_memory.h" | 8 #include "base/memory/ref_counted_memory.h" |
| 9 #include "base/string_split.h" | 9 #include "base/string_split.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 bool ThemeService::HasCustomImage(int id) const { | 329 bool ThemeService::HasCustomImage(int id) const { |
| 330 if (!HasThemeableImage(id)) | 330 if (!HasThemeableImage(id)) |
| 331 return false; | 331 return false; |
| 332 | 332 |
| 333 if (theme_pack_) | 333 if (theme_pack_) |
| 334 return theme_pack_->HasCustomImage(id); | 334 return theme_pack_->HasCustomImage(id); |
| 335 | 335 |
| 336 return false; | 336 return false; |
| 337 } | 337 } |
| 338 | 338 |
| 339 base::RefCountedMemory* ThemeService::GetRawData(int id) const { | 339 base::RefCountedMemory* ThemeService::GetRawData( |
| 340 int id, |
| 341 ui::ScaleFactor scale_factor) const { |
| 340 // Check to see whether we should substitute some images. | 342 // Check to see whether we should substitute some images. |
| 341 int ntp_alternate; | 343 int ntp_alternate; |
| 342 GetDisplayProperty(NTP_LOGO_ALTERNATE, &ntp_alternate); | 344 GetDisplayProperty(NTP_LOGO_ALTERNATE, &ntp_alternate); |
| 343 if (id == IDR_PRODUCT_LOGO && ntp_alternate != 0) | 345 if (id == IDR_PRODUCT_LOGO && ntp_alternate != 0) |
| 344 id = IDR_PRODUCT_LOGO_WHITE; | 346 id = IDR_PRODUCT_LOGO_WHITE; |
| 345 | 347 |
| 346 base::RefCountedMemory* data = NULL; | 348 base::RefCountedMemory* data = NULL; |
| 347 if (theme_pack_.get()) | 349 if (theme_pack_.get()) |
| 348 data = theme_pack_->GetRawData(id); | 350 data = theme_pack_->GetRawData(id, scale_factor); |
| 349 if (!data) | 351 if (!data) |
| 350 data = rb_.LoadDataResourceBytes(id, ui::SCALE_FACTOR_100P); | 352 data = rb_.LoadDataResourceBytes(id, ui::SCALE_FACTOR_100P); |
| 351 | 353 |
| 352 return data; | 354 return data; |
| 353 } | 355 } |
| 354 | 356 |
| 355 void ThemeService::SetTheme(const Extension* extension) { | 357 void ThemeService::SetTheme(const Extension* extension) { |
| 356 // Clear our image cache. | 358 // Clear our image cache. |
| 357 FreePlatformCaches(); | 359 FreePlatformCaches(); |
| 358 | 360 |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 void ThemeService::OnInfobarDisplayed() { | 713 void ThemeService::OnInfobarDisplayed() { |
| 712 number_of_infobars_++; | 714 number_of_infobars_++; |
| 713 } | 715 } |
| 714 | 716 |
| 715 void ThemeService::OnInfobarDestroyed() { | 717 void ThemeService::OnInfobarDestroyed() { |
| 716 number_of_infobars_--; | 718 number_of_infobars_--; |
| 717 | 719 |
| 718 if (number_of_infobars_ == 0) | 720 if (number_of_infobars_ == 0) |
| 719 RemoveUnusedThemes(); | 721 RemoveUnusedThemes(); |
| 720 } | 722 } |
| OLD | NEW |