Chromium Code Reviews| Index: ui/base/resource/resource_bundle.cc |
| diff --git a/ui/base/resource/resource_bundle.cc b/ui/base/resource/resource_bundle.cc |
| index 2890c41b6e2e44c9e43bef6cddf6d63afe507a8a..ffc8d907a6d0f09746fc0b1d1c09f40b40b0d889 100644 |
| --- a/ui/base/resource/resource_bundle.cc |
| +++ b/ui/base/resource/resource_bundle.cc |
| @@ -311,6 +311,11 @@ void ResourceBundle::OverrideLocalePakForTest(const base::FilePath& pak_path) { |
| overridden_pak_path_ = pak_path; |
| } |
| +void ResourceBundle::OverrideStringResource( |
| + int message_id, const base::string16& overridding_string) { |
| + overridden_strings_[message_id] = overridding_string; |
| +} |
| + |
| const base::FilePath& ResourceBundle::GetOverriddenPakPath() { |
| return overridden_pak_path_; |
| } |
| @@ -439,6 +444,9 @@ base::string16 ResourceBundle::GetLocalizedString(int message_id) { |
| if (delegate_ && delegate_->GetLocalizedString(message_id, &string)) |
| return string; |
| + if (overridden_strings_.find(message_id) != overridden_strings_.end()) |
|
grt (UTC plus 2)
2014/06/09 16:54:44
avoid doing two O(logN) scans when there's a hit w
jwd
2014/06/10 20:59:25
Done.
|
| + return overridden_strings_[message_id]; |
| + |
| // Ensure that ReloadLocaleResources() doesn't drop the resources while |
| // we're using them. |
| base::AutoLock lock_scope(*locale_resources_data_lock_); |