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 <algorithm> | 5 #include <algorithm> |
6 #include <set> | 6 #include <set> |
7 | 7 |
8 #include "chrome/browser/tab_contents/render_view_context_menu.h" | 8 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
938 | 938 |
939 menu_model_.AddSubMenu( | 939 menu_model_.AddSubMenu( |
940 IDC_SPELLCHECK_MENU, | 940 IDC_SPELLCHECK_MENU, |
941 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPELLCHECK_MENU), | 941 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPELLCHECK_MENU), |
942 &spellcheck_submenu_model_); | 942 &spellcheck_submenu_model_); |
943 } | 943 } |
944 | 944 |
945 void RenderViewContextMenu::AppendSpeechInputOptionsSubMenu() { | 945 void RenderViewContextMenu::AppendSpeechInputOptionsSubMenu() { |
946 if (params_.speech_input_enabled) { | 946 if (params_.speech_input_enabled) { |
947 speech_input_submenu_model_.AddCheckItem( | 947 speech_input_submenu_model_.AddCheckItem( |
948 IDC_CONTENT_CONTEXT_SPEECH_INPUT_CENSOR_RESULTS, | 948 IDC_CONTENT_CONTEXT_SPEECH_INPUT_FILTER_PROFANITIES, |
949 l10n_util::GetStringUTF16( | 949 l10n_util::GetStringUTF16( |
950 IDS_CONTENT_CONTEXT_SPEECH_INPUT_CENSOR_RESULTS)); | 950 IDS_CONTENT_CONTEXT_SPEECH_INPUT_FILTER_PROFANITIES)); |
951 | 951 |
952 speech_input_submenu_model_.AddItemWithStringId( | 952 speech_input_submenu_model_.AddItemWithStringId( |
953 IDC_CONTENT_CONTEXT_SPEECH_INPUT_ABOUT, | 953 IDC_CONTENT_CONTEXT_SPEECH_INPUT_ABOUT, |
954 IDS_CONTENT_CONTEXT_SPEECH_INPUT_ABOUT); | 954 IDS_CONTENT_CONTEXT_SPEECH_INPUT_ABOUT); |
955 | 955 |
956 menu_model_.AddSubMenu( | 956 menu_model_.AddSubMenu( |
957 IDC_SPEECH_INPUT_MENU, | 957 IDC_SPEECH_INPUT_MENU, |
958 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPEECH_INPUT_MENU), | 958 l10n_util::GetStringUTF16(IDS_CONTENT_CONTEXT_SPEECH_INPUT_MENU), |
959 &speech_input_submenu_model_); | 959 &speech_input_submenu_model_); |
960 } | 960 } |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1304 case IDC_INPUT_METHODS_MENU: | 1304 case IDC_INPUT_METHODS_MENU: |
1305 return true; | 1305 return true; |
1306 #endif | 1306 #endif |
1307 | 1307 |
1308 case IDC_CONTENT_CONTEXT_ADDSEARCHENGINE: | 1308 case IDC_CONTENT_CONTEXT_ADDSEARCHENGINE: |
1309 return !params_.keyword_url.is_empty(); | 1309 return !params_.keyword_url.is_empty(); |
1310 | 1310 |
1311 case IDC_SPELLCHECK_MENU: | 1311 case IDC_SPELLCHECK_MENU: |
1312 return true; | 1312 return true; |
1313 | 1313 |
1314 case IDC_CONTENT_CONTEXT_SPEECH_INPUT_CENSOR_RESULTS: | 1314 case IDC_CONTENT_CONTEXT_SPEECH_INPUT_FILTER_PROFANITIES: |
1315 case IDC_CONTENT_CONTEXT_SPEECH_INPUT_ABOUT: | 1315 case IDC_CONTENT_CONTEXT_SPEECH_INPUT_ABOUT: |
1316 case IDC_SPEECH_INPUT_MENU: | 1316 case IDC_SPEECH_INPUT_MENU: |
1317 return true; | 1317 return true; |
1318 | 1318 |
1319 case IDC_CONTENT_CONTEXT_OPENLINKWITH: | 1319 case IDC_CONTENT_CONTEXT_OPENLINKWITH: |
1320 return true; | 1320 return true; |
1321 | 1321 |
1322 case IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_SETTINGS: | 1322 case IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_SETTINGS: |
1323 return true; | 1323 return true; |
1324 | 1324 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1370 return false; | 1370 return false; |
1371 #endif // OS_MACOSX | 1371 #endif // OS_MACOSX |
1372 | 1372 |
1373 // Check box for 'Check the Spelling of this field'. | 1373 // Check box for 'Check the Spelling of this field'. |
1374 if (id == IDC_CHECK_SPELLING_OF_THIS_FIELD) { | 1374 if (id == IDC_CHECK_SPELLING_OF_THIS_FIELD) { |
1375 return (params_.spellcheck_enabled && | 1375 return (params_.spellcheck_enabled && |
1376 profile_->GetPrefs()->GetBoolean(prefs::kEnableSpellCheck)); | 1376 profile_->GetPrefs()->GetBoolean(prefs::kEnableSpellCheck)); |
1377 } | 1377 } |
1378 | 1378 |
1379 // Check box for menu item 'Block offensive words'. | 1379 // Check box for menu item 'Block offensive words'. |
1380 if (id == IDC_CONTENT_CONTEXT_SPEECH_INPUT_CENSOR_RESULTS) { | 1380 if (id == IDC_CONTENT_CONTEXT_SPEECH_INPUT_FILTER_PROFANITIES) { |
1381 return profile_->GetPrefs()->GetBoolean(prefs::kSpeechInputCensorResults); | 1381 return profile_->GetPrefs()->GetBoolean( |
| 1382 prefs::kSpeechInputFilterProfanities); |
1382 } | 1383 } |
1383 | 1384 |
1384 // Don't bother getting the display language vector if this isn't a spellcheck | 1385 // Don't bother getting the display language vector if this isn't a spellcheck |
1385 // language. | 1386 // language. |
1386 if ((id < IDC_SPELLCHECK_LANGUAGES_FIRST) || | 1387 if ((id < IDC_SPELLCHECK_LANGUAGES_FIRST) || |
1387 (id >= IDC_SPELLCHECK_LANGUAGES_LAST)) | 1388 (id >= IDC_SPELLCHECK_LANGUAGES_LAST)) |
1388 return false; | 1389 return false; |
1389 | 1390 |
1390 std::vector<std::string> languages; | 1391 std::vector<std::string> languages; |
1391 return SpellCheckHost::GetSpellCheckLanguages(profile_, &languages) == | 1392 return SpellCheckHost::GetSpellCheckLanguages(profile_, &languages) == |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1825 if (tab_contents_wrapper && | 1826 if (tab_contents_wrapper && |
1826 tab_contents_wrapper->search_engine_tab_helper() && | 1827 tab_contents_wrapper->search_engine_tab_helper() && |
1827 tab_contents_wrapper->search_engine_tab_helper()->delegate()) { | 1828 tab_contents_wrapper->search_engine_tab_helper()->delegate()) { |
1828 // Takes ownership of |template_url|. | 1829 // Takes ownership of |template_url|. |
1829 tab_contents_wrapper->search_engine_tab_helper()->delegate()-> | 1830 tab_contents_wrapper->search_engine_tab_helper()->delegate()-> |
1830 ConfirmAddSearchProvider(template_url.release(), profile_); | 1831 ConfirmAddSearchProvider(template_url.release(), profile_); |
1831 } | 1832 } |
1832 break; | 1833 break; |
1833 } | 1834 } |
1834 | 1835 |
1835 case IDC_CONTENT_CONTEXT_SPEECH_INPUT_CENSOR_RESULTS: { | 1836 case IDC_CONTENT_CONTEXT_SPEECH_INPUT_FILTER_PROFANITIES: { |
1836 PrefService* prefs = profile_->GetPrefs(); | 1837 PrefService* prefs = profile_->GetPrefs(); |
1837 const bool censor = !prefs->GetBoolean(prefs::kSpeechInputCensorResults); | 1838 const bool filter = !prefs->GetBoolean( |
1838 prefs->SetBoolean(prefs::kSpeechInputCensorResults, censor); | 1839 prefs::kSpeechInputFilterProfanities); |
1839 profile_->GetSpeechInputPreferences()->set_censor_results(censor); | 1840 prefs->SetBoolean(prefs::kSpeechInputFilterProfanities, filter); |
| 1841 profile_->GetSpeechInputPreferences()->set_filter_profanities(filter); |
1840 break; | 1842 break; |
1841 } | 1843 } |
1842 | 1844 |
1843 case IDC_CONTENT_CONTEXT_SPEECH_INPUT_ABOUT: { | 1845 case IDC_CONTENT_CONTEXT_SPEECH_INPUT_ABOUT: { |
1844 GURL url(chrome::kSpeechInputAboutURL); | 1846 GURL url(chrome::kSpeechInputAboutURL); |
1845 GURL localized_url = google_util::AppendGoogleLocaleParam(url); | 1847 GURL localized_url = google_util::AppendGoogleLocaleParam(url); |
1846 // Open URL with no referrer field (because user clicked on menu item). | 1848 // Open URL with no referrer field (because user clicked on menu item). |
1847 OpenURL(localized_url, GURL(), 0, NEW_FOREGROUND_TAB, | 1849 OpenURL(localized_url, GURL(), 0, NEW_FOREGROUND_TAB, |
1848 PageTransition::LINK); | 1850 PageTransition::LINK); |
1849 break; | 1851 break; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1947 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), | 1949 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), |
1948 g_browser_process->clipboard()); | 1950 g_browser_process->clipboard()); |
1949 } | 1951 } |
1950 | 1952 |
1951 void RenderViewContextMenu::MediaPlayerActionAt( | 1953 void RenderViewContextMenu::MediaPlayerActionAt( |
1952 const gfx::Point& location, | 1954 const gfx::Point& location, |
1953 const WebMediaPlayerAction& action) { | 1955 const WebMediaPlayerAction& action) { |
1954 source_tab_contents_->render_view_host()-> | 1956 source_tab_contents_->render_view_host()-> |
1955 ExecuteMediaPlayerActionAtLocation(location, action); | 1957 ExecuteMediaPlayerActionAtLocation(location, action); |
1956 } | 1958 } |
OLD | NEW |