OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/renderer/render_view.h" | 5 #include "chrome/renderer/render_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1945 Send(new ViewHostMsg_UpdateInspectorSettings( | 1945 Send(new ViewHostMsg_UpdateInspectorSettings( |
1946 routing_id_, webview()->inspectorSettings().utf8())); | 1946 routing_id_, webview()->inspectorSettings().utf8())); |
1947 } | 1947 } |
1948 | 1948 |
1949 void RenderView::queryAutofillSuggestions(const WebNode& node, | 1949 void RenderView::queryAutofillSuggestions(const WebNode& node, |
1950 const WebString& name, | 1950 const WebString& name, |
1951 const WebString& value) { | 1951 const WebString& value) { |
1952 static int query_counter = 0; | 1952 static int query_counter = 0; |
1953 autofill_query_id_ = query_counter++; | 1953 autofill_query_id_ = query_counter++; |
1954 autofill_query_node_ = node; | 1954 autofill_query_node_ = node; |
1955 const WebKit::WebInputElement input_element = | 1955 |
1956 node.toConstElement<WebInputElement>(); | 1956 const WebFormControlElement& element = |
1957 Send(new ViewHostMsg_QueryFormFieldAutofill( | 1957 node.toConstElement<WebFormControlElement>(); |
1958 routing_id_, autofill_query_id_, FormField(input_element))); | 1958 |
| 1959 FormData form; |
| 1960 if (!form_manager_.FindFormWithFormControlElement(element, |
| 1961 FormManager::REQUIRE_NONE, |
| 1962 &form)) |
| 1963 return; |
| 1964 |
| 1965 // TODO(jhawkins): This is very slow. Add a label cache to FormManager. |
| 1966 for (std::vector<FormField>::const_iterator iter = form.fields.begin(); |
| 1967 iter != form.fields.end(); ++iter) { |
| 1968 if (iter->name() == element.nameForAutofill()) { |
| 1969 Send(new ViewHostMsg_QueryFormFieldAutofill( |
| 1970 routing_id_, autofill_query_id_, *iter)); |
| 1971 } |
| 1972 } |
1959 } | 1973 } |
1960 | 1974 |
1961 void RenderView::removeAutofillSuggestions(const WebString& name, | 1975 void RenderView::removeAutofillSuggestions(const WebString& name, |
1962 const WebString& value) { | 1976 const WebString& value) { |
1963 Send(new ViewHostMsg_RemoveAutofillEntry(routing_id_, name, value)); | 1977 Send(new ViewHostMsg_RemoveAutofillEntry(routing_id_, name, value)); |
1964 } | 1978 } |
1965 | 1979 |
1966 void RenderView::didAcceptAutoFillSuggestion( | 1980 void RenderView::didAcceptAutoFillSuggestion( |
1967 const WebKit::WebNode& node, | 1981 const WebKit::WebNode& node, |
1968 const WebKit::WebString& name, | 1982 const WebKit::WebString& name, |
(...skipping 2981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4950 | 4964 |
4951 if (last_top_level_navigation_page_id_ != page_id_ && | 4965 if (last_top_level_navigation_page_id_ != page_id_ && |
4952 // Not interested in reloads. | 4966 // Not interested in reloads. |
4953 type != WebKit::WebNavigationTypeReload && | 4967 type != WebKit::WebNavigationTypeReload && |
4954 type != WebKit::WebNavigationTypeFormSubmitted) { | 4968 type != WebKit::WebNavigationTypeFormSubmitted) { |
4955 return true; | 4969 return true; |
4956 } | 4970 } |
4957 } | 4971 } |
4958 return false; | 4972 return false; |
4959 } | 4973 } |
OLD | NEW |