Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(638)

Side by Side Diff: components/autofill/content/renderer/password_form_conversion_utils_browsertest.cc

Issue 2650623002: Use explicit WebString conversions in autofill (Closed)
Patch Set: . Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 LoadWebFormFromHTML(html, &form); 179 LoadWebFormFromHTML(html, &form);
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().utf16();
190 user_input[control_elements[i]] = 190 user_input[control_elements[i]] =
191 std::make_pair(base::MakeUnique<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
(...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after
1464 builder.AddPasswordField("password", "secret", nullptr); 1464 builder.AddPasswordField("password", "secret", nullptr);
1465 std::string html = builder.ProduceHTML(); 1465 std::string html = builder.ProduceHTML();
1466 1466
1467 std::unique_ptr<PasswordForm> password_form = 1467 std::unique_ptr<PasswordForm> password_form =
1468 LoadHTMLAndConvertForm(html, nullptr, true); 1468 LoadHTMLAndConvertForm(html, nullptr, true);
1469 ASSERT_TRUE(password_form); 1469 ASSERT_TRUE(password_form);
1470 EXPECT_FALSE(password_form->does_look_like_signup_form); 1470 EXPECT_FALSE(password_form->does_look_like_signup_form);
1471 } 1471 }
1472 1472
1473 } // namespace autofill 1473 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698