| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/extensions/extension_message_bundle.h" | 5 #include "chrome/common/extensions/extension_message_bundle.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/hash_tables.h" | 9 #include "base/hash_tables.h" |
| 10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 | 13 |
| 14 const wchar_t* ExtensionMessageBundle::kContentKey = L"content"; | 14 const wchar_t* ExtensionMessageBundle::kContentKey = L"content"; |
| 15 const wchar_t* ExtensionMessageBundle::kMessageKey = L"message"; | 15 const wchar_t* ExtensionMessageBundle::kMessageKey = L"message"; |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 return false; | 239 return false; |
| 240 } | 240 } |
| 241 | 241 |
| 242 return true; | 242 return true; |
| 243 } | 243 } |
| 244 | 244 |
| 245 // Dictionary interface. | 245 // Dictionary interface. |
| 246 | 246 |
| 247 std::string ExtensionMessageBundle::GetL10nMessage( | 247 std::string ExtensionMessageBundle::GetL10nMessage( |
| 248 const std::string& name) const { | 248 const std::string& name) const { |
| 249 return GetL10nMessage(name, dictionary_); |
| 250 } |
| 251 |
| 252 // static |
| 253 std::string ExtensionMessageBundle::GetL10nMessage( |
| 254 const std::string& name, const SubstitutionMap& dictionary) { |
| 249 SubstitutionMap::const_iterator it = | 255 SubstitutionMap::const_iterator it = |
| 250 dictionary_.find(StringToLowerASCII(name)); | 256 dictionary.find(StringToLowerASCII(name)); |
| 251 if (it != dictionary_.end()) { | 257 if (it != dictionary.end()) { |
| 252 return it->second; | 258 return it->second; |
| 253 } | 259 } |
| 254 | 260 |
| 255 return ""; | 261 return ""; |
| 256 } | 262 } |
| OLD | NEW |