Chromium Code Reviews| Index: chrome/browser/tab_contents/spellchecker_submenu_observer_mac.cc |
| =================================================================== |
| --- chrome/browser/tab_contents/spellchecker_submenu_observer_mac.cc (revision 142020) |
| +++ chrome/browser/tab_contents/spellchecker_submenu_observer_mac.cc (working copy) |
| @@ -26,8 +26,7 @@ |
| ui::SimpleMenuModel::Delegate* delegate, |
| int group) |
| : proxy_(proxy), |
| - submenu_model_(delegate), |
| - check_spelling_while_typing_(false) { |
| + submenu_model_(delegate) { |
| DCHECK(proxy_); |
| } |
| @@ -38,8 +37,6 @@ |
| const content::ContextMenuParams& params) { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| - check_spelling_while_typing_ = params.spellcheck_enabled; |
| - |
| // Add an item that toggles the spelling panel. |
| submenu_model_.AddCheckItem( |
| IDC_SPELLPANEL_TOGGLE, |
| @@ -84,9 +81,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 check_spelling_while_typing_; |
| + return profile && profile->GetPrefs()->GetBoolean(prefs::kEnableSpellCheck); |
|
jeremy
2012/06/14 14:49:50
same comment about splitting this into an if and e
Hironori Bono
2012/06/18 07:23:55
Thanks for your comment. I have removed this profi
|
| } |
| return false; |
| @@ -99,12 +94,8 @@ |
| if (!profile) |
| return false; |
| - const PrefService* pref = profile->GetPrefs(); |
| - |
| switch (command_id) { |
| case IDC_CHECK_SPELLING_WHILE_TYPING: |
| - return pref->GetBoolean(prefs::kEnableSpellCheck); |
| - |
| case IDC_SPELLPANEL_TOGGLE: |
| case IDC_SPELLCHECK_MENU: |
| case IDC_CONTENT_CONTEXT_SPELLING_TOGGLE: |
| @@ -118,8 +109,12 @@ |
| DCHECK(IsCommandIdSupported(command_id)); |
| content::RenderViewHost* rvh = proxy_->GetRenderViewHost(); |
| + Profile* profile = proxy_->GetProfile(); |
| switch (command_id) { |
| case IDC_CHECK_SPELLING_WHILE_TYPING: |
| + profile->GetPrefs()->SetBoolean( |
|
jeremy
2012/06/14 14:49:50
null-check profile?
Hironori Bono
2012/06/18 07:23:55
Thanks for your comment. I was too focused on sync
|
| + prefs::kEnableSpellCheck, |
| + !profile->GetPrefs()->GetBoolean(prefs::kEnableSpellCheck)); |
| rvh->Send(new SpellCheckMsg_ToggleSpellCheck(rvh->GetRoutingID())); |
| break; |