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