| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 return std::string(); | 282 return std::string(); |
| 283 } | 283 } |
| 284 | 284 |
| 285 locale_resources_data_.reset(data_pack.release()); | 285 locale_resources_data_.reset(data_pack.release()); |
| 286 return app_locale; | 286 return app_locale; |
| 287 } | 287 } |
| 288 | 288 |
| 289 void ResourceBundle::LoadTestResources(const base::FilePath& path, | 289 void ResourceBundle::LoadTestResources(const base::FilePath& path, |
| 290 const base::FilePath& locale_path) { | 290 const base::FilePath& locale_path) { |
| 291 // Use the given resource pak for both common and localized resources. | 291 // Use the given resource pak for both common and localized resources. |
| 292 scoped_ptr<DataPack> data_pack( | 292 scoped_ptr<DataPack> data_pack(new DataPack(SCALE_FACTOR_100P)); |
| 293 new DataPack(SCALE_FACTOR_100P)); | |
| 294 if (!path.empty() && data_pack->LoadFromPath(path)) | 293 if (!path.empty() && data_pack->LoadFromPath(path)) |
| 295 AddDataPack(data_pack.release()); | 294 AddDataPack(data_pack.release()); |
| 296 | 295 |
| 297 data_pack.reset(new DataPack(ui::SCALE_FACTOR_NONE)); | 296 data_pack.reset(new DataPack(ui::SCALE_FACTOR_NONE)); |
| 298 if (!locale_path.empty() && data_pack->LoadFromPath(locale_path)) { | 297 if (!locale_path.empty() && data_pack->LoadFromPath(locale_path)) { |
| 299 locale_resources_data_.reset(data_pack.release()); | 298 locale_resources_data_.reset(data_pack.release()); |
| 300 } else { | 299 } else { |
| 301 locale_resources_data_.reset( | 300 locale_resources_data_.reset(new DataPack(ui::SCALE_FACTOR_NONE)); |
| 302 new DataPack(ui::SCALE_FACTOR_NONE)); | |
| 303 } | 301 } |
| 304 } | 302 } |
| 305 | 303 |
| 306 void ResourceBundle::UnloadLocaleResources() { | 304 void ResourceBundle::UnloadLocaleResources() { |
| 307 locale_resources_data_.reset(); | 305 locale_resources_data_.reset(); |
| 308 } | 306 } |
| 309 | 307 |
| 310 void ResourceBundle::OverrideLocalePakForTest(const base::FilePath& pak_path) { | 308 void ResourceBundle::OverrideLocalePakForTest(const base::FilePath& pak_path) { |
| 311 overridden_pak_path_ = pak_path; | 309 overridden_pak_path_ = pak_path; |
| 312 } | 310 } |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 // static | 794 // static |
| 797 bool ResourceBundle::DecodePNG(const unsigned char* buf, | 795 bool ResourceBundle::DecodePNG(const unsigned char* buf, |
| 798 size_t size, | 796 size_t size, |
| 799 SkBitmap* bitmap, | 797 SkBitmap* bitmap, |
| 800 bool* fell_back_to_1x) { | 798 bool* fell_back_to_1x) { |
| 801 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); | 799 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); |
| 802 return gfx::PNGCodec::Decode(buf, size, bitmap); | 800 return gfx::PNGCodec::Decode(buf, size, bitmap); |
| 803 } | 801 } |
| 804 | 802 |
| 805 } // namespace ui | 803 } // namespace ui |
| OLD | NEW |