OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 | 8 |
9 MSVC_PUSH_WARNING_LEVEL(0); | 9 MSVC_PUSH_WARNING_LEVEL(0); |
10 #include "Document.h" | 10 #include "Document.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 WebCore::HTMLInputElement* old_password = NULL; | 55 WebCore::HTMLInputElement* old_password = NULL; |
56 if (!LocateSpecificPasswords(&fields, &password, &old_password)) | 56 if (!LocateSpecificPasswords(&fields, &password, &old_password)) |
57 return NULL; | 57 return NULL; |
58 | 58 |
59 return AssemblePasswordFormResult(full_origin, full_action, | 59 return AssemblePasswordFormResult(full_origin, full_action, |
60 fields.submit, fields.username, | 60 fields.submit, fields.username, |
61 old_password, password); | 61 old_password, password); |
62 } | 62 } |
63 | 63 |
64 // static | 64 // static |
65 PasswordFormDomManager::FillData* PasswordFormDomManager::CreateFillData( | 65 void PasswordFormDomManager::InitFillData( |
66 const PasswordForm& form_on_page, | 66 const PasswordForm& form_on_page, |
67 const PasswordFormMap& matches, | 67 const PasswordFormMap& matches, |
68 const PasswordForm* const preferred_match, | 68 const PasswordForm* const preferred_match, |
69 bool wait_for_username_before_autofill) { | 69 bool wait_for_username_before_autofill, |
| 70 PasswordFormDomManager::FillData* result) { |
70 DCHECK(preferred_match); | 71 DCHECK(preferred_match); |
71 PasswordFormDomManager::FillData* result = | |
72 new PasswordFormDomManager::FillData(); | |
73 | |
74 // Fill basic form data. | 72 // Fill basic form data. |
75 result->basic_data.origin = form_on_page.origin; | 73 result->basic_data.origin = form_on_page.origin; |
76 result->basic_data.action = form_on_page.action; | 74 result->basic_data.action = form_on_page.action; |
77 result->basic_data.elements.push_back(form_on_page.username_element); | 75 result->basic_data.elements.push_back(form_on_page.username_element); |
78 result->basic_data.values.push_back(preferred_match->username_value); | 76 result->basic_data.values.push_back(preferred_match->username_value); |
79 result->basic_data.elements.push_back(form_on_page.password_element); | 77 result->basic_data.elements.push_back(form_on_page.password_element); |
80 result->basic_data.values.push_back(preferred_match->password_value); | 78 result->basic_data.values.push_back(preferred_match->password_value); |
81 result->basic_data.submit = form_on_page.submit_element; | 79 result->basic_data.submit = form_on_page.submit_element; |
82 result->wait_for_username = wait_for_username_before_autofill; | 80 result->wait_for_username = wait_for_username_before_autofill; |
83 | 81 |
84 // Copy additional username/value pairs. | 82 // Copy additional username/value pairs. |
85 PasswordFormMap::const_iterator iter; | 83 PasswordFormMap::const_iterator iter; |
86 for (iter = matches.begin(); iter != matches.end(); iter++) { | 84 for (iter = matches.begin(); iter != matches.end(); iter++) { |
87 if (iter->second != preferred_match) | 85 if (iter->second != preferred_match) |
88 result->additional_logins[iter->first] = iter->second->password_value; | 86 result->additional_logins[iter->first] = iter->second->password_value; |
89 } | 87 } |
90 return result; | |
91 } | 88 } |
92 | 89 |
93 // static | 90 // static |
94 bool PasswordFormDomManager::LocateSpecificPasswords( | 91 bool PasswordFormDomManager::LocateSpecificPasswords( |
95 PasswordFormFields* fields, | 92 PasswordFormFields* fields, |
96 WebCore::HTMLInputElement** password, | 93 WebCore::HTMLInputElement** password, |
97 WebCore::HTMLInputElement** old_password) { | 94 WebCore::HTMLInputElement** old_password) { |
98 DCHECK(fields && password && old_password); | 95 DCHECK(fields && password && old_password); |
99 switch (fields->passwords.size()) { | 96 switch (fields->passwords.size()) { |
100 case 1: | 97 case 1: |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 : webkit_glue::StringToStdWString(password->value()); | 267 : webkit_glue::StringToStdWString(password->value()); |
271 result->old_password_element = | 268 result->old_password_element = |
272 old_password == NULL ? empty | 269 old_password == NULL ? empty |
273 : webkit_glue::StringToStdWString(old_password->name()); | 270 : webkit_glue::StringToStdWString(old_password->name()); |
274 result->old_password_value = | 271 result->old_password_value = |
275 old_password == NULL ? empty | 272 old_password == NULL ? empty |
276 : webkit_glue::StringToStdWString(old_password->value()); | 273 : webkit_glue::StringToStdWString(old_password->value()); |
277 return result; | 274 return result; |
278 } | 275 } |
279 | 276 |
OLD | NEW |