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 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 | 663 |
664 TranslateTabHelper* translate_tab_helper = | 664 TranslateTabHelper* translate_tab_helper = |
665 TranslateTabHelper::FromWebContents(web_contents); | 665 TranslateTabHelper::FromWebContents(web_contents); |
666 translate_tab_helper->language_state().set_current_language( | 666 translate_tab_helper->language_state().set_current_language( |
667 translate_tab_helper->language_state().original_language()); | 667 translate_tab_helper->language_state().original_language()); |
668 } | 668 } |
669 | 669 |
670 void TranslateManager::ReportLanguageDetectionError(WebContents* web_contents) { | 670 void TranslateManager::ReportLanguageDetectionError(WebContents* web_contents) { |
671 UMA_HISTOGRAM_COUNTS("Translate.ReportLanguageDetectionError", 1); | 671 UMA_HISTOGRAM_COUNTS("Translate.ReportLanguageDetectionError", 1); |
672 // We'll open the URL in a new tab so that the user can tell us more. | 672 // We'll open the URL in a new tab so that the user can tell us more. |
673 Browser* browser = browser::FindBrowserWithWebContents(web_contents); | 673 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); |
674 if (!browser) { | 674 if (!browser) { |
675 NOTREACHED(); | 675 NOTREACHED(); |
676 return; | 676 return; |
677 } | 677 } |
678 | 678 |
679 GURL page_url = web_contents->GetController().GetActiveEntry()->GetURL(); | 679 GURL page_url = web_contents->GetController().GetActiveEntry()->GetURL(); |
680 // Report option should be disabled for secure URLs. | 680 // Report option should be disabled for secure URLs. |
681 DCHECK(!page_url.SchemeIsSecure()); | 681 DCHECK(!page_url.SchemeIsSecure()); |
682 std::string report_error_url_str(kReportLanguageDetectionErrorURL); | 682 std::string report_error_url_str(kReportLanguageDetectionErrorURL); |
683 report_error_url_str += "?client=cr&action=langidc&u="; | 683 report_error_url_str += "?client=cr&action=langidc&u="; |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
920 | 920 |
921 for (size_t i = 0; i < infobar_helper->GetInfoBarCount(); ++i) { | 921 for (size_t i = 0; i < infobar_helper->GetInfoBarCount(); ++i) { |
922 TranslateInfoBarDelegate* delegate = | 922 TranslateInfoBarDelegate* delegate = |
923 infobar_helper->GetInfoBarDelegateAt(i)-> | 923 infobar_helper->GetInfoBarDelegateAt(i)-> |
924 AsTranslateInfoBarDelegate(); | 924 AsTranslateInfoBarDelegate(); |
925 if (delegate) | 925 if (delegate) |
926 return delegate; | 926 return delegate; |
927 } | 927 } |
928 return NULL; | 928 return NULL; |
929 } | 929 } |
OLD | NEW |