diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-01-29 16:35:13 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-02-01 15:33:35 +0000 |
commit | c8c2d1901aec01e934adf561a9fdf0cc776cdef8 (patch) | |
tree | 9157c3d9815e5870799e070b113813bec53e0535 /chromium/chrome/browser/ui/webui/translate_internals | |
parent | abefd5095b41dac94ca451d784ab6e27372e981a (diff) | |
download | qtwebengine-chromium-c8c2d1901aec01e934adf561a9fdf0cc776cdef8.tar.gz |
BASELINE: Update Chromium to 64.0.3282.139
Change-Id: I1cae68fe9c94ff7608b26b8382fc19862cdb293a
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/chrome/browser/ui/webui/translate_internals')
-rw-r--r-- | chromium/chrome/browser/ui/webui/translate_internals/translate_internals_handler.cc | 15 | ||||
-rw-r--r-- | chromium/chrome/browser/ui/webui/translate_internals/translate_internals_ui.cc | 14 |
2 files changed, 14 insertions, 15 deletions
diff --git a/chromium/chrome/browser/ui/webui/translate_internals/translate_internals_handler.cc b/chromium/chrome/browser/ui/webui/translate_internals/translate_internals_handler.cc index 2cdebf6de72..e844f84c4f7 100644 --- a/chromium/chrome/browser/ui/webui/translate_internals/translate_internals_handler.cc +++ b/chromium/chrome/browser/ui/webui/translate_internals/translate_internals_handler.cc @@ -197,7 +197,7 @@ void TranslateInternalsHandler::SendPrefsToJs() { base::DictionaryValue dict; static const char* keys[] = { - prefs::kEnableTranslate, + prefs::kOfferTranslateEnabled, translate::TranslatePrefs::kPrefTranslateBlockedLanguages, translate::TranslatePrefs::kPrefTranslateSiteBlacklist, translate::TranslatePrefs::kPrefTranslateWhitelists, @@ -217,10 +217,18 @@ void TranslateInternalsHandler::SendPrefsToJs() { } void TranslateInternalsHandler::SendSupportedLanguagesToJs() { - base::DictionaryValue dict; + // Create translate prefs. + content::WebContents* web_contents = web_ui()->GetWebContents(); + Profile* profile = + Profile::FromBrowserContext(web_contents->GetBrowserContext()); + PrefService* prefs = profile->GetOriginalProfile()->GetPrefs(); + std::unique_ptr<translate::TranslatePrefs> translate_prefs( + ChromeTranslateClient::CreateTranslatePrefs(prefs)); + // Fetch supported language information. std::vector<std::string> languages; - translate::TranslateDownloadManager::GetSupportedLanguages(&languages); + translate::TranslateDownloadManager::GetSupportedLanguages( + translate_prefs->IsTranslateAllowedByPolicy(), &languages); base::Time last_updated = translate::TranslateDownloadManager::GetSupportedLanguagesLastUpdated(); @@ -231,6 +239,7 @@ void TranslateInternalsHandler::SendSupportedLanguagesToJs() { languages_list->AppendString(lang); } + base::DictionaryValue dict; dict.Set("languages", std::move(languages_list)); dict.SetDouble("last_updated", last_updated.ToJsTime()); SendMessageToJs("supportedLanguagesUpdated", dict); diff --git a/chromium/chrome/browser/ui/webui/translate_internals/translate_internals_ui.cc b/chromium/chrome/browser/ui/webui/translate_internals/translate_internals_ui.cc index bda9a6df40d..c32b73f3a1e 100644 --- a/chromium/chrome/browser/ui/webui/translate_internals/translate_internals_ui.cc +++ b/chromium/chrome/browser/ui/webui/translate_internals/translate_internals_ui.cc @@ -20,7 +20,6 @@ #include "content/public/browser/web_contents.h" #include "content/public/browser/web_ui.h" #include "content/public/browser/web_ui_data_source.h" -#include "third_party/cld/cld_version.h" #include "ui/base/l10n/l10n_util.h" namespace { @@ -62,17 +61,8 @@ content::WebUIDataSource* CreateTranslateInternalsHTMLSource() { source->AddString(key, value); } - std::string cld_version = ""; - // The version string is hardcoded here to avoid linking with the CLD - // library, see http://crbug.com/297777. -#if BUILDFLAG(CLD_VERSION) == 2 - cld_version = "2"; -#elif BUILDFLAG(CLD_VERSION) == 3 - cld_version = "3"; -#else -# error "CLD_VERSION must be 2 or 3" -#endif - source->AddString("cld-version", cld_version); + // Current cld-version is "3". + source->AddString("cld-version", "3"); return source; } |