| 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 "components/autofill/content/renderer/form_autofill_util.h" | 5 #include "components/autofill/content/renderer/form_autofill_util.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1305 // false positives found on the non-checkout web. See http://crbug.com/462375 | 1305 // false positives found on the non-checkout web. See http://crbug.com/462375 |
| 1306 // For now this early abort only applies to English-language pages, because | 1306 // For now this early abort only applies to English-language pages, because |
| 1307 // the regex is not translated. Note that an empty "lang" attribute counts as | 1307 // the regex is not translated. Note that an empty "lang" attribute counts as |
| 1308 // English. A potential problem is that this only checks document.title(), but | 1308 // English. A potential problem is that this only checks document.title(), but |
| 1309 // should actually check the main frame's title. Thus it may make bad | 1309 // should actually check the main frame's title. Thus it may make bad |
| 1310 // decisions for iframes. | 1310 // decisions for iframes. |
| 1311 WebElement html_element = document.documentElement(); | 1311 WebElement html_element = document.documentElement(); |
| 1312 std::string lang; | 1312 std::string lang; |
| 1313 if (!html_element.isNull()) | 1313 if (!html_element.isNull()) |
| 1314 lang = html_element.getAttribute("lang").utf8(); | 1314 lang = html_element.getAttribute("lang").utf8(); |
| 1315 if ((lang.empty() || base::StartsWithASCII(lang, "en", false)) && | 1315 if ((lang.empty() || |
| 1316 base::StartsWith(lang, "en", base::CompareCase::INSENSITIVE_ASCII)) && |
| 1316 !MatchesPattern(document.title(), | 1317 !MatchesPattern(document.title(), |
| 1317 base::UTF8ToUTF16("payment|checkout|address|delivery|shipping"))) { | 1318 base::UTF8ToUTF16("payment|checkout|address|delivery|shipping"))) { |
| 1318 return false; | 1319 return false; |
| 1319 } | 1320 } |
| 1320 | 1321 |
| 1321 form->origin = document.url(); | 1322 form->origin = document.url(); |
| 1322 form->is_form_tag = false; | 1323 form->is_form_tag = false; |
| 1323 | 1324 |
| 1324 return FormOrFieldsetsToFormData(nullptr, element, fieldsets, | 1325 return FormOrFieldsetsToFormData(nullptr, element, fieldsets, |
| 1325 control_elements, extract_mask, form, field); | 1326 control_elements, extract_mask, form, field); |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1540 autofill::GetTextSelectionStart(suggestion, user_input, false); | 1541 autofill::GetTextSelectionStart(suggestion, user_input, false); |
| 1541 // Zero selection start is for password manager, which can show usernames | 1542 // Zero selection start is for password manager, which can show usernames |
| 1542 // that do not begin with the user input value. | 1543 // that do not begin with the user input value. |
| 1543 selection_start = (offset == base::string16::npos) ? 0 : offset; | 1544 selection_start = (offset == base::string16::npos) ? 0 : offset; |
| 1544 } | 1545 } |
| 1545 | 1546 |
| 1546 input_element->setSelectionRange(selection_start, suggestion.length()); | 1547 input_element->setSelectionRange(selection_start, suggestion.length()); |
| 1547 } | 1548 } |
| 1548 | 1549 |
| 1549 } // namespace autofill | 1550 } // namespace autofill |
| OLD | NEW |