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

Unified Diff: components/autofill/content/renderer/form_autofill_util.cc

Issue 1106313002: Revert of Limit form-less Autofilling to pages that look like checkout pages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: components/autofill/content/renderer/form_autofill_util.cc
diff --git a/components/autofill/content/renderer/form_autofill_util.cc b/components/autofill/content/renderer/form_autofill_util.cc
index ab28cde1ad9f8c3d235a463db9090732c5787183..b1f3056e69a2516320d86e87637ef981da1e7158 100644
--- a/components/autofill/content/renderer/form_autofill_util.cc
+++ b/components/autofill/content/renderer/form_autofill_util.cc
@@ -14,7 +14,6 @@
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "components/autofill/core/common/autofill_data_validation.h"
-#include "components/autofill/core/common/autofill_regexes.h"
#include "components/autofill/core/common/autofill_switches.h"
#include "components/autofill/core/common/form_data.h"
#include "components/autofill/core/common/form_field_data.h"
@@ -1162,8 +1161,9 @@
// labels for all form control elements are scraped from the DOM and set in
// WebFormElementToFormData.
field->name = element.nameForAutofill();
- field->form_control_type = element.formControlType().utf8();
- field->autocomplete_attribute = element.getAttribute(kAutocomplete).utf8();
+ field->form_control_type = base::UTF16ToUTF8(element.formControlType());
+ field->autocomplete_attribute =
+ base::UTF16ToUTF8(element.getAttribute(kAutocomplete));
if (field->autocomplete_attribute.size() > kMaxDataLength) {
// Discard overly long attribute values to avoid DOS-ing the browser
// process. However, send over a default string to indicate that the
@@ -1286,28 +1286,11 @@
const std::vector<blink::WebElement>& fieldsets,
const std::vector<blink::WebFormControlElement>& control_elements,
const blink::WebFormControlElement* element,
- const blink::WebDocument& document,
+ const GURL& origin,
ExtractMask extract_mask,
FormData* form,
FormFieldData* field) {
- // Only attempt formless Autofill on checkout flows. This avoids the many
- // false positives found on the non-checkout web. See http://crbug.com/462375
- // For now this early abort only applies to English-language pages, because
- // the regex is not translated. Note that an empty "lang" attribute counts as
- // English. A potential problem is that this only checks document.title(), but
- // should actually check the main frame's title. Thus it may make bad
- // decisions for iframes.
- WebElement html_element = document.documentElement();
- std::string lang;
- if (!html_element.isNull())
- lang = html_element.getAttribute("lang").utf8();
- if ((lang.empty() || StartsWithASCII(lang, "en", false)) &&
- !MatchesPattern(document.title(),
- base::UTF8ToUTF16("payment|checkout|address|delivery|shipping"))) {
- return false;
- }
-
- form->origin = document.url();
+ form->origin = origin;
form->user_submitted = false;
form->is_form_tag = false;
@@ -1331,7 +1314,7 @@
std::vector<WebFormControlElement> control_elements =
GetUnownedAutofillableFormFieldElements(document.all(), &fieldsets);
return UnownedFormElementsAndFieldSetsToFormData(
- fieldsets, control_elements, &element, document, extract_mask,
+ fieldsets, control_elements, &element, document.url(), extract_mask,
form, field);
}
« no previous file with comments | « components/autofill/content/renderer/form_autofill_util.h ('k') | components/autofill/content/renderer/form_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698