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/big_endian.h" | 9 #include "base/big_endian.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 | 251 |
252 return locale_file_path; | 252 return locale_file_path; |
253 } | 253 } |
254 #endif | 254 #endif |
255 | 255 |
256 std::string ResourceBundle::LoadLocaleResources( | 256 std::string ResourceBundle::LoadLocaleResources( |
257 const std::string& pref_locale) { | 257 const std::string& pref_locale) { |
258 DCHECK(!locale_resources_data_.get()) << "locale.pak already loaded"; | 258 DCHECK(!locale_resources_data_.get()) << "locale.pak already loaded"; |
259 std::string app_locale = l10n_util::GetApplicationLocale(pref_locale); | 259 std::string app_locale = l10n_util::GetApplicationLocale(pref_locale); |
260 base::FilePath locale_file_path = GetOverriddenPakPath(); | 260 base::FilePath locale_file_path = GetOverriddenPakPath(); |
261 if (locale_file_path.empty()) { | 261 if (locale_file_path.empty()) |
262 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 262 locale_file_path = GetLocaleFilePath(app_locale, true); |
263 if (command_line->HasSwitch(switches::kLocalePak)) { | |
264 locale_file_path = | |
265 command_line->GetSwitchValuePath(switches::kLocalePak); | |
266 } else { | |
267 locale_file_path = GetLocaleFilePath(app_locale, true); | |
268 } | |
269 } | |
270 | 263 |
271 if (locale_file_path.empty()) { | 264 if (locale_file_path.empty()) { |
272 // It's possible that there is no locale.pak. | 265 // It's possible that there is no locale.pak. |
273 LOG(WARNING) << "locale_file_path.empty()"; | 266 LOG(WARNING) << "locale_file_path.empty()"; |
274 return std::string(); | 267 return std::string(); |
275 } | 268 } |
276 | 269 |
277 scoped_ptr<DataPack> data_pack( | 270 scoped_ptr<DataPack> data_pack( |
278 new DataPack(SCALE_FACTOR_100P)); | 271 new DataPack(SCALE_FACTOR_100P)); |
279 if (!data_pack->LoadFromPath(locale_file_path)) { | 272 if (!data_pack->LoadFromPath(locale_file_path)) { |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 // static | 788 // static |
796 bool ResourceBundle::DecodePNG(const unsigned char* buf, | 789 bool ResourceBundle::DecodePNG(const unsigned char* buf, |
797 size_t size, | 790 size_t size, |
798 SkBitmap* bitmap, | 791 SkBitmap* bitmap, |
799 bool* fell_back_to_1x) { | 792 bool* fell_back_to_1x) { |
800 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); | 793 *fell_back_to_1x = PNGContainsFallbackMarker(buf, size); |
801 return gfx::PNGCodec::Decode(buf, size, bitmap); | 794 return gfx::PNGCodec::Decode(buf, size, bitmap); |
802 } | 795 } |
803 | 796 |
804 } // namespace ui | 797 } // namespace ui |
OLD | NEW |