summaryrefslogtreecommitdiffstats
path: root/webkit/glue
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-23 19:43:56 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-23 19:43:56 +0000
commit1dbafaf7d28dfe0961f1ad2df46bfd85f2e78e92 (patch)
tree032364e60b865a010285caaf8bbf60c2b9cddf2d /webkit/glue
parenteed6b62c57fd10e253a8dfd7704e2ecd3fba5a83 (diff)
downloadchromium_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')
-rw-r--r--webkit/glue/editor_client_impl.cc37
-rw-r--r--webkit/glue/webview_delegate.h29
2 files changed, 14 insertions, 52 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() {
diff --git a/webkit/glue/webview_delegate.h b/webkit/glue/webview_delegate.h
index f9f8837..ced0887 100644
--- a/webkit/glue/webview_delegate.h
+++ b/webkit/glue/webview_delegate.h
@@ -195,9 +195,6 @@ class WebViewDelegate : public WebKit::WebViewClient {
const std::string& frame_charset) {
}
- // Notification that a user metric has occurred.
- virtual void UserMetricsRecordAction(const std::wstring& action) { }
-
// -------------------------------------------------------------------------
// Notification that a request to download an image has completed. |errored|
@@ -225,32 +222,6 @@ class WebViewDelegate : public WebKit::WebViewClient {
// Editor Client -----------------------------------------------------------
- // Returns true if the word is spelled correctly. The word may begin or end
- // with whitespace or punctuation, so the implementor should be sure to handle
- // these cases.
- //
- // If the word is misspelled (returns false), the given first and last
- // indices (inclusive) will be filled with the offsets of the boundary of the
- // word within the given buffer. The out pointers must be specified. If the
- // word is correctly spelled (returns true), they will be set to (0,0).
- virtual void SpellCheck(const std::wstring& word,
- int* misspell_location,
- int* misspell_length) {
- *misspell_location = *misspell_length = 0;
- }
-
- // Computes an auto correct word for a misspelled word. If no word is found,
- // empty string is computed.
- virtual std::wstring GetAutoCorrectWord(const std::wstring& misspelled_word) {
- return std::wstring();
- }
-
- // Switches the spelling panel to be displayed or not based on |show|.
- virtual void ShowSpellingUI(bool show) { }
-
- // Update the spelling panel with the |word|.
- virtual void UpdateSpellingUIWithMisspelledWord(const std::wstring& word) { }
-
// The "CurrentKeyboardEvent" refers to the keyboard event passed to
// WebView's handleInputEvent method.
//