diff options
author | leandrogracia@chromium.org <leandrogracia@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-08 11:04:59 +0000 |
---|---|---|
committer | leandrogracia@chromium.org <leandrogracia@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-08 11:04:59 +0000 |
commit | 9af487d4c521414c9f006ae342d3b9974f5a6bed (patch) | |
tree | e6be4ee402e4638f38330f7ef64cda5799082728 | |
parent | 36c4a17155a08f8ca36bbc7760ecfc97c6a348db (diff) | |
download | chromium_src-9af487d4c521414c9f006ae342d3b9974f5a6bed.zip chromium_src-9af487d4c521414c9f006ae342d3b9974f5a6bed.tar.gz chromium_src-9af487d4c521414c9f006ae342d3b9974f5a6bed.tar.bz2 |
Fixing misleading name in a speech input setting and related variables.
This patch replaces all occurrences of 'censor results' with 'filter profanities', which is a much accurate description of what it does and avoids unfortunate confusions.
BUG=79991
TEST=none
Review URL: http://codereview.chromium.org/8199010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104653 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/app/chrome_command_ids.h | 2 | ||||
-rw-r--r-- | chrome/app/generated_resources.grd | 4 | ||||
-rw-r--r-- | chrome/browser/profiles/profile.cc | 2 | ||||
-rw-r--r-- | chrome/browser/profiles/profile_impl.cc | 8 | ||||
-rw-r--r-- | chrome/browser/speech/chrome_speech_input_preferences.cc | 17 | ||||
-rw-r--r-- | chrome/browser/speech/chrome_speech_input_preferences.h | 6 | ||||
-rw-r--r-- | chrome/browser/tab_contents/render_view_context_menu.cc | 20 | ||||
-rw-r--r-- | chrome/common/pref_names.cc | 3 | ||||
-rw-r--r-- | chrome/common/pref_names.h | 2 | ||||
-rw-r--r-- | content/browser/speech/speech_input_manager.cc | 2 | ||||
-rw-r--r-- | content/browser/speech/speech_input_preferences.h | 4 | ||||
-rw-r--r-- | content/browser/speech/speech_recognition_request.cc | 4 | ||||
-rw-r--r-- | content/browser/speech/speech_recognition_request.h | 2 | ||||
-rw-r--r-- | content/browser/speech/speech_recognizer.cc | 6 | ||||
-rw-r--r-- | content/browser/speech/speech_recognizer.h | 4 | ||||
-rw-r--r-- | content/shell/shell_browser_context.cc | 4 |
16 files changed, 47 insertions, 43 deletions
diff --git a/chrome/app/chrome_command_ids.h b/chrome/app/chrome_command_ids.h index d676b5d..21433b3 100644 --- a/chrome/app/chrome_command_ids.h +++ b/chrome/app/chrome_command_ids.h @@ -291,7 +291,7 @@ // Context menu items for speech recognition #define IDC_SPEECH_INPUT_MENU 51200 -#define IDC_CONTENT_CONTEXT_SPEECH_INPUT_CENSOR_RESULTS 51201 +#define IDC_CONTENT_CONTEXT_SPEECH_INPUT_FILTER_PROFANITIES 51201 #define IDC_CONTENT_CONTEXT_SPEECH_INPUT_ABOUT 51202 // Protocol handler menu entries diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 1a7ad7f..a89f21b 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -526,7 +526,7 @@ are declared in build/common.gypi. <message name="IDS_CONTENT_CONTEXT_SPEECH_INPUT_MENU" desc="The name of the Speech input options submenu in the content area context menu"> Voice recognition options </message> - <message name="IDS_CONTENT_CONTEXT_SPEECH_INPUT_CENSOR_RESULTS" desc="The name of the offensive word filtering command in the content area context menu"> + <message name="IDS_CONTENT_CONTEXT_SPEECH_INPUT_FILTER_PROFANITIES" desc="The name of the offensive word filtering command in the content area context menu"> Block offensive words </message> <message name="IDS_CONTENT_CONTEXT_SPEECH_INPUT_ABOUT" desc="The name of the Speech input About command in the content area context menu"> @@ -726,7 +726,7 @@ are declared in build/common.gypi. <message name="IDS_CONTENT_CONTEXT_SPEECH_INPUT_MENU" desc="In Title Case: The name of the Speech input options submenu in the content area context menu"> Voice Recognition Options </message> - <message name="IDS_CONTENT_CONTEXT_SPEECH_INPUT_CENSOR_RESULTS" desc="In Title Case: The name of the offensive word filtering command in the content area context menu"> + <message name="IDS_CONTENT_CONTEXT_SPEECH_INPUT_FILTER_PROFANITIES" desc="In Title Case: The name of the offensive word filtering command in the content area context menu"> Block Offensive Words </message> <message name="IDS_CONTENT_CONTEXT_SPEECH_INPUT_ABOUT" desc="In Title Case: The name of the Speech input About command in the content area context menu"> diff --git a/chrome/browser/profiles/profile.cc b/chrome/browser/profiles/profile.cc index df0cdb4..f1a1ebe 100644 --- a/chrome/browser/profiles/profile.cc +++ b/chrome/browser/profiles/profile.cc @@ -140,7 +140,7 @@ void Profile::RegisterUserPrefs(PrefService* prefs) { prefs->RegisterBooleanPref(prefs::kEnableAutoSpellCorrect, true, PrefService::UNSYNCABLE_PREF); - prefs->RegisterBooleanPref(prefs::kSpeechInputCensorResults, + prefs->RegisterBooleanPref(prefs::kSpeechInputFilterProfanities, true, PrefService::UNSYNCABLE_PREF); #if defined(TOOLKIT_USES_GTK) diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc index b76b3df..f3eedcf9 100644 --- a/chrome/browser/profiles/profile_impl.cc +++ b/chrome/browser/profiles/profile_impl.cc @@ -374,7 +374,7 @@ void ProfileImpl::DoFinalInit() { pref_change_registrar_.Add(prefs::kSpellCheckDictionary, this); pref_change_registrar_.Add(prefs::kEnableSpellCheck, this); pref_change_registrar_.Add(prefs::kEnableAutoSpellCorrect, this); - pref_change_registrar_.Add(prefs::kSpeechInputCensorResults, this); + pref_change_registrar_.Add(prefs::kSpeechInputFilterProfanities, this); pref_change_registrar_.Add(prefs::kClearSiteDataOnExit, this); pref_change_registrar_.Add(prefs::kGoogleServicesUsername, this); pref_change_registrar_.Add(prefs::kDefaultZoomLevel, this); @@ -1500,9 +1500,9 @@ void ProfileImpl::Observe(int type, RenderProcessHost* process = i.GetCurrentValue(); process->Send(new SpellCheckMsg_EnableAutoSpellCorrect(enabled)); } - } else if (*pref_name_in == prefs::kSpeechInputCensorResults) { - GetSpeechInputPreferences()->set_censor_results(prefs->GetBoolean( - prefs::kSpeechInputCensorResults)); + } else if (*pref_name_in == prefs::kSpeechInputFilterProfanities) { + GetSpeechInputPreferences()->set_filter_profanities(prefs->GetBoolean( + prefs::kSpeechInputFilterProfanities)); } else if (*pref_name_in == prefs::kClearSiteDataOnExit) { clear_local_state_on_exit_ = prefs->GetBoolean(prefs::kClearSiteDataOnExit); diff --git a/chrome/browser/speech/chrome_speech_input_preferences.cc b/chrome/browser/speech/chrome_speech_input_preferences.cc index e6a2982..ff88d31 100644 --- a/chrome/browser/speech/chrome_speech_input_preferences.cc +++ b/chrome/browser/speech/chrome_speech_input_preferences.cc @@ -11,25 +11,26 @@ ChromeSpeechInputPreferences::ChromeSpeechInputPreferences( PrefService* pref_service) - : censor_results_( - pref_service->GetBoolean(prefs::kSpeechInputCensorResults)) { + : filter_profanities_( + pref_service->GetBoolean(prefs::kSpeechInputFilterProfanities)) { } ChromeSpeechInputPreferences::~ChromeSpeechInputPreferences() { } -bool ChromeSpeechInputPreferences::censor_results() const { +bool ChromeSpeechInputPreferences::filter_profanities() const { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); - return censor_results_; + return filter_profanities_; } -void ChromeSpeechInputPreferences::set_censor_results(bool censor_results) { +void ChromeSpeechInputPreferences::set_filter_profanities( + bool filter_profanities) { if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, - base::Bind(&ChromeSpeechInputPreferences::set_censor_results, - this, censor_results)); + base::Bind(&ChromeSpeechInputPreferences::set_filter_profanities, + this, filter_profanities)); return; } - censor_results_ = censor_results; + filter_profanities_ = filter_profanities; } diff --git a/chrome/browser/speech/chrome_speech_input_preferences.h b/chrome/browser/speech/chrome_speech_input_preferences.h index feca5a6..ebfef3b 100644 --- a/chrome/browser/speech/chrome_speech_input_preferences.h +++ b/chrome/browser/speech/chrome_speech_input_preferences.h @@ -17,14 +17,14 @@ class ChromeSpeechInputPreferences : public SpeechInputPreferences { explicit ChromeSpeechInputPreferences(PrefService* pref_service); // SpeechInputPreferences methods. - virtual bool censor_results() const OVERRIDE; - virtual void set_censor_results(bool censor_results) OVERRIDE; + virtual bool filter_profanities() const OVERRIDE; + virtual void set_filter_profanities(bool filter_profanities) OVERRIDE; private: virtual ~ChromeSpeechInputPreferences(); // Only to be accessed and modified on the IO thread. - bool censor_results_; + bool filter_profanities_; DISALLOW_COPY_AND_ASSIGN(ChromeSpeechInputPreferences); }; diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc index 04f5240..8022aee 100644 --- a/chrome/browser/tab_contents/render_view_context_menu.cc +++ b/chrome/browser/tab_contents/render_view_context_menu.cc @@ -945,9 +945,9 @@ void RenderViewContextMenu::AppendSpellcheckOptionsSubMenu() { void RenderViewContextMenu::AppendSpeechInputOptionsSubMenu() { if (params_.speech_input_enabled) { speech_input_submenu_model_.AddCheckItem( - IDC_CONTENT_CONTEXT_SPEECH_INPUT_CENSOR_RESULTS, + IDC_CONTENT_CONTEXT_SPEECH_INPUT_FILTER_PROFANITIES, l10n_util::GetStringUTF16( - IDS_CONTENT_CONTEXT_SPEECH_INPUT_CENSOR_RESULTS)); + IDS_CONTENT_CONTEXT_SPEECH_INPUT_FILTER_PROFANITIES)); speech_input_submenu_model_.AddItemWithStringId( IDC_CONTENT_CONTEXT_SPEECH_INPUT_ABOUT, @@ -1311,7 +1311,7 @@ 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_FILTER_PROFANITIES: case IDC_CONTENT_CONTEXT_SPEECH_INPUT_ABOUT: case IDC_SPEECH_INPUT_MENU: return true; @@ -1377,8 +1377,9 @@ bool RenderViewContextMenu::IsCommandIdChecked(int id) const { } // Check box for menu item 'Block offensive words'. - if (id == IDC_CONTENT_CONTEXT_SPEECH_INPUT_CENSOR_RESULTS) { - return profile_->GetPrefs()->GetBoolean(prefs::kSpeechInputCensorResults); + if (id == IDC_CONTENT_CONTEXT_SPEECH_INPUT_FILTER_PROFANITIES) { + return profile_->GetPrefs()->GetBoolean( + prefs::kSpeechInputFilterProfanities); } // Don't bother getting the display language vector if this isn't a spellcheck @@ -1832,11 +1833,12 @@ void RenderViewContextMenu::ExecuteCommand(int id, int event_flags) { break; } - case IDC_CONTENT_CONTEXT_SPEECH_INPUT_CENSOR_RESULTS: { + case IDC_CONTENT_CONTEXT_SPEECH_INPUT_FILTER_PROFANITIES: { PrefService* prefs = profile_->GetPrefs(); - const bool censor = !prefs->GetBoolean(prefs::kSpeechInputCensorResults); - prefs->SetBoolean(prefs::kSpeechInputCensorResults, censor); - profile_->GetSpeechInputPreferences()->set_censor_results(censor); + const bool filter = !prefs->GetBoolean( + prefs::kSpeechInputFilterProfanities); + prefs->SetBoolean(prefs::kSpeechInputFilterProfanities, filter); + profile_->GetSpeechInputPreferences()->set_filter_profanities(filter); break; } diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index 1a23967..6bd9a6d 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc @@ -603,7 +603,8 @@ const char kEnabledLabsExperiments[] = "browser.enabled_labs_experiments"; const char kEnableAutoSpellCorrect[] = "browser.enable_autospellcorrect"; // Boolean pref to define the default setting for "block offensive words". -const char kSpeechInputCensorResults[] = +// The old key value is kept to avoid unnecessary migration code. +const char kSpeechInputFilterProfanities[] = "browser.speechinput_censor_results"; // Boolean controlling whether history saving is disabled. diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h index 58628ab..5524115 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h @@ -220,7 +220,7 @@ extern const char kDeleteCookies[]; extern const char kDeletePasswords[]; extern const char kDeleteFormData[]; extern const char kEnableSpellCheck[]; -extern const char kSpeechInputCensorResults[]; +extern const char kSpeechInputFilterProfanities[]; extern const char kEnabledLabsExperiments[]; extern const char kEnableAutoSpellCorrect[]; extern const char kSavingBrowserHistoryDisabled[]; diff --git a/content/browser/speech/speech_input_manager.cc b/content/browser/speech/speech_input_manager.cc index f3f6402..2f29f77 100644 --- a/content/browser/speech/speech_input_manager.cc +++ b/content/browser/speech/speech_input_manager.cc @@ -65,7 +65,7 @@ void SpeechInputManager::StartRecognition( request->delegate = delegate; request->recognizer = new SpeechRecognizer( this, caller_id, language, grammar, context_getter, - speech_input_prefs->censor_results(), + speech_input_prefs->filter_profanities(), request_info_, can_report_metrics_ ? origin_url : ""); request->is_active = false; diff --git a/content/browser/speech/speech_input_preferences.h b/content/browser/speech/speech_input_preferences.h index c4536ed..a684cd5 100644 --- a/content/browser/speech/speech_input_preferences.h +++ b/content/browser/speech/speech_input_preferences.h @@ -15,9 +15,9 @@ class CONTENT_EXPORT SpeechInputPreferences SpeechInputPreferences(); // Only to be called on the IO thread. - virtual bool censor_results() const = 0; + virtual bool filter_profanities() const = 0; - virtual void set_censor_results(bool censor_results) = 0; + virtual void set_filter_profanities(bool filter_profanities) = 0; protected: virtual ~SpeechInputPreferences(); diff --git a/content/browser/speech/speech_recognition_request.cc b/content/browser/speech/speech_recognition_request.cc index 3a2ad7c..c61c134 100644 --- a/content/browser/speech/speech_recognition_request.cc +++ b/content/browser/speech/speech_recognition_request.cc @@ -148,7 +148,7 @@ SpeechRecognitionRequest::~SpeechRecognitionRequest() {} void SpeechRecognitionRequest::Start(const std::string& language, const std::string& grammar, - bool censor_results, + bool filter_profanities, const std::string& hardware_info, const std::string& origin_url, const std::string& content_type) { @@ -177,7 +177,7 @@ void SpeechRecognitionRequest::Start(const std::string& language, if (!hardware_info.empty()) parts.push_back("xhw=" + net::EscapeQueryParamValue(hardware_info, true)); parts.push_back("maxresults=" + base::IntToString(kMaxResults)); - parts.push_back(censor_results ? "pfilter=2" : "pfilter=0"); + parts.push_back(filter_profanities ? "pfilter=2" : "pfilter=0"); GURL url(std::string(kDefaultSpeechRecognitionUrl) + JoinString(parts, '&')); diff --git a/content/browser/speech/speech_recognition_request.h b/content/browser/speech/speech_recognition_request.h index 346951a..2382123 100644 --- a/content/browser/speech/speech_recognition_request.h +++ b/content/browser/speech/speech_recognition_request.h @@ -51,7 +51,7 @@ class SpeechRecognitionRequest : public URLFetcher::Delegate { // previous request has completed. CONTENT_EXPORT void Start(const std::string& language, const std::string& grammar, - bool censor_results, + bool filter_profanities, const std::string& hardware_info, const std::string& origin_url, const std::string& content_type); diff --git a/content/browser/speech/speech_recognizer.cc b/content/browser/speech/speech_recognizer.cc index f81128c..a54c10f 100644 --- a/content/browser/speech/speech_recognizer.cc +++ b/content/browser/speech/speech_recognizer.cc @@ -58,14 +58,14 @@ SpeechRecognizer::SpeechRecognizer(Delegate* delegate, const std::string& language, const std::string& grammar, net::URLRequestContextGetter* context_getter, - bool censor_results, + bool filter_profanities, const std::string& hardware_info, const std::string& origin_url) : delegate_(delegate), caller_id_(caller_id), language_(language), grammar_(grammar), - censor_results_(censor_results), + filter_profanities_(filter_profanities), hardware_info_(hardware_info), origin_url_(origin_url), context_getter_(context_getter), @@ -228,7 +228,7 @@ void SpeechRecognizer::HandleOnData(string* data) { // server to send the data and inform the delegate. delegate_->DidStartReceivingAudio(caller_id_); request_.reset(new SpeechRecognitionRequest(context_getter_.get(), this)); - request_->Start(language_, grammar_, censor_results_, + request_->Start(language_, grammar_, filter_profanities_, hardware_info_, origin_url_, encoder_->mime_type()); } diff --git a/content/browser/speech/speech_recognizer.h b/content/browser/speech/speech_recognizer.h index 1e3061a..b62c558 100644 --- a/content/browser/speech/speech_recognizer.h +++ b/content/browser/speech/speech_recognizer.h @@ -85,7 +85,7 @@ class CONTENT_EXPORT SpeechRecognizer const std::string& language, const std::string& grammar, net::URLRequestContextGetter* context_getter, - bool censor_results, + bool filter_profanities, const std::string& hardware_info, const std::string& origin_url); @@ -135,7 +135,7 @@ class CONTENT_EXPORT SpeechRecognizer int caller_id_; std::string language_; std::string grammar_; - bool censor_results_; + bool filter_profanities_; std::string hardware_info_; std::string origin_url_; diff --git a/content/shell/shell_browser_context.cc b/content/shell/shell_browser_context.cc index 11e0475..28b4f2a 100644 --- a/content/shell/shell_browser_context.cc +++ b/content/shell/shell_browser_context.cc @@ -63,11 +63,11 @@ class ShellSpeechInputPreferences : public SpeechInputPreferences { } // SpeechInputPreferences implementation. - virtual bool censor_results() const OVERRIDE { + virtual bool filter_profanities() const OVERRIDE { return false; } - virtual void set_censor_results(bool censor_results) OVERRIDE { + virtual void set_filter_profanities(bool filter_profanities) OVERRIDE { } private: |