| 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 <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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->SetDefaultResource(IDR_TRANSLATE_INTERNALS_TRANSLATE_INTERNALS_HTML); | 49 source->SetDefaultResource(IDR_TRANSLATE_INTERNALS_TRANSLATE_INTERNALS_HTML); |
| 50 source->SetJsonPath("strings.js"); | 50 source->SetJsonPath("strings.js"); |
| 51 source->AddResourcePath("translate_internals.js", | 51 source->AddResourcePath("translate_internals.js", |
| 52 IDR_TRANSLATE_INTERNALS_TRANSLATE_INTERNALS_JS); | 52 IDR_TRANSLATE_INTERNALS_TRANSLATE_INTERNALS_JS); |
| 53 source->DisableI18nAndUseGzipForAllPaths(); | 53 source->UseGzipForAllPaths(); |
| 54 | 54 |
| 55 base::DictionaryValue langs; | 55 base::DictionaryValue langs; |
| 56 GetLanguages(&langs); | 56 GetLanguages(&langs); |
| 57 for (base::DictionaryValue::Iterator it(langs); !it.IsAtEnd(); it.Advance()) { | 57 for (base::DictionaryValue::Iterator it(langs); !it.IsAtEnd(); it.Advance()) { |
| 58 std::string key = "language-" + it.key(); | 58 std::string key = "language-" + it.key(); |
| 59 std::string value; | 59 std::string value; |
| 60 it.value().GetAsString(&value); | 60 it.value().GetAsString(&value); |
| 61 source->AddString(key, value); | 61 source->AddString(key, value); |
| 62 } | 62 } |
| 63 | 63 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 78 | 78 |
| 79 } // namespace | 79 } // namespace |
| 80 | 80 |
| 81 TranslateInternalsUI::TranslateInternalsUI(content::WebUI* web_ui) | 81 TranslateInternalsUI::TranslateInternalsUI(content::WebUI* web_ui) |
| 82 : WebUIController(web_ui) { | 82 : WebUIController(web_ui) { |
| 83 web_ui->AddMessageHandler(new TranslateInternalsHandler); | 83 web_ui->AddMessageHandler(new TranslateInternalsHandler); |
| 84 | 84 |
| 85 Profile* profile = Profile::FromWebUI(web_ui); | 85 Profile* profile = Profile::FromWebUI(web_ui); |
| 86 content::WebUIDataSource::Add(profile, CreateTranslateInternalsHTMLSource()); | 86 content::WebUIDataSource::Add(profile, CreateTranslateInternalsHTMLSource()); |
| 87 } | 87 } |
| OLD | NEW |