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 "chrome/common/extensions/extension_l10n_util.h" | 5 #include "chrome/common/extensions/extension_l10n_util.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 iter.Advance()) { | 233 iter.Advance()) { |
234 key.assign(base::StringPrintf("commands.%s.description", | 234 key.assign(base::StringPrintf("commands.%s.description", |
235 iter.key().c_str())); | 235 iter.key().c_str())); |
236 if (!LocalizeManifestValue(key, messages, manifest, error)) | 236 if (!LocalizeManifestValue(key, messages, manifest, error)) |
237 return false; | 237 return false; |
238 } | 238 } |
239 } | 239 } |
240 | 240 |
241 // Initialize search_provider fields. | 241 // Initialize search_provider fields. |
242 base::DictionaryValue* search_provider = NULL; | 242 base::DictionaryValue* search_provider = NULL; |
243 if (manifest->GetDictionary(keys::kSearchProvider, &search_provider)) { | 243 if (manifest->GetDictionary(keys::kOverrideSearchProvider, |
| 244 &search_provider)) { |
244 for (base::DictionaryValue::Iterator iter(*search_provider); | 245 for (base::DictionaryValue::Iterator iter(*search_provider); |
245 !iter.IsAtEnd(); | 246 !iter.IsAtEnd(); |
246 iter.Advance()) { | 247 iter.Advance()) { |
247 key.assign(base::StringPrintf("%s.%s", keys::kSearchProvider, | 248 key.assign(base::StringPrintf( |
248 iter.key().c_str())); | 249 "%s.%s", keys::kOverrideSearchProvider, iter.key().c_str())); |
249 bool success = (key == keys::kSettingsOverrideAlternateUrls) ? | 250 bool success = (key == keys::kSettingsOverrideAlternateUrls) ? |
250 LocalizeManifestListValue(key, messages, manifest, error) : | 251 LocalizeManifestListValue(key, messages, manifest, error) : |
251 LocalizeManifestValue(key, messages, manifest, error); | 252 LocalizeManifestValue(key, messages, manifest, error); |
252 if (!success) | 253 if (!success) |
253 return false; | 254 return false; |
254 } | 255 } |
255 } | 256 } |
256 | 257 |
| 258 // Initialize chrome_settings_overrides.homepage. |
| 259 if (!LocalizeManifestValue( |
| 260 keys::kOverrideHomepage, messages, manifest, error)) |
| 261 return false; |
| 262 |
| 263 // Initialize chrome_settings_overrides.startup_pages. |
| 264 if (!LocalizeManifestListValue( |
| 265 keys::kOverrideStartupPage, messages, manifest, error)) |
| 266 return false; |
| 267 |
257 // Add current locale key to the manifest, so we can overwrite prefs | 268 // Add current locale key to the manifest, so we can overwrite prefs |
258 // with new manifest when chrome locale changes. | 269 // with new manifest when chrome locale changes. |
259 manifest->SetString(keys::kCurrentLocale, CurrentLocaleOrDefault()); | 270 manifest->SetString(keys::kCurrentLocale, CurrentLocaleOrDefault()); |
260 return true; | 271 return true; |
261 } | 272 } |
262 | 273 |
263 bool LocalizeExtension(const base::FilePath& extension_path, | 274 bool LocalizeExtension(const base::FilePath& extension_path, |
264 base::DictionaryValue* manifest, | 275 base::DictionaryValue* manifest, |
265 std::string* error) { | 276 std::string* error) { |
266 DCHECK(manifest); | 277 DCHECK(manifest); |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 ScopedLocaleForTest::ScopedLocaleForTest(const std::string& locale) | 474 ScopedLocaleForTest::ScopedLocaleForTest(const std::string& locale) |
464 : locale_(extension_l10n_util::CurrentLocaleOrDefault()) { | 475 : locale_(extension_l10n_util::CurrentLocaleOrDefault()) { |
465 extension_l10n_util::SetProcessLocale(locale); | 476 extension_l10n_util::SetProcessLocale(locale); |
466 } | 477 } |
467 | 478 |
468 ScopedLocaleForTest::~ScopedLocaleForTest() { | 479 ScopedLocaleForTest::~ScopedLocaleForTest() { |
469 extension_l10n_util::SetProcessLocale(locale_); | 480 extension_l10n_util::SetProcessLocale(locale_); |
470 } | 481 } |
471 | 482 |
472 } // namespace extension_l10n_util | 483 } // namespace extension_l10n_util |
OLD | NEW |