Chromium Code Reviews| 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. | |
| 46 if (input_element && | 45 if (input_element && |
| 47 input_element->isTextField() && | 46 input_element->isTextField()) { |
|
vabr (Chromium)
2014/12/03 10:05:24
nit: The if-condition now fits on one line.
Garrett Casto
2014/12/03 20:58:58
Done.
| |
| 48 input_element->hasNonEmptyBoundingBox()) { | |
| 49 num_input_elements++; | 47 num_input_elements++; |
| 50 if (input_element->isPasswordField()) | 48 if (input_element->isPasswordField()) |
| 51 passwords->push_back(*input_element); | 49 passwords->push_back(*input_element); |
| 52 } | 50 } |
| 53 } | 51 } |
| 54 | 52 |
| 55 // This may be too lenient, but we assume that any form with at least three | 53 // 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 | 54 // input elements where at least one of them is a password is an account |
| 57 // creation form. | 55 // creation form. |
| 58 if (!passwords->empty() && num_input_elements >= 3) { | 56 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_)); | 401 *possible_account_creation_form_)); |
| 404 | 402 |
| 405 editing_popup_shown_ = true; | 403 editing_popup_shown_ = true; |
| 406 } | 404 } |
| 407 | 405 |
| 408 void PasswordGenerationAgent::HidePopup() { | 406 void PasswordGenerationAgent::HidePopup() { |
| 409 Send(new AutofillHostMsg_HidePasswordGenerationPopup(routing_id())); | 407 Send(new AutofillHostMsg_HidePasswordGenerationPopup(routing_id())); |
| 410 } | 408 } |
| 411 | 409 |
| 412 } // namespace autofill | 410 } // namespace autofill |
| OLD | NEW |