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 "ui/base/resource/resource_bundle.h" | 5 #include "ui/base/resource/resource_bundle.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/big_endian.h" | 10 #include "base/big_endian.h" |
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 new DataPack(scale_factor)); | 655 new DataPack(scale_factor)); |
656 if (data_pack->LoadFromPath(pack_path)) { | 656 if (data_pack->LoadFromPath(pack_path)) { |
657 AddDataPack(data_pack.release()); | 657 AddDataPack(data_pack.release()); |
658 } else if (!optional) { | 658 } else if (!optional) { |
659 LOG(ERROR) << "Failed to load " << pack_path.value() | 659 LOG(ERROR) << "Failed to load " << pack_path.value() |
660 << "\nSome features may not be available."; | 660 << "\nSome features may not be available."; |
661 } | 661 } |
662 } | 662 } |
663 | 663 |
664 void ResourceBundle::AddDataPack(DataPack* data_pack) { | 664 void ResourceBundle::AddDataPack(DataPack* data_pack) { |
| 665 #if DCHECK_IS_ON() |
| 666 data_pack->CheckForDuplicateResources(data_packs_); |
| 667 #endif |
665 data_packs_.push_back(data_pack); | 668 data_packs_.push_back(data_pack); |
666 | 669 |
667 if (GetScaleForScaleFactor(data_pack->GetScaleFactor()) > | 670 if (GetScaleForScaleFactor(data_pack->GetScaleFactor()) > |
668 GetScaleForScaleFactor(max_scale_factor_)) | 671 GetScaleForScaleFactor(max_scale_factor_)) |
669 max_scale_factor_ = data_pack->GetScaleFactor(); | 672 max_scale_factor_ = data_pack->GetScaleFactor(); |
670 } | 673 } |
671 | 674 |
672 void ResourceBundle::InitDefaultFontList() { | 675 void ResourceBundle::InitDefaultFontList() { |
673 #if defined(OS_CHROMEOS) | 676 #if defined(OS_CHROMEOS) |
674 std::string font_family = base::UTF16ToUTF8( | 677 std::string font_family = base::UTF16ToUTF8( |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 // static | 857 // static |
855 bool ResourceBundle::DecodePNG(const unsigned char* buf, | 858 bool ResourceBundle::DecodePNG(const unsigned char* buf, |
856 size_t size, | 859 size_t size, |
857 SkBitmap* bitmap, | 860 SkBitmap* bitmap, |
858 bool* fell_back_to_1x) { | 861 bool* fell_back_to_1x) { |
859 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); | 862 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); |
860 return gfx::PNGCodec::Decode(buf, size, bitmap); | 863 return gfx::PNGCodec::Decode(buf, size, bitmap); |
861 } | 864 } |
862 | 865 |
863 } // namespace ui | 866 } // namespace ui |
OLD | NEW |