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/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/google/google_util.h" | 9 #include "chrome/browser/google/google_util.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 bool OptionsMenuModel::IsCommandIdEnabled(int command_id) const { | 81 bool OptionsMenuModel::IsCommandIdEnabled(int command_id) const { |
82 switch (command_id) { | 82 switch (command_id) { |
83 case IDC_TRANSLATE_OPTIONS_NEVER_TRANSLATE_LANG : | 83 case IDC_TRANSLATE_OPTIONS_NEVER_TRANSLATE_LANG : |
84 case IDC_TRANSLATE_OPTIONS_NEVER_TRANSLATE_SITE : | 84 case IDC_TRANSLATE_OPTIONS_NEVER_TRANSLATE_SITE : |
85 return !translate_infobar_delegate_->ShouldAlwaysTranslate(); | 85 return !translate_infobar_delegate_->ShouldAlwaysTranslate(); |
86 | 86 |
87 case IDC_TRANSLATE_OPTIONS_ALWAYS : | 87 case IDC_TRANSLATE_OPTIONS_ALWAYS : |
88 return (!translate_infobar_delegate_->IsLanguageBlacklisted() && | 88 return (!translate_infobar_delegate_->IsLanguageBlacklisted() && |
89 !translate_infobar_delegate_->IsSiteBlacklisted()); | 89 !translate_infobar_delegate_->IsSiteBlacklisted()); |
90 | 90 |
| 91 case IDC_TRANSLATE_REPORT_BAD_LANGUAGE_DETECTION : { |
| 92 // Until we have a secure URL for reporting language detection errors, |
| 93 // we don't report errors that happened on secure URLs. |
| 94 return !translate_infobar_delegate_->tab_contents()->controller(). |
| 95 GetActiveEntry()->url().SchemeIsSecure(); |
| 96 } |
91 default: | 97 default: |
92 break; | 98 break; |
93 } | 99 } |
94 return true; | 100 return true; |
95 } | 101 } |
96 | 102 |
97 bool OptionsMenuModel::GetAcceleratorForCommandId( | 103 bool OptionsMenuModel::GetAcceleratorForCommandId( |
98 int command_id, ui::Accelerator* accelerator) { | 104 int command_id, ui::Accelerator* accelerator) { |
99 return false; | 105 return false; |
100 } | 106 } |
(...skipping 28 matching lines...) Expand all Loading... |
129 about_url, GURL(), NEW_FOREGROUND_TAB, PageTransition::LINK); | 135 about_url, GURL(), NEW_FOREGROUND_TAB, PageTransition::LINK); |
130 } | 136 } |
131 break; | 137 break; |
132 } | 138 } |
133 | 139 |
134 default: | 140 default: |
135 NOTREACHED() << "Invalid command id from menu."; | 141 NOTREACHED() << "Invalid command id from menu."; |
136 break; | 142 break; |
137 } | 143 } |
138 } | 144 } |
OLD | NEW |