| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegat
e.h" | 5 #import "chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegat
e.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/sys_string_conversions.h" | 9 #include "base/sys_string_conversions.h" |
| 10 #include "chrome/browser/debugger/devtools_window.h" | 10 #include "chrome/browser/debugger/devtools_window.h" |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 SEL action = [item action]; | 285 SEL action = [item action]; |
| 286 | 286 |
| 287 // For now, this action is always enabled for render view; | 287 // For now, this action is always enabled for render view; |
| 288 // this is sub-optimal. | 288 // this is sub-optimal. |
| 289 // TODO(suzhe): Plumb the "can*" methods up from WebCore. | 289 // TODO(suzhe): Plumb the "can*" methods up from WebCore. |
| 290 if (action == @selector(checkSpelling:)) { | 290 if (action == @selector(checkSpelling:)) { |
| 291 *valid = renderWidgetHost_->IsRenderView(); | 291 *valid = renderWidgetHost_->IsRenderView(); |
| 292 return YES; | 292 return YES; |
| 293 } | 293 } |
| 294 | 294 |
| 295 // TODO(groby): Clarify who sends this and if toggleContinuousSpellChecking: |
| 296 // is still necessary. |
| 295 if (action == @selector(toggleContinuousSpellChecking:)) { | 297 if (action == @selector(toggleContinuousSpellChecking:)) { |
| 296 if ([(id)item respondsToSelector:@selector(setState:)]) { | 298 if ([(id)item respondsToSelector:@selector(setState:)]) { |
| 297 content::RenderProcessHost* host = renderWidgetHost_->GetProcess(); | 299 content::RenderProcessHost* host = renderWidgetHost_->GetProcess(); |
| 298 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); | 300 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); |
| 299 DCHECK(profile); | 301 DCHECK(profile); |
| 300 spellcheckChecked_ = | 302 spellcheckChecked_ = |
| 301 profile->GetPrefs()->GetBoolean(prefs::kEnableSpellCheck); | 303 profile->GetPrefs()->GetBoolean(prefs::kEnableSpellCheck); |
| 302 NSCellStateValue checkedState = | 304 NSCellStateValue checkedState = |
| 303 spellcheckChecked_ ? NSOnState : NSOffState; | 305 spellcheckChecked_ ? NSOnState : NSOffState; |
| 304 [(id)item setState:checkedState]; | 306 [(id)item setState:checkedState]; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 spellcheck_mac::SpellingPanelVisible())); | 356 spellcheck_mac::SpellingPanelVisible())); |
| 355 } | 357 } |
| 356 | 358 |
| 357 - (void)toggleContinuousSpellChecking:(id)sender { | 359 - (void)toggleContinuousSpellChecking:(id)sender { |
| 358 content::RenderProcessHost* host = renderWidgetHost_->GetProcess(); | 360 content::RenderProcessHost* host = renderWidgetHost_->GetProcess(); |
| 359 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); | 361 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); |
| 360 DCHECK(profile); | 362 DCHECK(profile); |
| 361 PrefService* pref = profile->GetPrefs(); | 363 PrefService* pref = profile->GetPrefs(); |
| 362 pref->SetBoolean(prefs::kEnableSpellCheck, | 364 pref->SetBoolean(prefs::kEnableSpellCheck, |
| 363 !pref->GetBoolean(prefs::kEnableSpellCheck)); | 365 !pref->GetBoolean(prefs::kEnableSpellCheck)); |
| 364 renderWidgetHost_->Send( | |
| 365 new SpellCheckMsg_ToggleSpellCheck(renderWidgetHost_->GetRoutingID())); | |
| 366 } | 366 } |
| 367 | 367 |
| 368 - (void)spellCheckEnabled:(BOOL)enabled checked:(BOOL)checked { | 368 - (void)spellCheckEnabled:(BOOL)enabled checked:(BOOL)checked { |
| 369 spellcheckEnabled_ = enabled; | 369 spellcheckEnabled_ = enabled; |
| 370 spellcheckChecked_ = checked; | 370 spellcheckChecked_ = checked; |
| 371 } | 371 } |
| 372 | 372 |
| 373 // END Spellchecking methods | 373 // END Spellchecking methods |
| 374 | 374 |
| 375 @end | 375 @end |
| OLD | NEW |