OLD | NEW |
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 "chrome/browser/ui/webui/translate_internals/translate_internals_ui.h" | 5 #include "chrome/browser/ui/webui/translate_internals/translate_internals_ui.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 base::string16 lang_name = | 39 base::string16 lang_name = |
40 l10n_util::GetDisplayNameForLocale(lang_code, app_locale, false); | 40 l10n_util::GetDisplayNameForLocale(lang_code, app_locale, false); |
41 dict->SetString(lang_code, lang_name); | 41 dict->SetString(lang_code, lang_name); |
42 } | 42 } |
43 } | 43 } |
44 | 44 |
45 content::WebUIDataSource* CreateTranslateInternalsHTMLSource() { | 45 content::WebUIDataSource* CreateTranslateInternalsHTMLSource() { |
46 content::WebUIDataSource* source = | 46 content::WebUIDataSource* source = |
47 content::WebUIDataSource::Create(chrome::kChromeUITranslateInternalsHost); | 47 content::WebUIDataSource::Create(chrome::kChromeUITranslateInternalsHost); |
48 | 48 |
49 source->SetUseJsonJSFormatV2(); | |
50 source->SetDefaultResource(IDR_TRANSLATE_INTERNALS_TRANSLATE_INTERNALS_HTML); | 49 source->SetDefaultResource(IDR_TRANSLATE_INTERNALS_TRANSLATE_INTERNALS_HTML); |
51 source->SetJsonPath("strings.js"); | 50 source->SetJsonPath("strings.js"); |
52 source->AddResourcePath("translate_internals.js", | 51 source->AddResourcePath("translate_internals.js", |
53 IDR_TRANSLATE_INTERNALS_TRANSLATE_INTERNALS_JS); | 52 IDR_TRANSLATE_INTERNALS_TRANSLATE_INTERNALS_JS); |
54 | 53 |
55 base::DictionaryValue langs; | 54 base::DictionaryValue langs; |
56 GetLanguages(&langs); | 55 GetLanguages(&langs); |
57 for (base::DictionaryValue::Iterator it(langs); !it.IsAtEnd(); it.Advance()) { | 56 for (base::DictionaryValue::Iterator it(langs); !it.IsAtEnd(); it.Advance()) { |
58 std::string key = "language-" + it.key(); | 57 std::string key = "language-" + it.key(); |
59 std::string value; | 58 std::string value; |
(...skipping 22 matching lines...) Expand all Loading... |
82 | 81 |
83 } // namespace | 82 } // namespace |
84 | 83 |
85 TranslateInternalsUI::TranslateInternalsUI(content::WebUI* web_ui) | 84 TranslateInternalsUI::TranslateInternalsUI(content::WebUI* web_ui) |
86 : WebUIController(web_ui) { | 85 : WebUIController(web_ui) { |
87 web_ui->AddMessageHandler(new TranslateInternalsHandler); | 86 web_ui->AddMessageHandler(new TranslateInternalsHandler); |
88 | 87 |
89 Profile* profile = Profile::FromWebUI(web_ui); | 88 Profile* profile = Profile::FromWebUI(web_ui); |
90 content::WebUIDataSource::Add(profile, CreateTranslateInternalsHTMLSource()); | 89 content::WebUIDataSource::Add(profile, CreateTranslateInternalsHTMLSource()); |
91 } | 90 } |
OLD | NEW |