OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/autofill/autofill_agent.h" | 5 #include "chrome/renderer/autofill/autofill_agent.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 REQUIRE_AUTOCOMPLETE, | 148 REQUIRE_AUTOCOMPLETE, |
149 static_cast<ExtractMask>( | 149 static_cast<ExtractMask>( |
150 EXTRACT_VALUE | EXTRACT_OPTION_TEXT), | 150 EXTRACT_VALUE | EXTRACT_OPTION_TEXT), |
151 &form_data, | 151 &form_data, |
152 NULL)) { | 152 NULL)) { |
153 Send(new AutofillHostMsg_FormSubmitted(routing_id(), form_data, | 153 Send(new AutofillHostMsg_FormSubmitted(routing_id(), form_data, |
154 base::TimeTicks::Now())); | 154 base::TimeTicks::Now())); |
155 } | 155 } |
156 } | 156 } |
157 | 157 |
| 158 void AutofillAgent::ZoomLevelChanged() { |
| 159 // Any time the zoom level changes, the page's content moves, so any Autofill |
| 160 // popups should be hidden. This is only needed for the new Autofill UI |
| 161 // because WebKit already knows to hide the old UI when this occurs. |
| 162 Send(new AutofillHostMsg_HideAutofillPopup(routing_id())); |
| 163 } |
| 164 |
| 165 void AutofillAgent::DidChangeScrollOffset(WebKit::WebFrame*) { |
| 166 // Any time the scroll offset changes, the page's content moves, so Autofill |
| 167 // popups should be hidden. This is only needed for the new Autofill UI |
| 168 // because WebKit already knows to hide the old UI when this occurs. |
| 169 Send(new AutofillHostMsg_HideAutofillPopup(routing_id())); |
| 170 } |
| 171 |
158 bool AutofillAgent::InputElementClicked(const WebInputElement& element, | 172 bool AutofillAgent::InputElementClicked(const WebInputElement& element, |
159 bool was_focused, | 173 bool was_focused, |
160 bool is_focused) { | 174 bool is_focused) { |
161 if (was_focused) | 175 if (was_focused) |
162 ShowSuggestions(element, true, false, true); | 176 ShowSuggestions(element, true, false, true); |
163 | 177 |
164 return false; | 178 return false; |
165 } | 179 } |
166 | 180 |
167 bool AutofillAgent::InputElementLostFocus() { | 181 bool AutofillAgent::InputElementLostFocus() { |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 | 585 |
572 void AutofillAgent::SetNodeText(const string16& value, | 586 void AutofillAgent::SetNodeText(const string16& value, |
573 WebKit::WebInputElement* node) { | 587 WebKit::WebInputElement* node) { |
574 string16 substring = value; | 588 string16 substring = value; |
575 substring = substring.substr(0, node->maxLength()); | 589 substring = substring.substr(0, node->maxLength()); |
576 | 590 |
577 node->setValue(substring, true); | 591 node->setValue(substring, true); |
578 } | 592 } |
579 | 593 |
580 } // namespace autofill | 594 } // namespace autofill |
OLD | NEW |