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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 | 180 |
181 WebVector<WebFormControlElement> control_elements; | 181 WebVector<WebFormControlElement> control_elements; |
182 form.getFormControlElements(control_elements); | 182 form.getFormControlElements(control_elements); |
183 FieldValueAndPropertiesMaskMap user_input; | 183 FieldValueAndPropertiesMaskMap user_input; |
184 for (size_t i = 0; i < control_elements.size(); ++i) { | 184 for (size_t i = 0; i < control_elements.size(); ++i) { |
185 WebInputElement* input_element = toWebInputElement(&control_elements[i]); | 185 WebInputElement* input_element = toWebInputElement(&control_elements[i]); |
186 if (input_element->hasAttribute("set-activated-submit")) | 186 if (input_element->hasAttribute("set-activated-submit")) |
187 input_element->setActivatedSubmit(true); | 187 input_element->setActivatedSubmit(true); |
188 if (with_user_input) { | 188 if (with_user_input) { |
189 const base::string16 element_value = input_element->value(); | 189 const base::string16 element_value = input_element->value(); |
190 user_input[control_elements[i]] = std::make_pair( | 190 user_input[control_elements[i]] = |
191 base::WrapUnique(new base::string16(element_value)), 0U); | 191 std::make_pair(base::MakeUnique<base::string16>(element_value), 0U); |
192 } | 192 } |
193 } | 193 } |
194 | 194 |
195 return CreatePasswordFormFromWebForm( | 195 return CreatePasswordFormFromWebForm( |
196 form, with_user_input ? &user_input : nullptr, predictions); | 196 form, with_user_input ? &user_input : nullptr, predictions); |
197 } | 197 } |
198 | 198 |
199 // Iterates on the form generated by the |html| and adds the fields and type | 199 // Iterates on the form generated by the |html| and adds the fields and type |
200 // predictions corresponding to |predictions_positions| to |predictions|. | 200 // predictions corresponding to |predictions_positions| to |predictions|. |
201 void SetPredictions(const std::string& html, | 201 void SetPredictions(const std::string& html, |
(...skipping 1252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1454 builder.AddPasswordField("password", "secret", nullptr); | 1454 builder.AddPasswordField("password", "secret", nullptr); |
1455 std::string html = builder.ProduceHTML(); | 1455 std::string html = builder.ProduceHTML(); |
1456 | 1456 |
1457 std::unique_ptr<PasswordForm> password_form = | 1457 std::unique_ptr<PasswordForm> password_form = |
1458 LoadHTMLAndConvertForm(html, nullptr, true); | 1458 LoadHTMLAndConvertForm(html, nullptr, true); |
1459 ASSERT_TRUE(password_form); | 1459 ASSERT_TRUE(password_form); |
1460 EXPECT_FALSE(password_form->does_look_like_signup_form); | 1460 EXPECT_FALSE(password_form->does_look_like_signup_form); |
1461 } | 1461 } |
1462 | 1462 |
1463 } // namespace autofill | 1463 } // namespace autofill |
OLD | NEW |