| 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/browser_theme_pack.h" | 5 #include "chrome/browser/themes/browser_theme_pack.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
| 10 #include "base/memory/ref_counted_memory.h" | 10 #include "base/memory/ref_counted_memory.h" |
| (...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 | 772 |
| 773 if (!InputScalesValid(pointer, pack->scale_factors_)) { | 773 if (!InputScalesValid(pointer, pack->scale_factors_)) { |
| 774 DLOG(ERROR) << "BuildFromDataPack failure! The pack scale factors differ " | 774 DLOG(ERROR) << "BuildFromDataPack failure! The pack scale factors differ " |
| 775 << "from those supported by platform."; | 775 << "from those supported by platform."; |
| 776 return NULL; | 776 return NULL; |
| 777 } | 777 } |
| 778 return pack; | 778 return pack; |
| 779 } | 779 } |
| 780 | 780 |
| 781 // static | 781 // static |
| 782 void BrowserThemePack::GetThemeableImageIDRs(std::set<int>* result) { | 782 bool BrowserThemePack::IsThemeableImageIDRs(int id) { |
| 783 if (!result) | |
| 784 return; | |
| 785 | |
| 786 result->clear(); | |
| 787 for (size_t i = 0; i < kPersistingImagesLength; ++i) | 783 for (size_t i = 0; i < kPersistingImagesLength; ++i) |
| 788 result->insert(kPersistingImages[i].idr_id); | 784 if (kPersistingImages[i].idr_id == id) |
| 785 return true; |
| 789 | 786 |
| 790 #if defined(USE_ASH) && !defined(OS_CHROMEOS) | 787 #if defined(USE_ASH) && !defined(OS_CHROMEOS) |
| 791 for (size_t i = 0; i < kPersistingImagesDesktopAuraLength; ++i) | 788 for (size_t i = 0; i < kPersistingImagesDesktopAuraLength; ++i) |
| 792 result->insert(kPersistingImagesDesktopAura[i].idr_id); | 789 if (kPersistingImagesDesktopAura[i].idr_id == id) |
| 790 return true; |
| 793 #endif | 791 #endif |
| 792 |
| 793 return false; |
| 794 } | 794 } |
| 795 | 795 |
| 796 bool BrowserThemePack::WriteToDisk(const base::FilePath& path) const { | 796 bool BrowserThemePack::WriteToDisk(const base::FilePath& path) const { |
| 797 // Add resources for each of the property arrays. | 797 // Add resources for each of the property arrays. |
| 798 RawDataForWriting resources; | 798 RawDataForWriting resources; |
| 799 resources[kHeaderID] = base::StringPiece( | 799 resources[kHeaderID] = base::StringPiece( |
| 800 reinterpret_cast<const char*>(header_), sizeof(BrowserThemePackHeader)); | 800 reinterpret_cast<const char*>(header_), sizeof(BrowserThemePackHeader)); |
| 801 resources[kTintsID] = base::StringPiece( | 801 resources[kTintsID] = base::StringPiece( |
| 802 reinterpret_cast<const char*>(tints_), | 802 reinterpret_cast<const char*>(tints_), |
| 803 sizeof(TintEntry[kTintTableLength])); | 803 sizeof(TintEntry[kTintTableLength])); |
| (...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1629 false, | 1629 false, |
| 1630 &bitmap_data)) { | 1630 &bitmap_data)) { |
| 1631 NOTREACHED() << "Unable to encode theme image for prs_id=" | 1631 NOTREACHED() << "Unable to encode theme image for prs_id=" |
| 1632 << prs_id << " for scale_factor=" << scale_factors_[i]; | 1632 << prs_id << " for scale_factor=" << scale_factors_[i]; |
| 1633 break; | 1633 break; |
| 1634 } | 1634 } |
| 1635 image_memory_[scaled_raw_id] = | 1635 image_memory_[scaled_raw_id] = |
| 1636 base::RefCountedBytes::TakeVector(&bitmap_data); | 1636 base::RefCountedBytes::TakeVector(&bitmap_data); |
| 1637 } | 1637 } |
| 1638 } | 1638 } |
| OLD | NEW |