Chromium Code Reviews| 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 142657) |
| +++ chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegate.mm (working copy) |
| @@ -9,13 +9,17 @@ |
| #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_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" |
| @@ -290,6 +294,12 @@ |
| if (action == @selector(toggleContinuousSpellChecking:)) { |
| if ([(id)item respondsToSelector:@selector(setState:)]) { |
| + content::RenderProcessHost* host = renderWidgetHost_->GetProcess(); |
| + Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); |
| + if (profile) { |
|
jeremy
2012/06/19 12:14:43
Is this null check still needed?
Hironori Bono
2012/06/21 09:38:18
Thanks for your comment. In my honest opinion, I h
|
| + spellcheckChecked_ = |
| + profile->GetPrefs()->GetBoolean(prefs::kEnableSpellCheck); |
| + } |
| NSCellStateValue checkedState = |
| spellcheckChecked_ ? NSOnState : NSOffState; |
| [(id)item setState:checkedState]; |
| @@ -346,6 +356,13 @@ |
| } |
| - (void)toggleContinuousSpellChecking:(id)sender { |
| + content::RenderProcessHost* host = renderWidgetHost_->GetProcess(); |
| + Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); |
| + if (profile) { |
|
jeremy
2012/06/19 12:14:43
Same question here
Hironori Bono
2012/06/21 09:38:18
Done.
|
| + PrefService* pref = profile->GetPrefs(); |
| + pref->SetBoolean(prefs::kEnableSpellCheck, |
| + !pref->GetBoolean(prefs::kEnableSpellCheck)); |
| + } |
| renderWidgetHost_->Send( |
| new SpellCheckMsg_ToggleSpellCheck(renderWidgetHost_->GetRoutingID())); |
| } |