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

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

Issue 17341006: [Password Autofill] Don't fill fields with autocomplete="off". (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/autofill/password_autofill_agent_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/password_autofill_agent.h" 5 #include "components/autofill/content/renderer/password_autofill_agent.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 WebKit::WebInputElement element = it->second; 173 WebKit::WebInputElement element = it->second;
174 // Don't fill a form that has pre-filled values distinct from the ones we 174 // Don't fill a form that has pre-filled values distinct from the ones we
175 // want to fill with. 175 // want to fill with.
176 if (!element.value().isEmpty() && element.value() != data_map[it->first]) 176 if (!element.value().isEmpty() && element.value() != data_map[it->first])
177 return; 177 return;
178 } 178 }
179 179
180 for (FormInputElementMap::iterator it = fe->input_elements.begin(); 180 for (FormInputElementMap::iterator it = fe->input_elements.begin();
181 it != fe->input_elements.end(); ++it) { 181 it != fe->input_elements.end(); ++it) {
182 WebKit::WebInputElement element = it->second; 182 WebKit::WebInputElement element = it->second;
183 if (!IsElementEditable(element)) 183
184 continue; // Don't fill uneditable fields. 184 // Don't fill uneditable fields or fields with autocomplete disabled.
185 if (!IsElementEditable(element) || !element.autoComplete())
186 continue;
185 187
186 // TODO(tkent): Check maxlength and pattern. 188 // TODO(tkent): Check maxlength and pattern.
187 element.setValue(data_map[it->first]); 189 element.setValue(data_map[it->first]);
188 element.setAutofilled(true); 190 element.setAutofilled(true);
189 element.dispatchFormControlChangeEvent(); 191 element.dispatchFormControlChangeEvent();
190 } 192 }
191 } 193 }
192 194
193 void SetElementAutofilled(WebKit::WebInputElement* element, bool autofilled) { 195 void SetElementAutofilled(WebKit::WebInputElement* element, bool autofilled) {
194 if (element->isAutofilled() == autofilled) 196 if (element->isAutofilled() == autofilled)
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 LoginToPasswordInfoMap::iterator iter = login_to_password_info_.find(input); 686 LoginToPasswordInfoMap::iterator iter = login_to_password_info_.find(input);
685 if (iter == login_to_password_info_.end()) 687 if (iter == login_to_password_info_.end())
686 return false; 688 return false;
687 689
688 *found_input = input; 690 *found_input = input;
689 *found_password = iter->second; 691 *found_password = iter->second;
690 return true; 692 return true;
691 } 693 }
692 694
693 } // namespace autofill 695 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/renderer/autofill/password_autofill_agent_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698