| OLD | NEW |
| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 TranslateBrowserMetrics::ReportInitiationStatus( | 100 TranslateBrowserMetrics::ReportInitiationStatus( |
| 101 TranslateBrowserMetrics::INITIATION_STATUS_DISABLED_BY_PREFS); | 101 TranslateBrowserMetrics::INITIATION_STATUS_DISABLED_BY_PREFS); |
| 102 const std::string& locale = | 102 const std::string& locale = |
| 103 TranslateDownloadManager::GetInstance()->application_locale(); | 103 TranslateDownloadManager::GetInstance()->application_locale(); |
| 104 TranslateBrowserMetrics::ReportLocalesOnDisabledByPrefs(locale); | 104 TranslateBrowserMetrics::ReportLocalesOnDisabledByPrefs(locale); |
| 105 return; | 105 return; |
| 106 } | 106 } |
| 107 | 107 |
| 108 // Allow disabling of translate from the command line to assist with | 108 // Allow disabling of translate from the command line to assist with |
| 109 // automated browser testing. | 109 // automated browser testing. |
| 110 if (CommandLine::ForCurrentProcess()->HasSwitch( | 110 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 111 translate::switches::kDisableTranslate)) { | 111 translate::switches::kDisableTranslate)) { |
| 112 TranslateBrowserMetrics::ReportInitiationStatus( | 112 TranslateBrowserMetrics::ReportInitiationStatus( |
| 113 TranslateBrowserMetrics::INITIATION_STATUS_DISABLED_BY_SWITCH); | 113 TranslateBrowserMetrics::INITIATION_STATUS_DISABLED_BY_SWITCH); |
| 114 return; | 114 return; |
| 115 } | 115 } |
| 116 | 116 |
| 117 // MHTML pages currently cannot be translated. | 117 // MHTML pages currently cannot be translated. |
| 118 // See bug: 217945. | 118 // See bug: 217945. |
| 119 if (translate_driver_->GetContentsMimeType() == "multipart/related") { | 119 if (translate_driver_->GetContentsMimeType() == "multipart/related") { |
| 120 TranslateBrowserMetrics::ReportInitiationStatus( | 120 TranslateBrowserMetrics::ReportInitiationStatus( |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 return auto_target_lang; | 385 return auto_target_lang; |
| 386 } | 386 } |
| 387 return std::string(); | 387 return std::string(); |
| 388 } | 388 } |
| 389 | 389 |
| 390 LanguageState& TranslateManager::GetLanguageState() { | 390 LanguageState& TranslateManager::GetLanguageState() { |
| 391 return language_state_; | 391 return language_state_; |
| 392 } | 392 } |
| 393 | 393 |
| 394 } // namespace translate | 394 } // namespace translate |
| OLD | NEW |