diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-23 19:43:56 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-23 19:43:56 +0000 |
commit | 1dbafaf7d28dfe0961f1ad2df46bfd85f2e78e92 (patch) | |
tree | 032364e60b865a010285caaf8bbf60c2b9cddf2d /webkit/glue/editor_client_impl.cc | |
parent | eed6b62c57fd10e253a8dfd7704e2ecd3fba5a83 (diff) | |
download | chromium_src-1dbafaf7d28dfe0961f1ad2df46bfd85f2e78e92.zip chromium_src-1dbafaf7d28dfe0961f1ad2df46bfd85f2e78e92.tar.gz chromium_src-1dbafaf7d28dfe0961f1ad2df46bfd85f2e78e92.tar.bz2 |
Move some more methods from WebViewDelegate to WebViewClient.
This CL also removes two unnecessary methods on WebViewDelegate:
UserMetricsRecordAction and ShowSpellingUI were both never called.
R=dglazkov
BUG=10033
TEST=none
Review URL: http://codereview.chromium.org/227006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26965 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/editor_client_impl.cc')
-rw-r--r-- | webkit/glue/editor_client_impl.cc | 37 |
1 files changed, 14 insertions, 23 deletions
diff --git a/webkit/glue/editor_client_impl.cc b/webkit/glue/editor_client_impl.cc index e64cc20..d4df2a6 100644 --- a/webkit/glue/editor_client_impl.cc +++ b/webkit/glue/editor_client_impl.cc @@ -823,20 +823,18 @@ void EditorClientImpl::learnWord(const WebCore::String&) { NOTIMPLEMENTED(); } -void EditorClientImpl::checkSpellingOfString(const UChar* str, int length, +void EditorClientImpl::checkSpellingOfString(const UChar* text, int length, int* misspellingLocation, int* misspellingLength) { // SpellCheckWord will write (0, 0) into the output vars, which is what our // caller expects if the word is spelled correctly. int spell_location = -1; int spell_length = 0; - WebViewDelegate* d = webview_->delegate(); - // Check to see if the provided str is spelled correctly. - if (isContinuousSpellCheckingEnabled() && d) { - std::wstring word = - webkit_glue::StringToStdWString(WebCore::String(str, length)); - d->SpellCheck(word, &spell_location, &spell_length); + // Check to see if the provided text is spelled correctly. + if (isContinuousSpellCheckingEnabled() && webview_->client()) { + webview_->client()->spellCheck( + WebString(text, length), spell_location, spell_length); } else { spell_location = 0; spell_length = 0; @@ -852,21 +850,18 @@ void EditorClientImpl::checkSpellingOfString(const UChar* str, int length, WebCore::String EditorClientImpl::getAutoCorrectSuggestionForMisspelledWord( const WebCore::String& misspelledWord) { - WebViewDelegate* d = webview_->delegate(); - if (!(isContinuousSpellCheckingEnabled() && d)) + if (!(isContinuousSpellCheckingEnabled() && webview_->client())) return WebCore::String(); - std::wstring word = webkit_glue::StringToStdWString(misspelledWord); - // Do not autocorrect words with capital letters in it except the // first letter. This will remove cases changing "IMB" to "IBM". - for (size_t i = 1; i < word.length(); i++) { - if (u_isupper(static_cast<UChar32>(word[i]))) + for (size_t i = 1; i < misspelledWord.length(); i++) { + if (u_isupper(static_cast<UChar32>(misspelledWord[i]))) return WebCore::String(); } - std::wstring autocorrect_word = d->GetAutoCorrectWord(word); - return webkit_glue::StdWStringToString(autocorrect_word); + return webkit_glue::WebStringToString(webview_->client()->autoCorrectWord( + webkit_glue::StringToWebString(misspelledWord))); } void EditorClientImpl::checkGrammarOfString(const UChar*, int length, @@ -887,18 +882,14 @@ void EditorClientImpl::updateSpellingUIWithGrammarString(const WebCore::String&, void EditorClientImpl::updateSpellingUIWithMisspelledWord( const WebCore::String& misspelled_word) { - std::wstring word = webkit_glue::StringToStdWString(misspelled_word); - WebViewDelegate* d = webview_->delegate(); - if (d) { - d->UpdateSpellingUIWithMisspelledWord(word); + if (webview_->client()) { + webview_->client()->updateSpellingUIWithMisspelledWord( + webkit_glue::StringToWebString(misspelled_word)); } } void EditorClientImpl::showSpellingUI(bool show) { - WebViewDelegate* d = webview_->delegate(); - if (d) { - d->ShowSpellingUI(show); - } + ASSERT_NOT_REACHED(); } bool EditorClientImpl::spellingUIIsShowing() { |