OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/autofill/content/renderer/autofill_agent.h" | 5 #include "components/autofill/content/renderer/autofill_agent.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
235 } | 235 } |
236 | 236 |
237 WebElement web_element = node.toConst<WebElement>(); | 237 WebElement web_element = node.toConst<WebElement>(); |
238 | 238 |
239 if (!web_element.document().frame()) | 239 if (!web_element.document().frame()) |
240 return; | 240 return; |
241 | 241 |
242 const WebInputElement* element = toWebInputElement(&web_element); | 242 const WebInputElement* element = toWebInputElement(&web_element); |
243 | 243 |
244 if (!element || !element->isEnabled() || element->isReadOnly() || | 244 if (!element || !element->isEnabled() || element->isReadOnly() || |
245 !element->isTextField() || element->isPasswordField()) | 245 !element->isTextField()) |
246 return; | 246 return; |
247 | 247 |
248 element_ = *element; | 248 element_ = *element; |
Ilya Sherman
2014/12/11 23:28:55
I honestly don't even remember why it's important
jww
2014/12/12 00:17:43
I think it's as simple as the focused node has cha
Ilya Sherman
2014/12/12 00:25:50
AcceptDataListSuggestion should only be called aft
jww
2014/12/12 00:54:55
My change doesn't touch the assignment of element_
Ilya Sherman
2014/12/12 01:56:02
I think you can still address my more narrow quest
jww
2014/12/12 02:05:49
Ah, got it. I misunderstood your request. Done.
| |
249 } | 249 } |
250 | 250 |
251 void AutofillAgent::OrientationChangeEvent() { | 251 void AutofillAgent::OrientationChangeEvent() { |
252 HidePopup(); | 252 HidePopup(); |
253 } | 253 } |
254 | 254 |
255 void AutofillAgent::Resized() { | 255 void AutofillAgent::Resized() { |
256 HidePopup(); | 256 HidePopup(); |
257 } | 257 } |
258 | 258 |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
603 | 603 |
604 void AutofillAgent::ShowSuggestions(const WebFormControlElement& element, | 604 void AutofillAgent::ShowSuggestions(const WebFormControlElement& element, |
605 const ShowSuggestionsOptions& options) { | 605 const ShowSuggestionsOptions& options) { |
606 if (!element.isEnabled() || element.isReadOnly()) | 606 if (!element.isEnabled() || element.isReadOnly()) |
607 return; | 607 return; |
608 if (!options.datalist_only && !element.suggestedValue().isEmpty()) | 608 if (!options.datalist_only && !element.suggestedValue().isEmpty()) |
609 return; | 609 return; |
610 | 610 |
611 const WebInputElement* input_element = toWebInputElement(&element); | 611 const WebInputElement* input_element = toWebInputElement(&element); |
612 if (input_element) { | 612 if (input_element) { |
613 if (!input_element->isTextField() || input_element->isPasswordField()) | 613 if (!input_element->isTextField()) |
Ilya Sherman
2014/12/11 23:28:55
I am concerned that without the isPasswordField()
jww
2014/12/12 00:17:43
Good point. I moved the guard further down, right
| |
614 return; | 614 return; |
615 if (!options.datalist_only && !input_element->suggestedValue().isEmpty()) | 615 if (!options.datalist_only && !input_element->suggestedValue().isEmpty()) |
616 return; | 616 return; |
617 } else { | 617 } else { |
618 DCHECK(IsTextAreaElement(element)); | 618 DCHECK(IsTextAreaElement(element)); |
619 if (!element.toConst<WebTextAreaElement>().suggestedValue().isEmpty()) | 619 if (!element.toConst<WebTextAreaElement>().suggestedValue().isEmpty()) |
620 return; | 620 return; |
621 } | 621 } |
622 | 622 |
623 // Don't attempt to autofill with values that are too large or if filling | 623 // Don't attempt to autofill with values that are too large or if filling |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
827 void AutofillAgent::LegacyAutofillAgent::Resized() { | 827 void AutofillAgent::LegacyAutofillAgent::Resized() { |
828 agent_->Resized(); | 828 agent_->Resized(); |
829 } | 829 } |
830 | 830 |
831 void AutofillAgent::LegacyAutofillAgent::FrameWillClose( | 831 void AutofillAgent::LegacyAutofillAgent::FrameWillClose( |
832 blink::WebFrame* frame) { | 832 blink::WebFrame* frame) { |
833 agent_->LegacyFrameWillClose(frame); | 833 agent_->LegacyFrameWillClose(frame); |
834 } | 834 } |
835 | 835 |
836 } // namespace autofill | 836 } // namespace autofill |
OLD | NEW |