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

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

Issue 23033016: Remove autocheckout code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Even more deletes, and Ilya review. Created 7 years, 3 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 | Annotate | Revision Log
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 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 80
81 bool HasTagName(const WebNode& node, const WebKit::WebString& tag) { 81 bool HasTagName(const WebNode& node, const WebKit::WebString& tag) {
82 return node.isElementNode() && node.toConst<WebElement>().hasTagName(tag); 82 return node.isElementNode() && node.toConst<WebElement>().hasTagName(tag);
83 } 83 }
84 84
85 bool IsAutofillableElement(const WebFormControlElement& element) { 85 bool IsAutofillableElement(const WebFormControlElement& element) {
86 const WebInputElement* input_element = toWebInputElement(&element); 86 const WebInputElement* input_element = toWebInputElement(&element);
87 return IsAutofillableInputElement(input_element) || IsSelectElement(element); 87 return IsAutofillableInputElement(input_element) || IsSelectElement(element);
88 } 88 }
89 89
90 bool IsAutocheckoutEnabled() {
91 return base::FieldTrialList::FindFullName("Autocheckout") == "Yes" ||
92 CommandLine::ForCurrentProcess()->HasSwitch(
93 switches::kEnableExperimentalFormFilling);
94 }
95
96 // Check whether the given field satisfies the REQUIRE_AUTOCOMPLETE requirement. 90 // Check whether the given field satisfies the REQUIRE_AUTOCOMPLETE requirement.
97 // When Autocheckout is enabled, this requirement is enforced in the browser
98 // process rather than in the renderer process, and hence all fields are
99 // considered to satisfy this requirement.
100 bool SatisfiesRequireAutocomplete(const WebInputElement& input_element) { 91 bool SatisfiesRequireAutocomplete(const WebInputElement& input_element) {
101 return input_element.autoComplete() || IsAutocheckoutEnabled(); 92 return input_element.autoComplete();
102 } 93 }
103 94
104 // Appends |suffix| to |prefix| so that any intermediary whitespace is collapsed 95 // Appends |suffix| to |prefix| so that any intermediary whitespace is collapsed
105 // to a single space. If |force_whitespace| is true, then the resulting string 96 // to a single space. If |force_whitespace| is true, then the resulting string
106 // is guaranteed to have a space between |prefix| and |suffix|. Otherwise, the 97 // is guaranteed to have a space between |prefix| and |suffix|. Otherwise, the
107 // result includes a space only if |prefix| has trailing whitespace or |suffix| 98 // result includes a space only if |prefix| has trailing whitespace or |suffix|
108 // has leading whitespace. 99 // has leading whitespace.
109 // A few examples: 100 // A few examples:
110 // * CombineAndCollapseWhitespace("foo", "bar", false) -> "foobar" 101 // * CombineAndCollapseWhitespace("foo", "bar", false) -> "foobar"
111 // * CombineAndCollapseWhitespace("foo", "bar", true) -> "foo bar" 102 // * CombineAndCollapseWhitespace("foo", "bar", true) -> "foo bar"
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 continue; 1070 continue;
1080 1071
1081 if (input_element->isAutofilled()) 1072 if (input_element->isAutofilled())
1082 return true; 1073 return true;
1083 } 1074 }
1084 1075
1085 return false; 1076 return false;
1086 } 1077 }
1087 1078
1088 } // namespace autofill 1079 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698