Index: chrome/browser/tab_contents/render_view_context_menu.cc |
diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc |
index eac5c8b32fe1ce2eac46babbf4aabd907280dbc1..0c7ce00696606aa85866f80d9e352ffdcd89a83d 100644 |
--- a/chrome/browser/tab_contents/render_view_context_menu.cc |
+++ b/chrome/browser/tab_contents/render_view_context_menu.cc |
@@ -193,6 +193,7 @@ RenderViewContextMenu::RenderViewContextMenu( |
ALLOW_THIS_IN_INITIALIZER_LIST(menu_model_(this)), |
external_(false), |
ALLOW_THIS_IN_INITIALIZER_LIST(spellcheck_submenu_model_(this)), |
+ ALLOW_THIS_IN_INITIALIZER_LIST(speech_input_submenu_model_(this)), |
ALLOW_THIS_IN_INITIALIZER_LIST(bidi_submenu_model_(this)), |
ALLOW_THIS_IN_INITIALIZER_LIST(protocol_handler_submenu_model_(this)), |
protocol_handler_registry_( |
@@ -793,6 +794,7 @@ void RenderViewContextMenu::AppendEditableItems() { |
} |
AppendSpellcheckOptionsSubMenu(); |
+ AppendSpeechInputOptionsSubMenu(); |
#if defined(OS_MACOSX) |
// OS X provides a contextual menu to set writing direction for BiDi |
@@ -853,6 +855,26 @@ void RenderViewContextMenu::AppendSpellcheckOptionsSubMenu() { |
&spellcheck_submenu_model_); |
} |
+void RenderViewContextMenu::AppendSpeechInputOptionsSubMenu() { |
+ if (params_.speech_input_enabled) { |
+ // Add 'Block offensive words' item in the sub menu. |
Satish
2011/07/19 08:22:39
suggest removing this and the next comment as the
gshires
2011/07/19 22:56:31
Done.
|
+ speech_input_submenu_model_.AddCheckItem( |
+ IDC_CONTENT_CONTEXT_SPEECH_INPUT_CENSOR_RESULTS, |
+ l10n_util::GetStringUTF16( |
+ IDS_CONTENT_CONTEXT_SPEECH_INPUT_CENSOR_RESULTS)); |
+ |
+ // Add 'About voice recognition' item in the sub menu. |
+ speech_input_submenu_model_.AddItemWithStringId( |
+ IDC_CONTENT_CONTEXT_SPEECH_INPUT_ABOUT, |
+ IDS_CONTENT_CONTEXT_SPEECH_INPUT_ABOUT); |
+ |
+ menu_model_.AddSubMenu( |
+ IDC_SPEECH_INPUT_MENU, |
+ l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPEECH_INPUT_MENU), |
+ &speech_input_submenu_model_); |
+ } |
+} |
+ |
#if defined(OS_MACOSX) |
void RenderViewContextMenu::AppendBidiSubMenu() { |
bidi_submenu_model_.AddCheckItem(IDC_WRITING_DIRECTION_DEFAULT, |
@@ -1190,6 +1212,11 @@ bool RenderViewContextMenu::IsCommandIdEnabled(int id) const { |
case IDC_SPELLCHECK_MENU: |
return true; |
+ case IDC_CONTENT_CONTEXT_SPEECH_INPUT_CENSOR_RESULTS: |
+ case IDC_CONTENT_CONTEXT_SPEECH_INPUT_ABOUT: |
+ case IDC_SPEECH_INPUT_MENU: |
+ return true; |
+ |
case IDC_CONTENT_CONTEXT_OPENLINKWITH: |
return true; |
@@ -1250,6 +1277,12 @@ bool RenderViewContextMenu::IsCommandIdChecked(int id) const { |
profile_->GetPrefs()->GetBoolean(prefs::kEnableSpellCheck)); |
} |
+ // Check box for menu item 'Block offensive words'. |
+ if (id == IDC_CONTENT_CONTEXT_SPEECH_INPUT_CENSOR_RESULTS) { |
+ return (profile_->GetPrefs()->GetBoolean( |
Satish
2011/07/19 08:22:39
remove brackets around the return value
gshires
2011/07/19 22:56:31
Done.
|
+ prefs::kSpeechInputCensorResults)); |
+ } |
+ |
// Don't bother getting the display language vector if this isn't a spellcheck |
// language. |
if ((id < IDC_SPELLCHECK_LANGUAGES_FIRST) || |
@@ -1662,6 +1695,18 @@ void RenderViewContextMenu::ExecuteCommand(int id) { |
break; |
} |
+ case IDC_CONTENT_CONTEXT_SPEECH_INPUT_CENSOR_RESULTS: { |
+ PrefService* prefs = profile_->GetPrefs(); |
+ const bool censor = |
+ !prefs->GetBoolean(prefs::kSpeechInputCensorResults); |
+ prefs->SetBoolean(prefs::kSpeechInputCensorResults, censor); |
+ break; |
+ } |
+ case IDC_CONTENT_CONTEXT_SPEECH_INPUT_ABOUT: { |
Satish
2011/07/19 08:22:39
add a newline above?
gshires
2011/07/19 22:56:31
Done.
|
+ rvh->SpeechInputAbout(); |
+ break; |
+ } |
+ |
default: |
NOTREACHED(); |
break; |