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

Side by Side Diff: components/autofill/core/browser/autofill_manager.cc

Issue 309063006: Do not autofill element when there is no autofill suggestion from profile (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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/core/browser/autofill_manager.h" 5 #include "components/autofill/core/browser/autofill_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <map> 10 #include <map>
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 !is_credit_card && 550 !is_credit_card &&
551 !value.empty() && 551 !value.empty() &&
552 (result.fields[i] == field || 552 (result.fields[i] == field ||
553 result.fields[i].form_control_type == "select-one" || 553 result.fields[i].form_control_type == "select-one" ||
554 result.fields[i].value.empty()); 554 result.fields[i].value.empty());
555 if (AutofillField::FillFormField( 555 if (AutofillField::FillFormField(
556 *cached_field, value, app_locale_, &result.fields[i])) { 556 *cached_field, value, app_locale_, &result.fields[i])) {
557 // Mark the cached field as autofilled, so that we can detect when a 557 // Mark the cached field as autofilled, so that we can detect when a
558 // user edits an autofilled field (for metrics). 558 // user edits an autofilled field (for metrics).
559 form_structure->field(i)->is_autofilled = true; 559 form_structure->field(i)->is_autofilled = true;
560 // Mark the "select-one" field as autofilled when a non-empty value is
561 // assigned to it.
Ilya Sherman 2014/06/02 23:51:00 Is there any harm to doing this for all the autofi
562 if (result.fields[i].form_control_type == "select-one")
563 result.fields[i].is_autofilled = true;
560 564
561 if (should_notify) 565 if (should_notify)
562 manager_delegate_->DidFillOrPreviewField(value, profile_full_name); 566 manager_delegate_->DidFillOrPreviewField(value, profile_full_name);
563 } 567 }
564 } 568 }
565 } 569 }
566 570
567 autofilled_form_signatures_.push_front(form_structure->FormSignature()); 571 autofilled_form_signatures_.push_front(form_structure->FormSignature());
568 // Only remember the last few forms that we've seen, both to avoid false 572 // Only remember the last few forms that we've seen, both to avoid false
569 // positives and to avoid wasting memory. 573 // positives and to avoid wasting memory.
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 return false; 1142 return false;
1139 1143
1140 // Disregard forms that we wouldn't ever autofill in the first place. 1144 // Disregard forms that we wouldn't ever autofill in the first place.
1141 if (!form.ShouldBeParsed(true)) 1145 if (!form.ShouldBeParsed(true))
1142 return false; 1146 return false;
1143 1147
1144 return true; 1148 return true;
1145 } 1149 }
1146 1150
1147 } // namespace autofill 1151 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698