Chromium Code Reviews| 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 DCHECK(translate_infobar_delegate_ != NULL); | |
| 95 TabContents* tab_contents = translate_infobar_delegate_->tab_contents(); | |
| 96 if (tab_contents) { | |
|
jochen (gone - plz use gerrit)
2011/09/30 18:22:22
I think tab_contents can't be NULL. The constructo
| |
| 97 NavigationEntry* entry = tab_contents->controller().GetActiveEntry(); | |
| 98 if (entry) | |
|
jochen (gone - plz use gerrit)
2011/09/30 18:22:22
shouldn't we rather return false if there's no ent
| |
| 99 return !entry->url().SchemeIsSecure(); | |
| 100 } | |
| 101 } | |
| 91 default: | 102 default: |
| 92 break; | 103 break; |
| 93 } | 104 } |
| 94 return true; | 105 return true; |
| 95 } | 106 } |
| 96 | 107 |
| 97 bool OptionsMenuModel::GetAcceleratorForCommandId( | 108 bool OptionsMenuModel::GetAcceleratorForCommandId( |
| 98 int command_id, ui::Accelerator* accelerator) { | 109 int command_id, ui::Accelerator* accelerator) { |
| 99 return false; | 110 return false; |
| 100 } | 111 } |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 129 about_url, GURL(), NEW_FOREGROUND_TAB, PageTransition::LINK); | 140 about_url, GURL(), NEW_FOREGROUND_TAB, PageTransition::LINK); |
| 130 } | 141 } |
| 131 break; | 142 break; |
| 132 } | 143 } |
| 133 | 144 |
| 134 default: | 145 default: |
| 135 NOTREACHED() << "Invalid command id from menu."; | 146 NOTREACHED() << "Invalid command id from menu."; |
| 136 break; | 147 break; |
| 137 } | 148 } |
| 138 } | 149 } |
| OLD | NEW |