| 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/password_generation_agent.h" | 5 #include "components/autofill/content/renderer/password_generation_agent.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "components/autofill/content/common/autofill_messages.h" | 10 #include "components/autofill/content/common/autofill_messages.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 const blink::WebFormElement& form, | 35 const blink::WebFormElement& form, |
| 36 std::vector<blink::WebInputElement>* passwords) { | 36 std::vector<blink::WebInputElement>* passwords) { |
| 37 // Grab all of the passwords for the form. | 37 // Grab all of the passwords for the form. |
| 38 blink::WebVector<blink::WebFormControlElement> control_elements; | 38 blink::WebVector<blink::WebFormControlElement> control_elements; |
| 39 form.getFormControlElements(control_elements); | 39 form.getFormControlElements(control_elements); |
| 40 | 40 |
| 41 size_t num_input_elements = 0; | 41 size_t num_input_elements = 0; |
| 42 for (size_t i = 0; i < control_elements.size(); i++) { | 42 for (size_t i = 0; i < control_elements.size(); i++) { |
| 43 blink::WebInputElement* input_element = | 43 blink::WebInputElement* input_element = |
| 44 toWebInputElement(&control_elements[i]); | 44 toWebInputElement(&control_elements[i]); |
| 45 // Only pay attention to visible password fields. | 45 if (input_element && input_element->isTextField()) { |
| 46 if (input_element && | |
| 47 input_element->isTextField() && | |
| 48 input_element->hasNonEmptyBoundingBox()) { | |
| 49 num_input_elements++; | 46 num_input_elements++; |
| 50 if (input_element->isPasswordField()) | 47 if (input_element->isPasswordField()) |
| 51 passwords->push_back(*input_element); | 48 passwords->push_back(*input_element); |
| 52 } | 49 } |
| 53 } | 50 } |
| 54 | 51 |
| 55 // This may be too lenient, but we assume that any form with at least three | 52 // This may be too lenient, but we assume that any form with at least three |
| 56 // input elements where at least one of them is a password is an account | 53 // input elements where at least one of them is a password is an account |
| 57 // creation form. | 54 // creation form. |
| 58 if (!passwords->empty() && num_input_elements >= 3) { | 55 if (!passwords->empty() && num_input_elements >= 3) { |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 *possible_account_creation_form_)); | 400 *possible_account_creation_form_)); |
| 404 | 401 |
| 405 editing_popup_shown_ = true; | 402 editing_popup_shown_ = true; |
| 406 } | 403 } |
| 407 | 404 |
| 408 void PasswordGenerationAgent::HidePopup() { | 405 void PasswordGenerationAgent::HidePopup() { |
| 409 Send(new AutofillHostMsg_HidePasswordGenerationPopup(routing_id())); | 406 Send(new AutofillHostMsg_HidePasswordGenerationPopup(routing_id())); |
| 410 } | 407 } |
| 411 | 408 |
| 412 } // namespace autofill | 409 } // namespace autofill |
| OLD | NEW |