| 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/password_autofill_manager.h" | 5 #include "chrome/renderer/autofill/password_autofill_manager.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "chrome/common/autofill_messages.h" | 10 #include "chrome/common/autofill_messages.h" |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 if (!origin.canAccessPasswordManager()) | 341 if (!origin.canAccessPasswordManager()) |
| 342 return; | 342 return; |
| 343 | 343 |
| 344 WebKit::WebVector<WebKit::WebFormElement> forms; | 344 WebKit::WebVector<WebKit::WebFormElement> forms; |
| 345 frame->document().forms(forms); | 345 frame->document().forms(forms); |
| 346 | 346 |
| 347 std::vector<content::PasswordForm> password_forms; | 347 std::vector<content::PasswordForm> password_forms; |
| 348 for (size_t i = 0; i < forms.size(); ++i) { | 348 for (size_t i = 0; i < forms.size(); ++i) { |
| 349 const WebKit::WebFormElement& form = forms[i]; | 349 const WebKit::WebFormElement& form = forms[i]; |
| 350 | 350 |
| 351 // Respect autocomplete=off. | |
| 352 if (!form.autoComplete()) | |
| 353 continue; | |
| 354 | |
| 355 // If requested, ignore non-rendered forms, e.g. those styled with | 351 // If requested, ignore non-rendered forms, e.g. those styled with |
| 356 // display:none. | 352 // display:none. |
| 357 if (only_visible && !form.hasNonEmptyBoundingBox()) | 353 if (only_visible && !form.hasNonEmptyBoundingBox()) |
| 358 continue; | 354 continue; |
| 359 | 355 |
| 360 scoped_ptr<content::PasswordForm> password_form( | 356 scoped_ptr<content::PasswordForm> password_form( |
| 361 content::CreatePasswordForm(form)); | 357 content::CreatePasswordForm(form)); |
| 362 if (password_form.get()) | 358 if (password_form.get()) |
| 363 password_forms.push_back(*password_form); | 359 password_forms.push_back(*password_form); |
| 364 } | 360 } |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 LoginToPasswordInfoMap::iterator iter = login_to_password_info_.find(input); | 633 LoginToPasswordInfoMap::iterator iter = login_to_password_info_.find(input); |
| 638 if (iter == login_to_password_info_.end()) | 634 if (iter == login_to_password_info_.end()) |
| 639 return false; | 635 return false; |
| 640 | 636 |
| 641 *found_input = input; | 637 *found_input = input; |
| 642 *found_password = iter->second; | 638 *found_password = iter->second; |
| 643 return true; | 639 return true; |
| 644 } | 640 } |
| 645 | 641 |
| 646 } // namespace autofill | 642 } // namespace autofill |
| OLD | NEW |