| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 GetLanguages(&langs); | 55 GetLanguages(&langs); |
| 56 for (base::DictionaryValue::Iterator it(langs); !it.IsAtEnd(); it.Advance()) { | 56 for (base::DictionaryValue::Iterator it(langs); !it.IsAtEnd(); it.Advance()) { |
| 57 std::string key = "language-" + it.key(); | 57 std::string key = "language-" + it.key(); |
| 58 std::string value; | 58 std::string value; |
| 59 it.value().GetAsString(&value); | 59 it.value().GetAsString(&value); |
| 60 source->AddString(key, value); | 60 source->AddString(key, value); |
| 61 } | 61 } |
| 62 | 62 |
| 63 std::string cld_version = ""; | 63 std::string cld_version = ""; |
| 64 std::string cld_data_source = ""; | 64 std::string cld_data_source = ""; |
| 65 // The version strings are hardcoded here to avoid linking with the CLD | 65 // The version string is hardcoded here to avoid linking with the CLD |
| 66 // library, see http://crbug.com/297777. | 66 // library, see http://crbug.com/297777. |
| 67 #if CLD_VERSION==1 | |
| 68 cld_version = "1.6"; | |
| 69 cld_data_source = "static"; // CLD1.x does not support dynamic data loading | |
| 70 #elif CLD_VERSION==2 | |
| 71 cld_version = "2"; | 67 cld_version = "2"; |
| 72 cld_data_source = translate::CldDataSource::Get()->GetName(); | 68 cld_data_source = translate::CldDataSource::Get()->GetName(); |
| 73 #else | |
| 74 NOTREACHED(); | |
| 75 #endif | |
| 76 source->AddString("cld-version", cld_version); | 69 source->AddString("cld-version", cld_version); |
| 77 source->AddString("cld-data-source", cld_data_source); | 70 source->AddString("cld-data-source", cld_data_source); |
| 78 | 71 |
| 79 return source; | 72 return source; |
| 80 } | 73 } |
| 81 | 74 |
| 82 } // namespace | 75 } // namespace |
| 83 | 76 |
| 84 TranslateInternalsUI::TranslateInternalsUI(content::WebUI* web_ui) | 77 TranslateInternalsUI::TranslateInternalsUI(content::WebUI* web_ui) |
| 85 : WebUIController(web_ui) { | 78 : WebUIController(web_ui) { |
| 86 web_ui->AddMessageHandler(new TranslateInternalsHandler); | 79 web_ui->AddMessageHandler(new TranslateInternalsHandler); |
| 87 | 80 |
| 88 Profile* profile = Profile::FromWebUI(web_ui); | 81 Profile* profile = Profile::FromWebUI(web_ui); |
| 89 content::WebUIDataSource::Add(profile, CreateTranslateInternalsHTMLSource()); | 82 content::WebUIDataSource::Add(profile, CreateTranslateInternalsHTMLSource()); |
| 90 } | 83 } |
| OLD | NEW |