Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(187)

Side by Side Diff: components/translate/core/browser/translate_language_list.cc

Issue 2539363004: Make base::Value::TYPE a scoped enum. (Closed)
Patch Set: Rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "components/translate/core/browser/translate_language_list.h" 5 #include "components/translate/core/browser/translate_language_list.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 10
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 // The format is in JSON as: 301 // The format is in JSON as:
302 // { 302 // {
303 // "sl": {"XX": "LanguageName", ...}, 303 // "sl": {"XX": "LanguageName", ...},
304 // "tl": {"XX": "LanguageName", ...}, 304 // "tl": {"XX": "LanguageName", ...},
305 // "al": {"XX": 1, ...} 305 // "al": {"XX": 1, ...}
306 // } 306 // }
307 // Where "tl" and "al" are set in kTargetLanguagesKey and kAlphaLanguagesKey. 307 // Where "tl" and "al" are set in kTargetLanguagesKey and kAlphaLanguagesKey.
308 std::unique_ptr<base::Value> json_value = 308 std::unique_ptr<base::Value> json_value =
309 base::JSONReader::Read(language_list, base::JSON_ALLOW_TRAILING_COMMAS); 309 base::JSONReader::Read(language_list, base::JSON_ALLOW_TRAILING_COMMAS);
310 310
311 if (json_value == NULL || !json_value->IsType(base::Value::TYPE_DICTIONARY)) { 311 if (json_value == NULL ||
312 !json_value->IsType(base::Value::Type::DICTIONARY)) {
312 NotifyEvent(__LINE__, "Language list is invalid"); 313 NotifyEvent(__LINE__, "Language list is invalid");
313 NOTREACHED(); 314 NOTREACHED();
314 return false; 315 return false;
315 } 316 }
316 // The first level dictionary contains three sub-dict, first for source 317 // The first level dictionary contains three sub-dict, first for source
317 // languages and second for target languages, we want to use the target 318 // languages and second for target languages, we want to use the target
318 // languages. The last is for alpha languages. 319 // languages. The last is for alpha languages.
319 base::DictionaryValue* language_dict = 320 base::DictionaryValue* language_dict =
320 static_cast<base::DictionaryValue*>(json_value.get()); 321 static_cast<base::DictionaryValue*>(json_value.get());
321 base::DictionaryValue* target_languages = NULL; 322 base::DictionaryValue* target_languages = NULL;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 !iter.IsAtEnd(); iter.Advance()) { 367 !iter.IsAtEnd(); iter.Advance()) {
367 const std::string& lang = iter.key(); 368 const std::string& lang = iter.key();
368 if (!l10n_util::IsLocaleNameTranslated(lang.c_str(), locale)) 369 if (!l10n_util::IsLocaleNameTranslated(lang.c_str(), locale))
369 continue; 370 continue;
370 alpha_languages_.insert(lang); 371 alpha_languages_.insert(lang);
371 } 372 }
372 return true; 373 return true;
373 } 374 }
374 375
375 } // namespace translate 376 } // namespace translate
OLDNEW
« no previous file with comments | « components/tracing/browser/trace_config_file.cc ('k') | components/update_client/component_patcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698