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/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 | 587 |
588 TranslateTabHelper* helper = TabContentsWrapper::GetCurrentWrapperForContents( | 588 TranslateTabHelper* helper = TabContentsWrapper::GetCurrentWrapperForContents( |
589 tab_contents)->translate_tab_helper(); | 589 tab_contents)->translate_tab_helper(); |
590 helper->language_state().set_current_language( | 590 helper->language_state().set_current_language( |
591 helper->language_state().original_language()); | 591 helper->language_state().original_language()); |
592 } | 592 } |
593 | 593 |
594 void TranslateManager::ReportLanguageDetectionError(TabContents* tab_contents) { | 594 void TranslateManager::ReportLanguageDetectionError(TabContents* tab_contents) { |
595 UMA_HISTOGRAM_COUNTS("Translate.ReportLanguageDetectionError", 1); | 595 UMA_HISTOGRAM_COUNTS("Translate.ReportLanguageDetectionError", 1); |
596 GURL page_url = tab_contents->controller().GetActiveEntry()->url(); | 596 GURL page_url = tab_contents->controller().GetActiveEntry()->url(); |
| 597 // Report option should be disabled for secure URLs. |
| 598 DCHECK(!page_url.SchemeIsSecure()); |
597 std::string report_error_url(kReportLanguageDetectionErrorURL); | 599 std::string report_error_url(kReportLanguageDetectionErrorURL); |
598 report_error_url += "?client=cr&action=langidc&u="; | 600 report_error_url += "?client=cr&action=langidc&u="; |
599 report_error_url += EscapeUrlEncodedData(page_url.spec(), true); | 601 report_error_url += EscapeUrlEncodedData(page_url.spec(), true); |
600 report_error_url += "&sl="; | 602 report_error_url += "&sl="; |
601 | 603 |
602 TranslateTabHelper* helper = TabContentsWrapper::GetCurrentWrapperForContents( | 604 TranslateTabHelper* helper = TabContentsWrapper::GetCurrentWrapperForContents( |
603 tab_contents)->translate_tab_helper(); | 605 tab_contents)->translate_tab_helper(); |
604 report_error_url += helper->language_state().original_language(); | 606 report_error_url += helper->language_state().original_language(); |
605 report_error_url += "&hl="; | 607 report_error_url += "&hl="; |
606 report_error_url += | 608 report_error_url += |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 InfoBarTabHelper* infobar_helper = wrapper->infobar_tab_helper(); | 829 InfoBarTabHelper* infobar_helper = wrapper->infobar_tab_helper(); |
828 | 830 |
829 for (size_t i = 0; i < infobar_helper->infobar_count(); ++i) { | 831 for (size_t i = 0; i < infobar_helper->infobar_count(); ++i) { |
830 TranslateInfoBarDelegate* delegate = | 832 TranslateInfoBarDelegate* delegate = |
831 infobar_helper->GetInfoBarDelegateAt(i)->AsTranslateInfoBarDelegate(); | 833 infobar_helper->GetInfoBarDelegateAt(i)->AsTranslateInfoBarDelegate(); |
832 if (delegate) | 834 if (delegate) |
833 return delegate; | 835 return delegate; |
834 } | 836 } |
835 return NULL; | 837 return NULL; |
836 } | 838 } |
OLD | NEW |