Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(771)

Unified Diff: chrome/browser/tab_contents/spellchecker_submenu_observer_hunspell.cc

Issue 10548022: Synchronize the check status of the "Check Spelling While Typing" item. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/tab_contents/spellchecker_submenu_observer_hunspell.cc
===================================================================
--- chrome/browser/tab_contents/spellchecker_submenu_observer_hunspell.cc (revision 142020)
+++ chrome/browser/tab_contents/spellchecker_submenu_observer_hunspell.cc (working copy)
@@ -28,7 +28,6 @@
int group)
: proxy_(proxy),
submenu_model_(delegate),
- spellcheck_enabled_(false),
language_group_(group),
language_selected_(0) {
DCHECK(proxy_);
@@ -41,8 +40,6 @@
const content::ContextMenuParams& params) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- spellcheck_enabled_ = params.spellcheck_enabled;
-
// Add available spell-checker languages to the sub menu.
Profile* profile = proxy_->GetProfile();
language_selected_ =
@@ -115,9 +112,7 @@
// Check box for 'Check Spelling while typing'.
if (command_id == IDC_CHECK_SPELLING_WHILE_TYPING) {
Profile* profile = proxy_->GetProfile();
- if (!profile || !profile->GetPrefs()->GetBoolean(prefs::kEnableSpellCheck))
- return false;
- return spellcheck_enabled_;
+ return profile && profile->GetPrefs()->GetBoolean(prefs::kEnableSpellCheck);
jeremy 2012/06/14 14:49:50 nit: can you be more explicite here: if (!profile
Hironori Bono 2012/06/18 07:23:55 Thanks for your comment. I have added a DCHECK() s
}
return false;
@@ -138,8 +133,6 @@
switch (command_id) {
case IDC_CHECK_SPELLING_WHILE_TYPING:
- return pref->GetBoolean(prefs::kEnableSpellCheck);
-
case IDC_SPELLPANEL_TOGGLE:
case IDC_SPELLCHECK_MENU:
return true;
@@ -152,9 +145,9 @@
DCHECK(IsCommandIdSupported(command_id));
// Check to see if one of the spell check language ids have been clicked.
+ Profile* profile = proxy_->GetProfile();
if (command_id >= IDC_SPELLCHECK_LANGUAGES_FIRST &&
command_id < IDC_SPELLCHECK_LANGUAGES_LAST) {
- Profile* profile = proxy_->GetProfile();
const size_t language = command_id - IDC_SPELLCHECK_LANGUAGES_FIRST;
if (profile && language < languages_.size()) {
StringPrefMember dictionary_language;
@@ -169,6 +162,9 @@
content::RenderViewHost* rvh = proxy_->GetRenderViewHost();
switch (command_id) {
case IDC_CHECK_SPELLING_WHILE_TYPING:
+ profile->GetPrefs()->SetBoolean(
jeremy 2012/06/14 14:49:50 Do you need to null-check profile here too?
Hironori Bono 2012/06/18 07:23:55 Thanks for your comment. Same as above, I have add
+ prefs::kEnableSpellCheck,
+ !profile->GetPrefs()->GetBoolean(prefs::kEnableSpellCheck));
rvh->Send(new SpellCheckMsg_ToggleSpellCheck(rvh->GetRoutingID()));
break;
}

Powered by Google App Engine
This is Rietveld 408576698