| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/translate/translate_manager.h" | 5 #include "chrome/browser/translate/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/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 } | 385 } |
| 386 | 386 |
| 387 void TranslateManager::InitiateTranslation(WebContents* web_contents, | 387 void TranslateManager::InitiateTranslation(WebContents* web_contents, |
| 388 const std::string& page_lang) { | 388 const std::string& page_lang) { |
| 389 Profile* profile = | 389 Profile* profile = |
| 390 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 390 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
| 391 PrefService* prefs = profile->GetOriginalProfile()->GetPrefs(); | 391 PrefService* prefs = profile->GetOriginalProfile()->GetPrefs(); |
| 392 if (!prefs->GetBoolean(prefs::kEnableTranslate)) { | 392 if (!prefs->GetBoolean(prefs::kEnableTranslate)) { |
| 393 TranslateManagerMetrics::ReportInitiationStatus( | 393 TranslateManagerMetrics::ReportInitiationStatus( |
| 394 TranslateManagerMetrics::INITIATION_STATUS_DISABLED_BY_PREFS); | 394 TranslateManagerMetrics::INITIATION_STATUS_DISABLED_BY_PREFS); |
| 395 const std::string& locale = g_browser_process->GetApplicationLocale(); |
| 396 TranslateManagerMetrics::ReportLocalesOnDisabledByPrefs(locale); |
| 395 return; | 397 return; |
| 396 } | 398 } |
| 397 | 399 |
| 398 // Allow disabling of translate from the command line to assist with | 400 // Allow disabling of translate from the command line to assist with |
| 399 // automated browser testing. | 401 // automated browser testing. |
| 400 if (CommandLine::ForCurrentProcess()->HasSwitch( | 402 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 401 switches::kDisableTranslate)) { | 403 switches::kDisableTranslate)) { |
| 402 TranslateManagerMetrics::ReportInitiationStatus( | 404 TranslateManagerMetrics::ReportInitiationStatus( |
| 403 TranslateManagerMetrics::INITIATION_STATUS_DISABLED_BY_SWITCH); | 405 TranslateManagerMetrics::INITIATION_STATUS_DISABLED_BY_SWITCH); |
| 404 return; | 406 return; |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 // reason so we are more aggressive showing the shortcuts for never translate. | 828 // reason so we are more aggressive showing the shortcuts for never translate. |
| 827 #if defined(OS_ANDROID) | 829 #if defined(OS_ANDROID) |
| 828 config.never_translate_min_count = 1; | 830 config.never_translate_min_count = 1; |
| 829 #else | 831 #else |
| 830 config.never_translate_min_count = 3; | 832 config.never_translate_min_count = 3; |
| 831 #endif // defined(OS_ANDROID) | 833 #endif // defined(OS_ANDROID) |
| 832 | 834 |
| 833 config.always_translate_min_count = 3; | 835 config.always_translate_min_count = 3; |
| 834 return config; | 836 return config; |
| 835 } | 837 } |
| OLD | NEW |