| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <utility> | 10 #include <utility> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/big_endian.h" | 13 #include "base/big_endian.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/files/file.h" | 15 #include "base/files/file.h" |
| 16 #include "base/files/file_util.h" | 16 #include "base/files/file_util.h" |
| 17 #include "base/logging.h" | 17 #include "base/logging.h" |
| 18 #include "base/macros.h" | 18 #include "base/macros.h" |
| 19 #include "base/memory/ref_counted_memory.h" | 19 #include "base/memory/ref_counted_memory.h" |
| 20 #include "base/metrics/histogram_macros.h" | |
| 21 #include "base/path_service.h" | 20 #include "base/path_service.h" |
| 22 #include "base/stl_util.h" | 21 #include "base/stl_util.h" |
| 23 #include "base/strings/string_piece.h" | 22 #include "base/strings/string_piece.h" |
| 24 #include "base/strings/utf_string_conversions.h" | 23 #include "base/strings/utf_string_conversions.h" |
| 25 #include "base/synchronization/lock.h" | 24 #include "base/synchronization/lock.h" |
| 26 #include "build/build_config.h" | 25 #include "build/build_config.h" |
| 27 #include "skia/ext/image_operations.h" | 26 #include "skia/ext/image_operations.h" |
| 28 #include "third_party/skia/include/core/SkBitmap.h" | 27 #include "third_party/skia/include/core/SkBitmap.h" |
| 29 #include "third_party/skia/include/core/SkColor.h" | 28 #include "third_party/skia/include/core/SkColor.h" |
| 30 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 locale_file_path = GetLocaleFilePath(app_locale, true); | 324 locale_file_path = GetLocaleFilePath(app_locale, true); |
| 326 | 325 |
| 327 if (locale_file_path.empty()) { | 326 if (locale_file_path.empty()) { |
| 328 // It's possible that there is no locale.pak. | 327 // It's possible that there is no locale.pak. |
| 329 LOG(WARNING) << "locale_file_path.empty() for locale " << app_locale; | 328 LOG(WARNING) << "locale_file_path.empty() for locale " << app_locale; |
| 330 return std::string(); | 329 return std::string(); |
| 331 } | 330 } |
| 332 | 331 |
| 333 std::unique_ptr<DataPack> data_pack(new DataPack(SCALE_FACTOR_100P)); | 332 std::unique_ptr<DataPack> data_pack(new DataPack(SCALE_FACTOR_100P)); |
| 334 if (!data_pack->LoadFromPath(locale_file_path)) { | 333 if (!data_pack->LoadFromPath(locale_file_path)) { |
| 335 UMA_HISTOGRAM_ENUMERATION("ResourceBundle.LoadLocaleResourcesError", | |
| 336 logging::GetLastSystemErrorCode(), 16000); | |
| 337 LOG(ERROR) << "failed to load locale.pak"; | 334 LOG(ERROR) << "failed to load locale.pak"; |
| 338 NOTREACHED(); | 335 NOTREACHED(); |
| 339 return std::string(); | 336 return std::string(); |
| 340 } | 337 } |
| 341 | 338 |
| 342 locale_resources_data_.reset(data_pack.release()); | 339 locale_resources_data_.reset(data_pack.release()); |
| 343 return app_locale; | 340 return app_locale; |
| 344 } | 341 } |
| 345 #endif // defined(OS_ANDROID) | 342 #endif // defined(OS_ANDROID) |
| 346 | 343 |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 // static | 885 // static |
| 889 bool ResourceBundle::DecodePNG(const unsigned char* buf, | 886 bool ResourceBundle::DecodePNG(const unsigned char* buf, |
| 890 size_t size, | 887 size_t size, |
| 891 SkBitmap* bitmap, | 888 SkBitmap* bitmap, |
| 892 bool* fell_back_to_1x) { | 889 bool* fell_back_to_1x) { |
| 893 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); | 890 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); |
| 894 return gfx::PNGCodec::Decode(buf, size, bitmap); | 891 return gfx::PNGCodec::Decode(buf, size, bitmap); |
| 895 } | 892 } |
| 896 | 893 |
| 897 } // namespace ui | 894 } // namespace ui |
| OLD | NEW |