diff options
author | mad@chromium.org <mad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-03 20:15:21 +0000 |
---|---|---|
committer | mad@chromium.org <mad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-03 20:15:21 +0000 |
commit | 3097be47f6b1002976252dfcc46234fca903beaa (patch) | |
tree | faecc70ac891d102115a5bf18356a6a515e802d9 /chrome/browser/translate | |
parent | 6e6a0f5f3d7e4ffa39bf8a2d3057bbaf56f7f6aa (diff) | |
download | chromium_src-3097be47f6b1002976252dfcc46234fca903beaa.zip chromium_src-3097be47f6b1002976252dfcc46234fca903beaa.tar.gz chromium_src-3097be47f6b1002976252dfcc46234fca903beaa.tar.bz2 |
Disable the error reporting option for secured URL.
When there is a translate error, we should not let users report them because the report includes the sercured URL which would get compromised.
BUG=98441
TEST=Make sure the option is always disabled for secured (httpS) urls, and always enabled otherwise...
Review URL: http://codereview.chromium.org/8086025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103768 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/translate')
-rw-r--r-- | chrome/browser/translate/options_menu_model.cc | 12 | ||||
-rw-r--r-- | chrome/browser/translate/translate_manager.cc | 2 |
2 files changed, 14 insertions, 0 deletions
diff --git a/chrome/browser/translate/options_menu_model.cc b/chrome/browser/translate/options_menu_model.cc index ce52693..eaec3e20d 100644 --- a/chrome/browser/translate/options_menu_model.cc +++ b/chrome/browser/translate/options_menu_model.cc @@ -89,6 +89,18 @@ bool OptionsMenuModel::IsCommandIdEnabled(int command_id) const { return (!translate_infobar_delegate_->IsLanguageBlacklisted() && !translate_infobar_delegate_->IsSiteBlacklisted()); + case IDC_TRANSLATE_REPORT_BAD_LANGUAGE_DETECTION : { + // Until we have a secure URL for reporting language detection errors, + // we don't report errors that happened on secure URLs. + DCHECK(translate_infobar_delegate_ != NULL); + DCHECK(translate_infobar_delegate_->owner() != NULL); + DCHECK(translate_infobar_delegate_->owner()->tab_contents() != NULL); + NavigationEntry* entry = translate_infobar_delegate_->owner()-> + tab_contents()->controller().GetActiveEntry(); + // Delegate and tab contents should never be NULL, but active entry + // can be NULL when running tests. We want to return false if NULL. + return (entry != NULL) && !entry->url().SchemeIsSecure(); + } default: break; } diff --git a/chrome/browser/translate/translate_manager.cc b/chrome/browser/translate/translate_manager.cc index dd6033c..5d4ee67 100644 --- a/chrome/browser/translate/translate_manager.cc +++ b/chrome/browser/translate/translate_manager.cc @@ -594,6 +594,8 @@ void TranslateManager::RevertTranslation(TabContents* tab_contents) { void TranslateManager::ReportLanguageDetectionError(TabContents* tab_contents) { UMA_HISTOGRAM_COUNTS("Translate.ReportLanguageDetectionError", 1); GURL page_url = tab_contents->controller().GetActiveEntry()->url(); + // Report option should be disabled for secure URLs. + DCHECK(!page_url.SchemeIsSecure()); std::string report_error_url(kReportLanguageDetectionErrorURL); report_error_url += "?client=cr&action=langidc&u="; report_error_url += EscapeUrlEncodedData(page_url.spec(), true); |