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

Side by Side Diff: components/translate/core/browser/translate_manager.cc

Issue 1966443003: Call SetTranslateEnable(true) in the 2016Q2 UI even it is blocked language or blocked URL so Omniba… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/translate/core/browser/translate_manager.h" 5 #include "components/translate/core/browser/translate_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 // page is not supported by the translation server. 154 // page is not supported by the translation server.
155 if (target_lang.empty() || 155 if (target_lang.empty() ||
156 !TranslateDownloadManager::IsSupportedLanguage(language_code)) { 156 !TranslateDownloadManager::IsSupportedLanguage(language_code)) {
157 TranslateBrowserMetrics::ReportInitiationStatus( 157 TranslateBrowserMetrics::ReportInitiationStatus(
158 TranslateBrowserMetrics::INITIATION_STATUS_LANGUAGE_IS_NOT_SUPPORTED); 158 TranslateBrowserMetrics::INITIATION_STATUS_LANGUAGE_IS_NOT_SUPPORTED);
159 TranslateBrowserMetrics::ReportUnsupportedLanguageAtInitiation( 159 TranslateBrowserMetrics::ReportUnsupportedLanguageAtInitiation(
160 language_code); 160 language_code);
161 return; 161 return;
162 } 162 }
163 163
164 // In the 2016Q2 UI, enable the translate in language state once we reach
165 // the above check and let omnibar to display the translate icon.
166 if (base::FeatureList::IsEnabled(kTranslateUI2016Q2)) {
167 language_state_.SetTranslateEnabled(true);
168 }
169
164 TranslateAcceptLanguages* accept_languages = 170 TranslateAcceptLanguages* accept_languages =
165 translate_client_->GetTranslateAcceptLanguages(); 171 translate_client_->GetTranslateAcceptLanguages();
166 // Don't translate any user black-listed languages. 172 // Don't translate any user black-listed languages.
167 if (!translate_prefs->CanTranslateLanguage(accept_languages, 173 if (!translate_prefs->CanTranslateLanguage(accept_languages,
168 language_code)) { 174 language_code)) {
169 TranslateBrowserMetrics::ReportInitiationStatus( 175 TranslateBrowserMetrics::ReportInitiationStatus(
170 TranslateBrowserMetrics::INITIATION_STATUS_DISABLED_BY_CONFIG); 176 TranslateBrowserMetrics::INITIATION_STATUS_DISABLED_BY_CONFIG);
171 return; 177 return;
172 } 178 }
173 179
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 } 398 }
393 399
394 bool TranslateManager::ignore_missing_key_for_testing_ = false; 400 bool TranslateManager::ignore_missing_key_for_testing_ = false;
395 401
396 // static 402 // static
397 void TranslateManager::SetIgnoreMissingKeyForTesting(bool ignore) { 403 void TranslateManager::SetIgnoreMissingKeyForTesting(bool ignore) {
398 ignore_missing_key_for_testing_ = ignore; 404 ignore_missing_key_for_testing_ = ignore;
399 } 405 }
400 406
401 } // namespace translate 407 } // namespace translate
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698