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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 const std::string& pref_locale, Delegate* delegate) { | 177 const std::string& pref_locale, Delegate* delegate) { |
178 InitSharedInstance(delegate); | 178 InitSharedInstance(delegate); |
179 std::string result = g_shared_instance_->LoadLocaleResources(pref_locale); | 179 std::string result = g_shared_instance_->LoadLocaleResources(pref_locale); |
180 InitDefaultFontList(); | 180 InitDefaultFontList(); |
181 return result; | 181 return result; |
182 } | 182 } |
183 | 183 |
184 // static | 184 // static |
185 void ResourceBundle::InitSharedInstanceWithPakFileRegion( | 185 void ResourceBundle::InitSharedInstanceWithPakFileRegion( |
186 base::File pak_file, | 186 base::File pak_file, |
187 const base::MemoryMappedFile::Region& region, | 187 const base::MemoryMappedFile::Region& region) { |
188 bool should_load_common_resources) { | |
189 InitSharedInstance(NULL); | 188 InitSharedInstance(NULL); |
190 if (should_load_common_resources) | 189 scoped_ptr<DataPack> data_pack(new DataPack(SCALE_FACTOR_100P)); |
191 g_shared_instance_->LoadCommonResources(); | |
192 | |
193 scoped_ptr<DataPack> data_pack( | |
194 new DataPack(SCALE_FACTOR_100P)); | |
195 if (!data_pack->LoadFromFileRegion(pak_file.Pass(), region)) { | 190 if (!data_pack->LoadFromFileRegion(pak_file.Pass(), region)) { |
196 NOTREACHED() << "failed to load pak file"; | 191 NOTREACHED() << "failed to load pak file"; |
197 return; | 192 return; |
198 } | 193 } |
199 g_shared_instance_->locale_resources_data_.reset(data_pack.release()); | 194 g_shared_instance_->locale_resources_data_.reset(data_pack.release()); |
200 InitDefaultFontList(); | 195 InitDefaultFontList(); |
201 } | 196 } |
202 | 197 |
203 // static | 198 // static |
204 void ResourceBundle::InitSharedInstanceWithPakPath(const base::FilePath& path) { | 199 void ResourceBundle::InitSharedInstanceWithPakPath(const base::FilePath& path) { |
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
862 // static | 857 // static |
863 bool ResourceBundle::DecodePNG(const unsigned char* buf, | 858 bool ResourceBundle::DecodePNG(const unsigned char* buf, |
864 size_t size, | 859 size_t size, |
865 SkBitmap* bitmap, | 860 SkBitmap* bitmap, |
866 bool* fell_back_to_1x) { | 861 bool* fell_back_to_1x) { |
867 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); | 862 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); |
868 return gfx::PNGCodec::Decode(buf, size, bitmap); | 863 return gfx::PNGCodec::Decode(buf, size, bitmap); |
869 } | 864 } |
870 | 865 |
871 } // namespace ui | 866 } // namespace ui |
OLD | NEW |