summaryrefslogtreecommitdiffstats
path: root/chrome/renderer
diff options
context:
space:
mode:
authordarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-16 03:53:39 +0000
committerdarin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-16 03:53:39 +0000
commitacca2a1fc734142de039f65405ef259737d7a8fc (patch)
tree6275718b90618e1445cb824e615aeca7c21e6956 /chrome/renderer
parent923bd8b63206d79cdfb0e5eba5b49e5a6f7eee7d (diff)
downloadchromium_src-acca2a1fc734142de039f65405ef259737d7a8fc.zip
chromium_src-acca2a1fc734142de039f65405ef259737d7a8fc.tar.gz
chromium_src-acca2a1fc734142de039f65405ef259737d7a8fc.tar.bz2
Move autofill related WebView{Delegate} methods into the WebKit API.
This CL also changes a bunch of autofill related wstring values to string16. R=jcampan BUG=24595 TEST=none Review URL: http://codereview.chromium.org/279001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29244 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r--chrome/renderer/print_web_view_helper.h10
-rw-r--r--chrome/renderer/render_view.cc51
-rw-r--r--chrome/renderer/render_view.h21
3 files changed, 44 insertions, 38 deletions
diff --git a/chrome/renderer/print_web_view_helper.h b/chrome/renderer/print_web_view_helper.h
index fee75f8..80b309f 100644
--- a/chrome/renderer/print_web_view_helper.h
+++ b/chrome/renderer/print_web_view_helper.h
@@ -205,13 +205,19 @@ class PrintWebViewHelper : public WebViewDelegate {
virtual int historyBackListCount() { return 0; }
virtual int historyForwardListCount() { return 0; }
virtual void didAddHistoryItem() {}
- virtual void didUpdateInspectorSettings() {}
virtual void focusAccessibilityObject(
const WebKit::WebAccessibilityObject& object) {}
+ virtual void didUpdateInspectorSettings() {}
+ virtual void queryAutofillSuggestions(
+ const WebKit::WebNode& node, const WebKit::WebString& name,
+ const WebKit::WebString& value) {}
+ virtual void removeAutofillSuggestions(
+ const WebKit::WebString& name, const WebKit::WebString& value) {}
// WebKit::WebWidgetClient
virtual void didInvalidateRect(const WebKit::WebRect&) {}
- virtual void didScrollRect(int dx, int dy, const WebKit::WebRect& clipRect) {}
+ virtual void didScrollRect(
+ int dx, int dy, const WebKit::WebRect& clipRect) {}
virtual void didFocus() {}
virtual void didBlur() {}
virtual void didChangeCursor(const WebKit::WebCursorInfo&) {}
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 5691a84..734605a 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -223,8 +223,7 @@ RenderView::RenderView(RenderThreadBase* render_thread,
history_forward_list_count_(0),
has_unload_listener_(false),
decrement_shared_popup_at_destruction_(false),
- form_field_autofill_request_id_(0),
- form_field_autofill_node_id_(0),
+ autofill_query_id_(0),
popup_notification_visible_(false),
spelling_panel_visible_(false),
delay_seconds_for_form_state_sync_(kDefaultDelaySecondsForFormStateSync),
@@ -1233,30 +1232,15 @@ void RenderView::AddGURLSearchProvider(const GURL& osd_url, bool autodetected) {
autodetected));
}
-void RenderView::QueryFormFieldAutofill(const std::wstring& field_name,
- const std::wstring& text,
- int64 node_id) {
- static int message_id_counter = 0;
- form_field_autofill_request_id_ = message_id_counter++;
- form_field_autofill_node_id_ = node_id;
- Send(new ViewHostMsg_QueryFormFieldAutofill(
- routing_id_, form_field_autofill_request_id_, field_name, text));
-}
-
-void RenderView::RemoveStoredAutofillEntry(const std::wstring& name,
- const std::wstring& value) {
- Send(new ViewHostMsg_RemoveAutofillEntry(routing_id_, name, value));
-}
-
void RenderView::OnQueryFormFieldAutofillAck(
- int request_id,
- const std::vector<std::wstring>& suggestions,
+ int query_id,
+ const std::vector<string16>& suggestions,
int default_suggestion_index) {
- if (!webview() || request_id != form_field_autofill_request_id_)
- return;
-
- webview()->AutofillSuggestionsForNode(
- form_field_autofill_node_id_, suggestions, default_suggestion_index);
+ if (webview() && query_id == autofill_query_id_ && !suggestions.empty()) {
+ webview()->applyAutofillSuggestions(
+ autofill_query_node_, suggestions, default_suggestion_index);
+ }
+ autofill_query_node_.reset();
}
void RenderView::OnPopupNotificationVisibilityChanged(bool visible) {
@@ -1716,6 +1700,21 @@ void RenderView::didUpdateInspectorSettings() {
routing_id_, webview()->inspectorSettings().utf8()));
}
+void RenderView::queryAutofillSuggestions(const WebNode& node,
+ const WebString& name,
+ const WebString& value) {
+ static int query_counter = 0;
+ autofill_query_id_ = query_counter++;
+ autofill_query_node_ = node;
+ Send(new ViewHostMsg_QueryFormFieldAutofill(
+ routing_id_, autofill_query_id_, name, value));
+}
+
+void RenderView::removeAutofillSuggestions(const WebString& name,
+ const WebString& value) {
+ Send(new ViewHostMsg_RemoveAutofillEntry(routing_id_, name, value));
+}
+
// WebKit::WebWidgetClient ----------------------------------------------------
// We are supposed to get a single call to Show for a newly created RenderView
@@ -3286,13 +3285,13 @@ void RenderView::AltErrorPageFinished(WebFrame* frame,
void RenderView::OnMoveOrResizeStarted() {
if (webview())
- webview()->HideAutofillPopup();
+ webview()->hideAutofillPopup();
}
void RenderView::OnResize(const gfx::Size& new_size,
const gfx::Rect& resizer_rect) {
if (webview())
- webview()->HideAutofillPopup();
+ webview()->hideAutofillPopup();
RenderWidget::OnResize(new_size, resizer_rect);
}
diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h
index 16b4fe0..f100778 100644
--- a/chrome/renderer/render_view.h
+++ b/chrome/renderer/render_view.h
@@ -38,6 +38,7 @@
#include "webkit/api/public/WebConsoleMessage.h"
#include "webkit/api/public/WebContextMenuData.h"
#include "webkit/api/public/WebFrameClient.h"
+#include "webkit/api/public/WebNode.h"
#include "webkit/api/public/WebTextDirection.h"
#include "webkit/glue/dom_serializer_delegate.h"
#include "webkit/glue/form_data.h"
@@ -164,11 +165,6 @@ class RenderView : public RenderWidget,
virtual void OnMessageReceived(const IPC::Message& msg);
// WebViewDelegate
- virtual void QueryFormFieldAutofill(const std::wstring& field_name,
- const std::wstring& text,
- int64 node_id);
- virtual void RemoveStoredAutofillEntry(const std::wstring& field_name,
- const std::wstring& text);
virtual void LoadNavigationErrorPage(
WebKit::WebFrame* frame,
const WebKit::WebURLRequest& failed_request,
@@ -258,9 +254,14 @@ class RenderView : public RenderWidget,
virtual int historyBackListCount();
virtual int historyForwardListCount();
virtual void didAddHistoryItem();
- virtual void didUpdateInspectorSettings();
virtual void focusAccessibilityObject(
const WebKit::WebAccessibilityObject& acc_obj);
+ virtual void didUpdateInspectorSettings();
+ virtual void queryAutofillSuggestions(
+ const WebKit::WebNode& node, const WebKit::WebString& name,
+ const WebKit::WebString& value);
+ virtual void removeAutofillSuggestions(
+ const WebKit::WebString& name, const WebKit::WebString& value);
virtual WebKit::WebNotificationPresenter* GetNotificationPresenter() {
return notification_provider_.get();
@@ -636,8 +637,8 @@ class RenderView : public RenderWidget,
// Notification that we have received autofill suggestion.
void OnQueryFormFieldAutofillAck(
- int request_id,
- const std::vector<std::wstring>& suggestions,
+ int query_id,
+ const std::vector<string16>& suggestions,
int default_suggestions_index);
// Message that the popup notification has been shown or hidden.
@@ -871,11 +872,11 @@ class RenderView : public RenderWidget,
// The id of the last request sent for form field autofill. Used to ignore
// out of date responses.
- int form_field_autofill_request_id_;
+ int autofill_query_id_;
// The id of the node corresponding to the last request sent for form field
// autofill.
- int64 form_field_autofill_node_id_;
+ WebKit::WebNode autofill_query_node_;
// We need to prevent windows from closing themselves with a window.close()
// call while a blocked popup notification is being displayed. We cannot