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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 // static | 167 // static |
168 std::string ResourceBundle::InitSharedInstanceLocaleOnly( | 168 std::string ResourceBundle::InitSharedInstanceLocaleOnly( |
169 const std::string& pref_locale, Delegate* delegate) { | 169 const std::string& pref_locale, Delegate* delegate) { |
170 InitSharedInstance(delegate); | 170 InitSharedInstance(delegate); |
171 std::string result = g_shared_instance_->LoadLocaleResources(pref_locale); | 171 std::string result = g_shared_instance_->LoadLocaleResources(pref_locale); |
172 InitDefaultFontList(); | 172 InitDefaultFontList(); |
173 return result; | 173 return result; |
174 } | 174 } |
175 | 175 |
176 // static | 176 // static |
177 void ResourceBundle::InitSharedInstanceWithPakFile( | 177 void ResourceBundle::InitSharedInstanceWithPakFileRegion( |
178 base::File pak_file, bool should_load_common_resources) { | 178 base::File pak_file, |
| 179 const base::MemoryMappedFile::Region& region, |
| 180 bool should_load_common_resources) { |
179 InitSharedInstance(NULL); | 181 InitSharedInstance(NULL); |
180 if (should_load_common_resources) | 182 if (should_load_common_resources) |
181 g_shared_instance_->LoadCommonResources(); | 183 g_shared_instance_->LoadCommonResources(); |
182 | 184 |
183 scoped_ptr<DataPack> data_pack( | 185 scoped_ptr<DataPack> data_pack( |
184 new DataPack(SCALE_FACTOR_100P)); | 186 new DataPack(SCALE_FACTOR_100P)); |
185 if (!data_pack->LoadFromFile(pak_file.Pass())) { | 187 if (!data_pack->LoadFromFileRegion(pak_file.Pass(), region)) { |
186 NOTREACHED() << "failed to load pak file"; | 188 NOTREACHED() << "failed to load pak file"; |
187 return; | 189 return; |
188 } | 190 } |
189 g_shared_instance_->locale_resources_data_.reset(data_pack.release()); | 191 g_shared_instance_->locale_resources_data_.reset(data_pack.release()); |
190 InitDefaultFontList(); | 192 InitDefaultFontList(); |
191 } | 193 } |
192 | 194 |
193 // static | 195 // static |
194 void ResourceBundle::InitSharedInstanceWithPakPath(const base::FilePath& path) { | 196 void ResourceBundle::InitSharedInstanceWithPakPath(const base::FilePath& path) { |
195 InitSharedInstance(NULL); | 197 InitSharedInstance(NULL); |
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
841 // static | 843 // static |
842 bool ResourceBundle::DecodePNG(const unsigned char* buf, | 844 bool ResourceBundle::DecodePNG(const unsigned char* buf, |
843 size_t size, | 845 size_t size, |
844 SkBitmap* bitmap, | 846 SkBitmap* bitmap, |
845 bool* fell_back_to_1x) { | 847 bool* fell_back_to_1x) { |
846 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); | 848 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); |
847 return gfx::PNGCodec::Decode(buf, size, bitmap); | 849 return gfx::PNGCodec::Decode(buf, size, bitmap); |
848 } | 850 } |
849 | 851 |
850 } // namespace ui | 852 } // namespace ui |
OLD | NEW |