OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.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 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 tab_contents)->translate_tab_helper(); | 492 tab_contents)->translate_tab_helper(); |
493 helper->language_state().set_current_language( | 493 helper->language_state().set_current_language( |
494 helper->language_state().original_language()); | 494 helper->language_state().original_language()); |
495 } | 495 } |
496 | 496 |
497 void TranslateManager::ReportLanguageDetectionError(TabContents* tab_contents) { | 497 void TranslateManager::ReportLanguageDetectionError(TabContents* tab_contents) { |
498 UMA_HISTOGRAM_COUNTS("Translate.ReportLanguageDetectionError", 1); | 498 UMA_HISTOGRAM_COUNTS("Translate.ReportLanguageDetectionError", 1); |
499 GURL page_url = tab_contents->controller().GetActiveEntry()->url(); | 499 GURL page_url = tab_contents->controller().GetActiveEntry()->url(); |
500 std::string report_error_url(kReportLanguageDetectionErrorURL); | 500 std::string report_error_url(kReportLanguageDetectionErrorURL); |
501 report_error_url += "?client=cr&action=langidc&u="; | 501 report_error_url += "?client=cr&action=langidc&u="; |
502 report_error_url += EscapeUrlEncodedData(page_url.spec()); | 502 report_error_url += EscapeUrlEncodedData(page_url.spec(), true); |
503 report_error_url += "&sl="; | 503 report_error_url += "&sl="; |
504 | 504 |
505 TranslateTabHelper* helper = TabContentsWrapper::GetCurrentWrapperForContents( | 505 TranslateTabHelper* helper = TabContentsWrapper::GetCurrentWrapperForContents( |
506 tab_contents)->translate_tab_helper(); | 506 tab_contents)->translate_tab_helper(); |
507 report_error_url += helper->language_state().original_language(); | 507 report_error_url += helper->language_state().original_language(); |
508 report_error_url += "&hl="; | 508 report_error_url += "&hl="; |
509 report_error_url += | 509 report_error_url += |
510 GetLanguageCode(g_browser_process->GetApplicationLocale()); | 510 GetLanguageCode(g_browser_process->GetApplicationLocale()); |
511 // Open that URL in a new tab so that the user can tell us more. | 511 // Open that URL in a new tab so that the user can tell us more. |
512 Browser* browser = BrowserList::GetLastActive(); | 512 Browser* browser = BrowserList::GetLastActive(); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 TabContentsWrapper* wrapper = | 658 TabContentsWrapper* wrapper = |
659 TabContentsWrapper::GetCurrentWrapperForContents(tab); | 659 TabContentsWrapper::GetCurrentWrapperForContents(tab); |
660 for (size_t i = 0; i < wrapper->infobar_count(); ++i) { | 660 for (size_t i = 0; i < wrapper->infobar_count(); ++i) { |
661 TranslateInfoBarDelegate* delegate = | 661 TranslateInfoBarDelegate* delegate = |
662 wrapper->GetInfoBarDelegateAt(i)->AsTranslateInfoBarDelegate(); | 662 wrapper->GetInfoBarDelegateAt(i)->AsTranslateInfoBarDelegate(); |
663 if (delegate) | 663 if (delegate) |
664 return delegate; | 664 return delegate; |
665 } | 665 } |
666 return NULL; | 666 return NULL; |
667 } | 667 } |
OLD | NEW |