summaryrefslogtreecommitdiffstats
path: root/chrome
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 /chrome
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 'chrome')
-rw-r--r--chrome/renderer/print_web_view_helper.cc4
-rw-r--r--chrome/renderer/print_web_view_helper.h6
-rw-r--r--chrome/renderer/render_view.cc61
-rw-r--r--chrome/renderer/render_view.h12
4 files changed, 44 insertions, 39 deletions
diff --git a/chrome/renderer/print_web_view_helper.cc b/chrome/renderer/print_web_view_helper.cc
index a019e8b..7a14eb4 100644
--- a/chrome/renderer/print_web_view_helper.cc
+++ b/chrome/renderer/print_web_view_helper.cc
@@ -163,6 +163,10 @@ void PrintWebViewHelper::didStopLoading() {
PrintPages(*print_pages_params_.get(), print_web_view_->GetMainFrame());
}
+WebString PrintWebViewHelper::autoCorrectWord(const WebString& word) {
+ return word;
+}
+
WebRect PrintWebViewHelper::windowRect() {
NOTREACHED();
return WebRect();
diff --git a/chrome/renderer/print_web_view_helper.h b/chrome/renderer/print_web_view_helper.h
index 1566c50..6e9ae43 100644
--- a/chrome/renderer/print_web_view_helper.h
+++ b/chrome/renderer/print_web_view_helper.h
@@ -157,6 +157,12 @@ class PrintWebViewHelper : public WebViewDelegate {
virtual void didChangeContents() {}
virtual void didExecuteCommand(const WebKit::WebString& command_name) {}
virtual void didEndEditing() {}
+ virtual void spellCheck(
+ const WebKit::WebString& text, int& offset, int& length) {}
+ virtual WebKit::WebString autoCorrectWord(
+ const WebKit::WebString& misspelled_word);
+ virtual void updateSpellingUIWithMisspelledWord(
+ const WebKit::WebString& word) {}
virtual void runModalAlertDialog(
WebKit::WebFrame* frame, const WebKit::WebString& message) {}
virtual bool runModalConfirmDialog(
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 406bdca..62e392d 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -274,6 +274,10 @@ void RenderView::SetNextPageID(int32 next_page_id) {
next_page_id_ = next_page_id;
}
+void RenderView::UserMetricsRecordAction(const std::wstring& action) {
+ Send(new ViewHostMsg_UserMetricsRecordAction(routing_id_, action));
+}
+
void RenderView::PluginCrashed(base::ProcessId pid,
const FilePath& plugin_path) {
Send(new ViewHostMsg_CrashedPlugin(routing_id_, pid, plugin_path));
@@ -1513,6 +1517,30 @@ void RenderView::didExecuteCommand(const WebString& command_name) {
UserMetricsRecordAction(name);
}
+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));
+}
+
+WebString RenderView::autoCorrectWord(const WebKit::WebString& word) {
+ std::wstring autocorrect_word;
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess();
+ if (command_line.HasSwitch(switches::kAutoSpellCorrect)) {
+ EnsureDocumentTag();
+ Send(new ViewHostMsg_GetAutoCorrectWord(
+ routing_id_, UTF16ToWideHack(word), document_tag_, &autocorrect_word));
+ }
+ return WideToUTF16Hack(autocorrect_word);
+}
+
+void RenderView::updateSpellingUIWithMisspelledWord(const WebString& word) {
+ Send(new ViewHostMsg_UpdateSpellingPanelWithMisspelledWord(
+ routing_id_, UTF16ToWideHack(word)));
+}
+
void RenderView::runModalAlertDialog(
WebFrame* frame, const WebString& message) {
RunJavaScriptMessage(MessageBoxFlags::kIsJavascriptAlert,
@@ -2673,39 +2701,6 @@ bool RenderView::WasOpenedByUserGesture() const {
return opened_by_user_gesture_;
}
-void RenderView::SpellCheck(const std::wstring& word,
- int* misspell_location,
- int* misspell_length) {
- EnsureDocumentTag();
- Send(new ViewHostMsg_SpellCheck(
- routing_id_, word, document_tag_, misspell_location, misspell_length));
-}
-
-std::wstring RenderView::GetAutoCorrectWord(
- const std::wstring& misspelled_word) {
- std::wstring autocorrect_word;
- const CommandLine& command_line = *CommandLine::ForCurrentProcess();
- if (command_line.HasSwitch(switches::kAutoSpellCorrect)) {
- EnsureDocumentTag();
- Send(new ViewHostMsg_GetAutoCorrectWord(
- routing_id_, misspelled_word, document_tag_, &autocorrect_word));
- }
- return autocorrect_word;
-}
-
-void RenderView::ShowSpellingUI(bool show) {
- Send(new ViewHostMsg_ShowSpellingPanel(routing_id_, show));
-}
-
-void RenderView::UpdateSpellingUIWithMisspelledWord(const std::wstring& word) {
- Send(new ViewHostMsg_UpdateSpellingPanelWithMisspelledWord(
- routing_id_, word));
-}
-
-void RenderView::UserMetricsRecordAction(const std::wstring& action) {
- Send(new ViewHostMsg_UserMetricsRecordAction(routing_id_, action));
-}
-
void RenderView::DnsPrefetch(const std::vector<std::string>& host_names) {
Send(new ViewHostMsg_DnsPrefetch(host_names));
}
diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h
index 753ce12..c510c63 100644
--- a/chrome/renderer/render_view.h
+++ b/chrome/renderer/render_view.h
@@ -212,12 +212,6 @@ class RenderView : public RenderWidget,
const WebKit::WebRect& selection);
virtual bool WasOpenedByUserGesture() const;
virtual void FocusAccessibilityObject(WebCore::AccessibilityObject* acc_obj);
- virtual void SpellCheck(const std::wstring& word,
- int* misspell_location,
- int* misspell_length);
- virtual std::wstring GetAutoCorrectWord(const std::wstring& word);
- virtual void UpdateSpellingUIWithMisspelledWord(const std::wstring& word);
- virtual void ShowSpellingUI(bool show);
virtual void UserMetricsRecordAction(const std::wstring& action);
virtual void DnsPrefetch(const std::vector<std::string>& host_names);
virtual bool HandleCurrentKeyboardEvent();
@@ -255,6 +249,12 @@ class RenderView : public RenderWidget,
virtual void didChangeContents() {}
virtual void didExecuteCommand(const WebKit::WebString& command_name);
virtual void didEndEditing() {}
+ virtual void spellCheck(
+ const WebKit::WebString& text, int& offset, int& length);
+ virtual WebKit::WebString autoCorrectWord(
+ const WebKit::WebString& misspelled_word);
+ virtual void updateSpellingUIWithMisspelledWord(
+ const WebKit::WebString& word);
virtual void runModalAlertDialog(
WebKit::WebFrame* frame, const WebKit::WebString& message);
virtual bool runModalConfirmDialog(