Chromium Code Reviews| Index: chrome/browser/renderer_host/render_widget_host_view_mac.mm |
| =================================================================== |
| --- chrome/browser/renderer_host/render_widget_host_view_mac.mm (revision 70532) |
| +++ chrome/browser/renderer_host/render_widget_host_view_mac.mm (working copy) |
| @@ -1907,10 +1907,41 @@ |
| action == @selector(copy:) || |
| action == @selector(copyToFindPboard:) || |
| action == @selector(paste:) || |
| - action == @selector(pasteAsPlainText:)) { |
| + action == @selector(pasteAsPlainText:) || |
| + action == @selector(checkSpelling:)) { |
| return renderWidgetHostView_->render_widget_host_->IsRenderView(); |
| } |
| + if (action == @selector(toggleContinuousSpellChecking:)) { |
| + RenderViewHost::CommandState state; |
| + state.is_enabled = false; |
| + state.checked_state = 0; |
| + if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { |
| + state = static_cast<RenderViewHost*>( |
| + renderWidgetHostView_->render_widget_host_)-> |
|
brettw
2011/01/09 00:06:06
Ditto for 4 space indents (below as well).
sail
2011/01/12 01:26:36
Done.
|
| + GetStateForCommand("ToggleSpellCheck"); |
| + } |
| + if ([(id)item respondsToSelector:@selector(setState:)]) { |
| + NSCellStateValue checked_state; |
| + switch (state.checked_state) { |
| + case 0: |
| + checked_state = NSOffState; |
| + break; |
| + case 1: |
| + checked_state = NSOnState; |
| + break; |
| + case -1: |
| + checked_state = NSMixedState; |
| + break; |
| + default: |
| + checked_state = NSOffState; |
| + break; |
| + } |
| + [(id)item setState:checked_state]; |
| + } |
| + return state.is_enabled; |
| + } |
| + |
| return editCommand_helper_->IsMenuItemEnabled(action, self); |
| } |
| @@ -2062,6 +2093,7 @@ |
| // other spelling panel methods. This is probably because Apple assumes that the |
| // the spelling panel will be used with an NSText, which will automatically |
| // catch this and advance to the next word for you. Thanks Apple. |
| +// This is also called from the Edit -> Spelling -> Check Spelling menu item. |
| - (void)checkSpelling:(id)sender { |
| RenderWidgetHostViewMac* thisHostView = [self renderWidgetHostViewMac]; |
| thisHostView->GetRenderWidgetHost()->AdvanceToNextMisspelling(); |
| @@ -2084,6 +2116,13 @@ |
| SpellCheckerPlatform::SpellingPanelVisible()); |
| } |
| +- (void)toggleContinuousSpellChecking:(id)sender { |
| + if (renderWidgetHostView_->render_widget_host_->IsRenderView()) { |
| + static_cast<RenderViewHost*>(renderWidgetHostView_->render_widget_host_)-> |
| + ToggleSpellCheck(); |
| + } |
| +} |
| + |
| // END Spellchecking methods |
| // Below is the nasty tooltip stuff -- copied from WebKit's WebHTMLView.mm |