| 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/common/extensions/extension_l10n_util.h" | 5 #include "chrome/common/extensions/extension_l10n_util.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 return true; | 115 return true; |
| 116 } | 116 } |
| 117 | 117 |
| 118 bool LocalizeExtension(Extension* extension, | 118 bool LocalizeExtension(Extension* extension, |
| 119 DictionaryValue* manifest, | 119 DictionaryValue* manifest, |
| 120 std::string* error) { | 120 std::string* error) { |
| 121 DCHECK(manifest); | 121 DCHECK(manifest); |
| 122 | 122 |
| 123 std::string default_locale = GetDefaultLocaleFromManifest(*manifest, error); | 123 std::string default_locale = GetDefaultLocaleFromManifest(*manifest, error); |
| 124 | 124 |
| 125 ExtensionMessageBundle* message_bundle = | 125 scoped_ptr<ExtensionMessageBundle> message_bundle( |
| 126 extension_file_util::LoadExtensionMessageBundle(extension->path(), | 126 extension_file_util::LoadExtensionMessageBundle( |
| 127 default_locale, | 127 extension->path(), default_locale, error)); |
| 128 error); | |
| 129 | 128 |
| 130 if (!message_bundle && !error->empty()) | 129 if (!message_bundle.get() && !error->empty()) |
| 131 return false; | 130 return false; |
| 132 | 131 |
| 133 if (message_bundle && !LocalizeManifest(*message_bundle, manifest, error)) | 132 if (message_bundle.get() && |
| 133 !LocalizeManifest(*message_bundle, manifest, error)) |
| 134 return false; | 134 return false; |
| 135 | 135 |
| 136 return true; | 136 return true; |
| 137 } | 137 } |
| 138 | 138 |
| 139 bool AddLocale(const std::set<std::string>& chrome_locales, | 139 bool AddLocale(const std::set<std::string>& chrome_locales, |
| 140 const FilePath& locale_folder, | 140 const FilePath& locale_folder, |
| 141 const std::string& locale_name, | 141 const std::string& locale_name, |
| 142 std::set<std::string>* valid_locales, | 142 std::set<std::string>* valid_locales, |
| 143 std::string* error) { | 143 std::string* error) { |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 return false; | 287 return false; |
| 288 } else { | 288 } else { |
| 289 catalogs.push_back(catalog); | 289 catalogs.push_back(catalog); |
| 290 } | 290 } |
| 291 } | 291 } |
| 292 | 292 |
| 293 return ExtensionMessageBundle::Create(catalogs, error); | 293 return ExtensionMessageBundle::Create(catalogs, error); |
| 294 } | 294 } |
| 295 | 295 |
| 296 } // namespace extension_l10n_util | 296 } // namespace extension_l10n_util |
| OLD | NEW |