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 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 | 576 |
577 TranslateTabHelper* helper = TabContentsWrapper::GetCurrentWrapperForContents( | 577 TranslateTabHelper* helper = TabContentsWrapper::GetCurrentWrapperForContents( |
578 tab_contents)->translate_tab_helper(); | 578 tab_contents)->translate_tab_helper(); |
579 helper->language_state().set_current_language( | 579 helper->language_state().set_current_language( |
580 helper->language_state().original_language()); | 580 helper->language_state().original_language()); |
581 } | 581 } |
582 | 582 |
583 void TranslateManager::ReportLanguageDetectionError(TabContents* tab_contents) { | 583 void TranslateManager::ReportLanguageDetectionError(TabContents* tab_contents) { |
584 UMA_HISTOGRAM_COUNTS("Translate.ReportLanguageDetectionError", 1); | 584 UMA_HISTOGRAM_COUNTS("Translate.ReportLanguageDetectionError", 1); |
585 GURL page_url = tab_contents->controller().GetActiveEntry()->url(); | 585 GURL page_url = tab_contents->controller().GetActiveEntry()->url(); |
| 586 // Report option should be disabled for secure URLs. |
| 587 DCHECK(!page_url.SchemeIsSecure()); |
586 std::string report_error_url(kReportLanguageDetectionErrorURL); | 588 std::string report_error_url(kReportLanguageDetectionErrorURL); |
587 report_error_url += "?client=cr&action=langidc&u="; | 589 report_error_url += "?client=cr&action=langidc&u="; |
588 report_error_url += EscapeUrlEncodedData(page_url.spec(), true); | 590 report_error_url += EscapeUrlEncodedData(page_url.spec(), true); |
589 report_error_url += "&sl="; | 591 report_error_url += "&sl="; |
590 | 592 |
591 TranslateTabHelper* helper = TabContentsWrapper::GetCurrentWrapperForContents( | 593 TranslateTabHelper* helper = TabContentsWrapper::GetCurrentWrapperForContents( |
592 tab_contents)->translate_tab_helper(); | 594 tab_contents)->translate_tab_helper(); |
593 report_error_url += helper->language_state().original_language(); | 595 report_error_url += helper->language_state().original_language(); |
594 report_error_url += "&hl="; | 596 report_error_url += "&hl="; |
595 report_error_url += | 597 report_error_url += |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 InfoBarTabHelper* infobar_helper = wrapper->infobar_tab_helper(); | 808 InfoBarTabHelper* infobar_helper = wrapper->infobar_tab_helper(); |
807 | 809 |
808 for (size_t i = 0; i < infobar_helper->infobar_count(); ++i) { | 810 for (size_t i = 0; i < infobar_helper->infobar_count(); ++i) { |
809 TranslateInfoBarDelegate* delegate = | 811 TranslateInfoBarDelegate* delegate = |
810 infobar_helper->GetInfoBarDelegateAt(i)->AsTranslateInfoBarDelegate(); | 812 infobar_helper->GetInfoBarDelegateAt(i)->AsTranslateInfoBarDelegate(); |
811 if (delegate) | 813 if (delegate) |
812 return delegate; | 814 return delegate; |
813 } | 815 } |
814 return NULL; | 816 return NULL; |
815 } | 817 } |
OLD | NEW |