| 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..6e41774a08c50ffc5e96b0de006400dfd6b55a5b 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,24 @@ void RenderViewContextMenu::AppendSpellcheckOptionsSubMenu() {
|
| &spellcheck_submenu_model_);
|
| }
|
|
|
| +void RenderViewContextMenu::AppendSpeechInputOptionsSubMenu() {
|
| + if (params_.speech_input_enabled) {
|
| + speech_input_submenu_model_.AddCheckItem(
|
| + IDC_CONTENT_CONTEXT_SPEECH_INPUT_CENSOR_RESULTS,
|
| + l10n_util::GetStringUTF16(
|
| + IDS_CONTENT_CONTEXT_SPEECH_INPUT_CENSOR_RESULTS));
|
| +
|
| + 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 +1210,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 +1275,11 @@ 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(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 +1692,19 @@ 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: {
|
| + rvh->SpeechInputAbout();
|
| + break;
|
| + }
|
| +
|
| default:
|
| NOTREACHED();
|
| break;
|
|
|