diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-19 19:17:32 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-19 19:17:32 +0000 |
commit | 2a3a7764dc3343682a888f194c59b9ad48729e4b (patch) | |
tree | a99a6831e8ae561ff3230b254496aa3705684ef2 /chrome/renderer | |
parent | 58ce21e623685e1e7b4c97ed7d59fbfb9c8e9801 (diff) | |
download | chromium_src-2a3a7764dc3343682a888f194c59b9ad48729e4b.zip chromium_src-2a3a7764dc3343682a888f194c59b9ad48729e4b.tar.gz chromium_src-2a3a7764dc3343682a888f194c59b9ad48729e4b.tar.bz2 |
Convert the spellchecker and associated messages and functions to use string16
for words instead of wstring. I also changed some places where it converted the
word to a string to do that conversion at the last possible second before
giving it to Hunspell (since this conversion isn't needed for Mac).
TEST=Covered by unit tests
BUG=none
Review URL: http://codereview.chromium.org/274077
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29435 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/render_view.cc | 24 | ||||
-rw-r--r-- | chrome/renderer/render_view.h | 2 |
2 files changed, 13 insertions, 13 deletions
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 42302bf..bc46f59 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -905,11 +905,11 @@ void RenderView::OnPaste() { UserMetricsRecordAction(L"Paste"); } -void RenderView::OnReplace(const std::wstring& text) { +void RenderView::OnReplace(const string16& text) { if (!webview()) return; - webview()->focusedFrame()->replaceSelection(WideToUTF16Hack(text)); + webview()->focusedFrame()->replaceSelection(text); } void RenderView::OnAdvanceToNextMisspelling() { @@ -1514,23 +1514,23 @@ bool RenderView::handleCurrentKeyboardEvent() { return did_execute_command; } -void RenderView::spellCheck( - const WebString& text, int& misspelled_offset, int& misspelled_length) { +void RenderView::spellCheck(const WebString& text, + int& misspelled_offset, + int& misspelled_length) { EnsureDocumentTag(); - Send(new ViewHostMsg_SpellCheck( - routing_id_, UTF16ToWideHack(text), document_tag_, - &misspelled_offset, &misspelled_length)); + Send(new ViewHostMsg_SpellCheck(routing_id_, text, document_tag_, + &misspelled_offset, &misspelled_length)); } WebString RenderView::autoCorrectWord(const WebKit::WebString& word) { - std::wstring autocorrect_word; + string16 autocorrect_word; const CommandLine& command_line = *CommandLine::ForCurrentProcess(); if (command_line.HasSwitch(switches::kExperimentalSpellcheckerFeatures)) { EnsureDocumentTag(); Send(new ViewHostMsg_GetAutoCorrectWord( - routing_id_, UTF16ToWideHack(word), document_tag_, &autocorrect_word)); + routing_id_, word, document_tag_, &autocorrect_word)); } - return WideToUTF16Hack(autocorrect_word); + return autocorrect_word; } void RenderView::showSpellingUI(bool show) { @@ -1542,8 +1542,8 @@ bool RenderView::isShowingSpellingUI() { } void RenderView::updateSpellingUIWithMisspelledWord(const WebString& word) { - Send(new ViewHostMsg_UpdateSpellingPanelWithMisspelledWord( - routing_id_, UTF16ToWideHack(word))); + Send(new ViewHostMsg_UpdateSpellingPanelWithMisspelledWord(routing_id_, + word)); } bool RenderView::runFileChooser( diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h index bcf3610..e9c1d33 100644 --- a/chrome/renderer/render_view.h +++ b/chrome/renderer/render_view.h @@ -544,7 +544,7 @@ class RenderView : public RenderWidget, void OnCopyToFindPboard(); #endif void OnPaste(); - void OnReplace(const std::wstring& text); + void OnReplace(const string16& text); void OnAdvanceToNextMisspelling(); void OnToggleSpellPanel(bool is_currently_visible); void OnToggleSpellCheck(); |