| 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/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 } | 544 } |
| 545 | 545 |
| 546 void TranslateManager::InitiateTranslation(WebContents* web_contents, | 546 void TranslateManager::InitiateTranslation(WebContents* web_contents, |
| 547 const std::string& page_lang) { | 547 const std::string& page_lang) { |
| 548 Profile* profile = | 548 Profile* profile = |
| 549 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 549 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
| 550 PrefService* prefs = profile->GetOriginalProfile()->GetPrefs(); | 550 PrefService* prefs = profile->GetOriginalProfile()->GetPrefs(); |
| 551 if (!prefs->GetBoolean(prefs::kEnableTranslate)) { | 551 if (!prefs->GetBoolean(prefs::kEnableTranslate)) { |
| 552 TranslateManagerMetrics::ReportInitiationStatus( | 552 TranslateManagerMetrics::ReportInitiationStatus( |
| 553 TranslateManagerMetrics::INITIATION_STATUS_DISABLED_BY_PREFS); | 553 TranslateManagerMetrics::INITIATION_STATUS_DISABLED_BY_PREFS); |
| 554 const std::string& locale = g_browser_process->GetApplicationLocale(); |
| 555 TranslateManagerMetrics::ReportLocalesOnDisabledByPrefs(locale); |
| 554 return; | 556 return; |
| 555 } | 557 } |
| 556 | 558 |
| 557 // Allow disabling of translate from the command line to assist with | 559 // Allow disabling of translate from the command line to assist with |
| 558 // automated browser testing. | 560 // automated browser testing. |
| 559 if (CommandLine::ForCurrentProcess()->HasSwitch( | 561 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 560 switches::kDisableTranslate)) { | 562 switches::kDisableTranslate)) { |
| 561 TranslateManagerMetrics::ReportInitiationStatus( | 563 TranslateManagerMetrics::ReportInitiationStatus( |
| 562 TranslateManagerMetrics::INITIATION_STATUS_DISABLED_BY_SWITCH); | 564 TranslateManagerMetrics::INITIATION_STATUS_DISABLED_BY_SWITCH); |
| 563 return; | 565 return; |
| (...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 995 // reason so we are more aggressive showing the shortcuts for never translate. | 997 // reason so we are more aggressive showing the shortcuts for never translate. |
| 996 #if defined(OS_ANDROID) | 998 #if defined(OS_ANDROID) |
| 997 config.never_translate_min_count = 1; | 999 config.never_translate_min_count = 1; |
| 998 #else | 1000 #else |
| 999 config.never_translate_min_count = 3; | 1001 config.never_translate_min_count = 3; |
| 1000 #endif // defined(OS_ANDROID) | 1002 #endif // defined(OS_ANDROID) |
| 1001 | 1003 |
| 1002 config.always_translate_min_count = 3; | 1004 config.always_translate_min_count = 3; |
| 1003 return config; | 1005 return config; |
| 1004 } | 1006 } |
| OLD | NEW |