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

Unified Diff: chrome/browser/tab_contents/spellchecker_submenu_observer_mac.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
« no previous file with comments | « chrome/browser/tab_contents/spellchecker_submenu_observer_hunspell.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tab_contents/spellchecker_submenu_observer_mac.cc
===================================================================
--- chrome/browser/tab_contents/spellchecker_submenu_observer_mac.cc (revision 144063)
+++ 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,8 @@
// 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_;
+ DCHECK(profile);
+ return profile->GetPrefs()->GetBoolean(prefs::kEnableSpellCheck);
}
return false;
@@ -95,16 +91,8 @@
bool SpellCheckerSubMenuObserver::IsCommandIdEnabled(int command_id) {
DCHECK(IsCommandIdSupported(command_id));
- Profile* profile = proxy_->GetProfile();
- 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,9 +106,15 @@
DCHECK(IsCommandIdSupported(command_id));
content::RenderViewHost* rvh = proxy_->GetRenderViewHost();
+ Profile* profile = proxy_->GetProfile();
+ DCHECK(profile);
switch (command_id) {
case IDC_CHECK_SPELLING_WHILE_TYPING:
- rvh->Send(new SpellCheckMsg_ToggleSpellCheck(rvh->GetRoutingID()));
+ profile->GetPrefs()->SetBoolean(
+ prefs::kEnableSpellCheck,
+ !profile->GetPrefs()->GetBoolean(prefs::kEnableSpellCheck));
+ if (rvh)
+ rvh->Send(new SpellCheckMsg_ToggleSpellCheck(rvh->GetRoutingID()));
break;
case IDC_SPELLPANEL_TOGGLE:
« no previous file with comments | « chrome/browser/tab_contents/spellchecker_submenu_observer_hunspell.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698