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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 bool ThemeService::HasCustomImage(int id) const { | 302 bool ThemeService::HasCustomImage(int id) const { |
303 if (!HasThemeableImage(id)) | 303 if (!HasThemeableImage(id)) |
304 return false; | 304 return false; |
305 | 305 |
306 if (theme_pack_) | 306 if (theme_pack_) |
307 return theme_pack_->HasCustomImage(id); | 307 return theme_pack_->HasCustomImage(id); |
308 | 308 |
309 return false; | 309 return false; |
310 } | 310 } |
311 | 311 |
312 RefCountedMemory* ThemeService::GetRawData(int id) const { | 312 base::RefCountedMemory* ThemeService::GetRawData(int id) const { |
313 // Check to see whether we should substitute some images. | 313 // Check to see whether we should substitute some images. |
314 int ntp_alternate; | 314 int ntp_alternate; |
315 GetDisplayProperty(NTP_LOGO_ALTERNATE, &ntp_alternate); | 315 GetDisplayProperty(NTP_LOGO_ALTERNATE, &ntp_alternate); |
316 if (id == IDR_PRODUCT_LOGO && ntp_alternate != 0) | 316 if (id == IDR_PRODUCT_LOGO && ntp_alternate != 0) |
317 id = IDR_PRODUCT_LOGO_WHITE; | 317 id = IDR_PRODUCT_LOGO_WHITE; |
318 | 318 |
319 RefCountedMemory* data = NULL; | 319 base::RefCountedMemory* data = NULL; |
320 if (theme_pack_.get()) | 320 if (theme_pack_.get()) |
321 data = theme_pack_->GetRawData(id); | 321 data = theme_pack_->GetRawData(id); |
322 if (!data) | 322 if (!data) |
323 data = rb_.LoadDataResourceBytes(id); | 323 data = rb_.LoadDataResourceBytes(id); |
324 | 324 |
325 return data; | 325 return data; |
326 } | 326 } |
327 | 327 |
328 void ThemeService::SetTheme(const Extension* extension) { | 328 void ThemeService::SetTheme(const Extension* extension) { |
329 // Clear our image cache. | 329 // Clear our image cache. |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 void ThemeService::OnInfobarDisplayed() { | 676 void ThemeService::OnInfobarDisplayed() { |
677 number_of_infobars_++; | 677 number_of_infobars_++; |
678 } | 678 } |
679 | 679 |
680 void ThemeService::OnInfobarDestroyed() { | 680 void ThemeService::OnInfobarDestroyed() { |
681 number_of_infobars_--; | 681 number_of_infobars_--; |
682 | 682 |
683 if (number_of_infobars_ == 0) | 683 if (number_of_infobars_ == 0) |
684 RemoveUnusedThemes(); | 684 RemoveUnusedThemes(); |
685 } | 685 } |
OLD | NEW |