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

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

Issue 2819813002: Translate: remove --disable-translate flag (Closed)
Patch Set: Merge branch 'master' into translate_remove_disable_flag 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 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 <map> 7 #include <map>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 if (!translate_prefs->IsEnabled()) { 181 if (!translate_prefs->IsEnabled()) {
182 TranslateBrowserMetrics::ReportInitiationStatus( 182 TranslateBrowserMetrics::ReportInitiationStatus(
183 TranslateBrowserMetrics::INITIATION_STATUS_DISABLED_BY_PREFS); 183 TranslateBrowserMetrics::INITIATION_STATUS_DISABLED_BY_PREFS);
184 RecordTranslateEvent(metrics::TranslateEventProto::DISABLED_BY_PREF); 184 RecordTranslateEvent(metrics::TranslateEventProto::DISABLED_BY_PREF);
185 const std::string& locale = 185 const std::string& locale =
186 TranslateDownloadManager::GetInstance()->application_locale(); 186 TranslateDownloadManager::GetInstance()->application_locale();
187 TranslateBrowserMetrics::ReportLocalesOnDisabledByPrefs(locale); 187 TranslateBrowserMetrics::ReportLocalesOnDisabledByPrefs(locale);
188 return; 188 return;
189 } 189 }
190 190
191 // Allow disabling of translate from the command line to assist with
192 // automated browser testing.
193 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
194 translate::switches::kDisableTranslate)) {
195 TranslateBrowserMetrics::ReportInitiationStatus(
196 TranslateBrowserMetrics::INITIATION_STATUS_DISABLED_BY_SWITCH);
197 return;
198 }
199
200 // MHTML pages currently cannot be translated. 191 // MHTML pages currently cannot be translated.
201 // See bug: 217945. 192 // See bug: 217945.
202 if (translate_driver_->GetContentsMimeType() == "multipart/related") { 193 if (translate_driver_->GetContentsMimeType() == "multipart/related") {
203 TranslateBrowserMetrics::ReportInitiationStatus( 194 TranslateBrowserMetrics::ReportInitiationStatus(
204 TranslateBrowserMetrics::INITIATION_STATUS_MIME_TYPE_IS_NOT_SUPPORTED); 195 TranslateBrowserMetrics::INITIATION_STATUS_MIME_TYPE_IS_NOT_SUPPORTED);
205 return; 196 return;
206 } 197 }
207 198
208 // Don't translate any Chrome specific page, e.g., New Tab Page, Download, 199 // Don't translate any Chrome specific page, e.g., New Tab Page, Download,
209 // History, and so on. 200 // History, and so on.
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 source_language) && 601 source_language) &&
611 !ShouldOverrideDecision( 602 !ShouldOverrideDecision(
612 metrics::TranslateEventProto::LANGUAGE_DISABLED_BY_AUTO_BLACKLIST)) { 603 metrics::TranslateEventProto::LANGUAGE_DISABLED_BY_AUTO_BLACKLIST)) {
613 return true; 604 return true;
614 } 605 }
615 606
616 return false; 607 return false;
617 } 608 }
618 609
619 } // namespace translate 610 } // namespace translate
OLDNEW
« no previous file with comments | « components/translate/core/browser/translate_download_manager.cc ('k') | components/translate/core/common/translate_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698