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

Side by Side Diff: chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegate.mm

Issue 222783004: Move textual replacement to WebContents. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 // The next five methods are implemented here since this class is the first 211 // The next five methods are implemented here since this class is the first
212 // responder for anything in the browser. 212 // responder for anything in the browser.
213 213
214 // This message is sent whenever the user specifies that a word should be 214 // This message is sent whenever the user specifies that a word should be
215 // changed from the spellChecker. 215 // changed from the spellChecker.
216 - (void)changeSpelling:(id)sender { 216 - (void)changeSpelling:(id)sender {
217 // Grab the currently selected word from the spell panel, as this is the word 217 // Grab the currently selected word from the spell panel, as this is the word
218 // that we want to replace the selected word in the text with. 218 // that we want to replace the selected word in the text with.
219 NSString* newWord = [[sender selectedCell] stringValue]; 219 NSString* newWord = [[sender selectedCell] stringValue];
220 if (newWord != nil) { 220 if (newWord != nil) {
221 renderWidgetHost_->Replace(base::SysNSStringToUTF16(newWord)); 221 content::WebContents* webContents =
222 content::WebContents::FromRenderViewHost(
223 RenderViewHost::From(renderWidgetHost_));
224 webContents->Replace(base::SysNSStringToUTF16(newWord));
222 } 225 }
223 } 226 }
224 227
225 // This message is sent by NSSpellChecker whenever the next word should be 228 // This message is sent by NSSpellChecker whenever the next word should be
226 // advanced to, either after a correction or clicking the "Find Next" button. 229 // advanced to, either after a correction or clicking the "Find Next" button.
227 // This isn't documented anywhere useful, like in NSSpellProtocol.h with the 230 // This isn't documented anywhere useful, like in NSSpellProtocol.h with the
228 // other spelling panel methods. This is probably because Apple assumes that the 231 // other spelling panel methods. This is probably because Apple assumes that the
229 // the spelling panel will be used with an NSText, which will automatically 232 // the spelling panel will be used with an NSText, which will automatically
230 // catch this and advance to the next word for you. Thanks Apple. 233 // catch this and advance to the next word for you. Thanks Apple.
231 // This is also called from the Edit -> Spelling -> Check Spelling menu item. 234 // This is also called from the Edit -> Spelling -> Check Spelling menu item.
(...skipping 29 matching lines...) Expand all
261 } 264 }
262 265
263 - (void)spellCheckEnabled:(BOOL)enabled checked:(BOOL)checked { 266 - (void)spellCheckEnabled:(BOOL)enabled checked:(BOOL)checked {
264 spellcheckEnabled_ = enabled; 267 spellcheckEnabled_ = enabled;
265 spellcheckChecked_ = checked; 268 spellcheckChecked_ = checked;
266 } 269 }
267 270
268 // END Spellchecking methods 271 // END Spellchecking methods
269 272
270 @end 273 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698