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

Side by Side Diff: chrome/browser/ui/webui/translate_internals/translate_internals_handler.cc

Issue 2821463003: Translate: remove alpha language support (Closed)
Patch Set: Merge branch 'master' into translate_remove_alpha Created 3 years, 8 months 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 "chrome/browser/ui/webui/translate_internals/translate_internals_handle r.h" 5 #include "chrome/browser/ui/webui/translate_internals/translate_internals_handle r.h"
6 6
7 #include <map> 7 #include <map>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 218
219 void TranslateInternalsHandler::SendSupportedLanguagesToJs() { 219 void TranslateInternalsHandler::SendSupportedLanguagesToJs() {
220 base::DictionaryValue dict; 220 base::DictionaryValue dict;
221 221
222 std::vector<std::string> languages; 222 std::vector<std::string> languages;
223 translate::TranslateDownloadManager::GetSupportedLanguages(&languages); 223 translate::TranslateDownloadManager::GetSupportedLanguages(&languages);
224 base::Time last_updated = 224 base::Time last_updated =
225 translate::TranslateDownloadManager::GetSupportedLanguagesLastUpdated(); 225 translate::TranslateDownloadManager::GetSupportedLanguagesLastUpdated();
226 226
227 auto languages_list = base::MakeUnique<base::ListValue>(); 227 auto languages_list = base::MakeUnique<base::ListValue>();
228 auto alpha_languages_list = base::MakeUnique<base::ListValue>();
229 for (std::vector<std::string>::iterator it = languages.begin(); 228 for (std::vector<std::string>::iterator it = languages.begin();
230 it != languages.end(); ++it) { 229 it != languages.end(); ++it) {
231 const std::string& lang = *it; 230 const std::string& lang = *it;
232 languages_list->AppendString(lang); 231 languages_list->AppendString(lang);
233 if (translate::TranslateDownloadManager::IsAlphaLanguage(lang))
234 alpha_languages_list->AppendString(lang);
235 } 232 }
236 233
237 dict.Set("languages", std::move(languages_list)); 234 dict.Set("languages", std::move(languages_list));
238 dict.Set("alpha_languages", std::move(alpha_languages_list));
239 dict.SetDouble("last_updated", last_updated.ToJsTime()); 235 dict.SetDouble("last_updated", last_updated.ToJsTime());
240 SendMessageToJs("supportedLanguagesUpdated", dict); 236 SendMessageToJs("supportedLanguagesUpdated", dict);
241 } 237 }
242 238
243 void TranslateInternalsHandler::SendCountryToJs(bool was_updated) { 239 void TranslateInternalsHandler::SendCountryToJs(bool was_updated) {
244 std::string country; 240 std::string country;
245 variations::VariationsService* variations_service = 241 variations::VariationsService* variations_service =
246 g_browser_process->variations_service(); 242 g_browser_process->variations_service();
247 if (variations_service) 243 if (variations_service)
248 country = variations_service->GetStoredPermanentCountry(); 244 country = variations_service->GetStoredPermanentCountry();
249 245
250 base::DictionaryValue dict; 246 base::DictionaryValue dict;
251 if (!country.empty()) { 247 if (!country.empty()) {
252 dict.SetString("country", country); 248 dict.SetString("country", country);
253 dict.SetBoolean("update", was_updated); 249 dict.SetBoolean("update", was_updated);
254 } 250 }
255 SendMessageToJs("countryUpdated", dict); 251 SendMessageToJs("countryUpdated", dict);
256 } 252 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698