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

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

Issue 1172183002: Move StartsWith[ASCII] to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@string_util3
Patch Set: merger Created 5 years, 6 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 "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 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after
1307 // false positives found on the non-checkout web. See http://crbug.com/462375 1307 // false positives found on the non-checkout web. See http://crbug.com/462375
1308 // For now this early abort only applies to English-language pages, because 1308 // For now this early abort only applies to English-language pages, because
1309 // the regex is not translated. Note that an empty "lang" attribute counts as 1309 // the regex is not translated. Note that an empty "lang" attribute counts as
1310 // English. A potential problem is that this only checks document.title(), but 1310 // English. A potential problem is that this only checks document.title(), but
1311 // should actually check the main frame's title. Thus it may make bad 1311 // should actually check the main frame's title. Thus it may make bad
1312 // decisions for iframes. 1312 // decisions for iframes.
1313 WebElement html_element = document.documentElement(); 1313 WebElement html_element = document.documentElement();
1314 std::string lang; 1314 std::string lang;
1315 if (!html_element.isNull()) 1315 if (!html_element.isNull())
1316 lang = html_element.getAttribute("lang").utf8(); 1316 lang = html_element.getAttribute("lang").utf8();
1317 if ((lang.empty() || StartsWithASCII(lang, "en", false)) && 1317 if ((lang.empty() || base::StartsWithASCII(lang, "en", false)) &&
1318 !MatchesPattern(document.title(), 1318 !MatchesPattern(document.title(),
1319 base::UTF8ToUTF16("payment|checkout|address|delivery|shipping"))) { 1319 base::UTF8ToUTF16("payment|checkout|address|delivery|shipping"))) {
1320 return false; 1320 return false;
1321 } 1321 }
1322 1322
1323 form->origin = document.url(); 1323 form->origin = document.url();
1324 form->user_submitted = false; 1324 form->user_submitted = false;
1325 form->is_form_tag = false; 1325 form->is_form_tag = false;
1326 1326
1327 return FormOrFieldsetsToFormData(nullptr, element, fieldsets, 1327 return FormOrFieldsetsToFormData(nullptr, element, fieldsets,
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1528 1528
1529 gfx::RectF GetScaledBoundingBox(float scale, WebElement* element) { 1529 gfx::RectF GetScaledBoundingBox(float scale, WebElement* element) {
1530 gfx::Rect bounding_box(element->boundsInViewportSpace()); 1530 gfx::Rect bounding_box(element->boundsInViewportSpace());
1531 return gfx::RectF(bounding_box.x() * scale, 1531 return gfx::RectF(bounding_box.x() * scale,
1532 bounding_box.y() * scale, 1532 bounding_box.y() * scale,
1533 bounding_box.width() * scale, 1533 bounding_box.width() * scale,
1534 bounding_box.height() * scale); 1534 bounding_box.height() * scale);
1535 } 1535 }
1536 1536
1537 } // namespace autofill 1537 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698