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

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

Issue 2130623002: rollback omnibar icon changes based on UX feedback (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix patch/merge issue Created 4 years, 5 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 | components/translate/core/browser/translate_ui_delegate.cc » ('j') | 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 // page is not supported by the translation server. 160 // page is not supported by the translation server.
161 if (target_lang.empty() || 161 if (target_lang.empty() ||
162 !TranslateDownloadManager::IsSupportedLanguage(language_code)) { 162 !TranslateDownloadManager::IsSupportedLanguage(language_code)) {
163 TranslateBrowserMetrics::ReportInitiationStatus( 163 TranslateBrowserMetrics::ReportInitiationStatus(
164 TranslateBrowserMetrics::INITIATION_STATUS_LANGUAGE_IS_NOT_SUPPORTED); 164 TranslateBrowserMetrics::INITIATION_STATUS_LANGUAGE_IS_NOT_SUPPORTED);
165 TranslateBrowserMetrics::ReportUnsupportedLanguageAtInitiation( 165 TranslateBrowserMetrics::ReportUnsupportedLanguageAtInitiation(
166 language_code); 166 language_code);
167 return; 167 return;
168 } 168 }
169 169
170 // In the 2016Q2 UI, enable the translate in language state once we reach
171 // the above check and let omnibar to display the translate icon.
172 if (base::FeatureList::IsEnabled(kTranslateUI2016Q2)) {
173 language_state_.SetTranslateEnabled(true);
174 }
175
176 TranslateAcceptLanguages* accept_languages = 170 TranslateAcceptLanguages* accept_languages =
177 translate_client_->GetTranslateAcceptLanguages(); 171 translate_client_->GetTranslateAcceptLanguages();
178 // Don't translate any user black-listed languages. 172 // Don't translate any user black-listed languages.
179 if (!translate_prefs->CanTranslateLanguage(accept_languages, 173 if (!translate_prefs->CanTranslateLanguage(accept_languages,
180 language_code)) { 174 language_code)) {
181 TranslateBrowserMetrics::ReportInitiationStatus( 175 TranslateBrowserMetrics::ReportInitiationStatus(
182 TranslateBrowserMetrics::INITIATION_STATUS_DISABLED_BY_CONFIG); 176 TranslateBrowserMetrics::INITIATION_STATUS_DISABLED_BY_CONFIG);
183 return; 177 return;
184 } 178 }
185 179
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 } 398 }
405 399
406 bool TranslateManager::ignore_missing_key_for_testing_ = false; 400 bool TranslateManager::ignore_missing_key_for_testing_ = false;
407 401
408 // static 402 // static
409 void TranslateManager::SetIgnoreMissingKeyForTesting(bool ignore) { 403 void TranslateManager::SetIgnoreMissingKeyForTesting(bool ignore) {
410 ignore_missing_key_for_testing_ = ignore; 404 ignore_missing_key_for_testing_ = ignore;
411 } 405 }
412 406
413 } // namespace translate 407 } // namespace translate
OLDNEW
« no previous file with comments | « no previous file | components/translate/core/browser/translate_ui_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698