Chromium Code Reviews| 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/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 325 | 325 |
| 326 // Allow disabling of translate from the command line to assist with | 326 // Allow disabling of translate from the command line to assist with |
| 327 // automated browser testing. | 327 // automated browser testing. |
| 328 if (CommandLine::ForCurrentProcess()->HasSwitch( | 328 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 329 switches::kDisableTranslate)) { | 329 switches::kDisableTranslate)) { |
| 330 TranslateBrowserMetrics::ReportInitiationStatus( | 330 TranslateBrowserMetrics::ReportInitiationStatus( |
| 331 TranslateBrowserMetrics::INITIATION_STATUS_DISABLED_BY_SWITCH); | 331 TranslateBrowserMetrics::INITIATION_STATUS_DISABLED_BY_SWITCH); |
| 332 return; | 332 return; |
| 333 } | 333 } |
| 334 | 334 |
| 335 // MHTML pages currently cannot be translated | |
|
MAD
2013/08/05 15:02:27
Add a period (.) at the end of the sentence please
| |
| 336 // see bug: 217945 | |
|
MAD
2013/08/05 15:02:27
Same here. And use a Capital letter at beginning o
| |
| 337 if (web_contents->GetContentsMimeType() == "multipart/related") { | |
| 338 TranslateBrowserMetrics::ReportInitiationStatus( | |
| 339 TranslateBrowserMetrics::INITIATION_STATUS_MIME_TYPE_IS_NOT_SUPPORTED); | |
| 340 return; | |
| 341 } | |
| 342 | |
| 335 // Don't translate any Chrome specific page, e.g., New Tab Page, Download, | 343 // Don't translate any Chrome specific page, e.g., New Tab Page, Download, |
| 336 // History, and so on. | 344 // History, and so on. |
| 337 GURL page_url = web_contents->GetURL(); | 345 GURL page_url = web_contents->GetURL(); |
| 338 if (!IsTranslatableURL(page_url)) { | 346 if (!IsTranslatableURL(page_url)) { |
| 339 TranslateBrowserMetrics::ReportInitiationStatus( | 347 TranslateBrowserMetrics::ReportInitiationStatus( |
| 340 TranslateBrowserMetrics::INITIATION_STATUS_URL_IS_NOT_SUPPORTED); | 348 TranslateBrowserMetrics::INITIATION_STATUS_URL_IS_NOT_SUPPORTED); |
| 341 return; | 349 return; |
| 342 } | 350 } |
| 343 | 351 |
| 344 std::string target_lang = GetTargetLanguage(prefs); | 352 std::string target_lang = GetTargetLanguage(prefs); |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 717 // so we are more aggressive about showing the shortcut to never translate. | 725 // so we are more aggressive about showing the shortcut to never translate. |
| 718 #if defined(OS_ANDROID) | 726 #if defined(OS_ANDROID) |
| 719 config.never_translate_min_count = 1; | 727 config.never_translate_min_count = 1; |
| 720 #else | 728 #else |
| 721 config.never_translate_min_count = 3; | 729 config.never_translate_min_count = 3; |
| 722 #endif // defined(OS_ANDROID) | 730 #endif // defined(OS_ANDROID) |
| 723 | 731 |
| 724 config.always_translate_min_count = 3; | 732 config.always_translate_min_count = 3; |
| 725 return config; | 733 return config; |
| 726 } | 734 } |
| OLD | NEW |