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

Unified Diff: chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegate.mm

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 | « no previous file | chrome/browser/tab_contents/spellchecker_submenu_observer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegate.mm
===================================================================
--- chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegate.mm (revision 144063)
+++ chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegate.mm (working copy)
@@ -9,14 +9,18 @@
#include "base/mac/closure_blocks_leopard_compat.h"
#include "base/sys_string_conversions.h"
#include "chrome/browser/debugger/devtools_window.h"
+#include "chrome/browser/prefs/pref_service.h"
+#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/spellchecker/spellcheck_platform_mac.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_finder.h"
#import "chrome/browser/ui/cocoa/history_overlay_controller.h"
#import "chrome/browser/ui/cocoa/view_id_util.h"
+#include "chrome/common/pref_names.h"
#include "chrome/common/spellcheck_messages.h"
#include "chrome/common/url_constants.h"
+#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_view_host_observer.h"
#include "content/public/browser/render_widget_host.h"
@@ -291,6 +295,11 @@
if (action == @selector(toggleContinuousSpellChecking:)) {
if ([(id)item respondsToSelector:@selector(setState:)]) {
+ content::RenderProcessHost* host = renderWidgetHost_->GetProcess();
+ Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext());
+ DCHECK(profile);
+ spellcheckChecked_ =
+ profile->GetPrefs()->GetBoolean(prefs::kEnableSpellCheck);
NSCellStateValue checkedState =
spellcheckChecked_ ? NSOnState : NSOffState;
[(id)item setState:checkedState];
@@ -347,6 +356,12 @@
}
- (void)toggleContinuousSpellChecking:(id)sender {
+ content::RenderProcessHost* host = renderWidgetHost_->GetProcess();
+ Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext());
+ DCHECK(profile);
+ PrefService* pref = profile->GetPrefs();
+ pref->SetBoolean(prefs::kEnableSpellCheck,
+ !pref->GetBoolean(prefs::kEnableSpellCheck));
renderWidgetHost_->Send(
new SpellCheckMsg_ToggleSpellCheck(renderWidgetHost_->GetRoutingID()));
}
« no previous file with comments | « no previous file | chrome/browser/tab_contents/spellchecker_submenu_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698