Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(607)

Side by Side Diff: chrome/browser/translate/options_menu_model.cc

Issue 12261053: Translate: enable bad language detection reports for secure pages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/options_menu_model.h" 5 #include "chrome/browser/translate/options_menu_model.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "chrome/app/chrome_command_ids.h" 8 #include "chrome/app/chrome_command_ids.h"
9 #include "chrome/browser/api/infobars/infobar_service.h" 9 #include "chrome/browser/api/infobars/infobar_service.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 bool OptionsMenuModel::IsCommandIdEnabled(int command_id) const { 78 bool OptionsMenuModel::IsCommandIdEnabled(int command_id) const {
79 switch (command_id) { 79 switch (command_id) {
80 case IDC_TRANSLATE_OPTIONS_NEVER_TRANSLATE_LANG : 80 case IDC_TRANSLATE_OPTIONS_NEVER_TRANSLATE_LANG :
81 case IDC_TRANSLATE_OPTIONS_NEVER_TRANSLATE_SITE : 81 case IDC_TRANSLATE_OPTIONS_NEVER_TRANSLATE_SITE :
82 return !translate_infobar_delegate_->ShouldAlwaysTranslate(); 82 return !translate_infobar_delegate_->ShouldAlwaysTranslate();
83 83
84 case IDC_TRANSLATE_OPTIONS_ALWAYS : 84 case IDC_TRANSLATE_OPTIONS_ALWAYS :
85 return (!translate_infobar_delegate_->IsLanguageBlacklisted() && 85 return (!translate_infobar_delegate_->IsLanguageBlacklisted() &&
86 !translate_infobar_delegate_->IsSiteBlacklisted()); 86 !translate_infobar_delegate_->IsSiteBlacklisted());
87 87
88 case IDC_TRANSLATE_REPORT_BAD_LANGUAGE_DETECTION : {
89 // Until we have a secure URL for reporting language detection errors,
90 // we don't report errors that happened on secure URLs.
91 DCHECK(translate_infobar_delegate_ != NULL);
92 DCHECK(translate_infobar_delegate_->owner() != NULL);
93 DCHECK(translate_infobar_delegate_->owner()->GetWebContents() != NULL);
94 NavigationEntry* entry = translate_infobar_delegate_->owner()->
95 GetWebContents()->GetController().GetActiveEntry();
96 // Delegate and tab contents should never be NULL, but active entry
97 // can be NULL when running tests. We want to return false if NULL.
98 return (entry != NULL) && !entry->GetURL().SchemeIsSecure();
99 }
100 default: 88 default:
101 break; 89 break;
102 } 90 }
103 return true; 91 return true;
104 } 92 }
105 93
106 bool OptionsMenuModel::GetAcceleratorForCommandId( 94 bool OptionsMenuModel::GetAcceleratorForCommandId(
107 int command_id, ui::Accelerator* accelerator) { 95 int command_id, ui::Accelerator* accelerator) {
108 return false; 96 return false;
109 } 97 }
(...skipping 29 matching lines...) Expand all
139 web_contents->OpenURL(params); 127 web_contents->OpenURL(params);
140 } 128 }
141 break; 129 break;
142 } 130 }
143 131
144 default: 132 default:
145 NOTREACHED() << "Invalid command id from menu."; 133 NOTREACHED() << "Invalid command id from menu.";
146 break; 134 break;
147 } 135 }
148 } 136 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698