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

Side by Side Diff: chrome/browser/autofill/autofill_manager.cc

Issue 11415221: Add support for autofilling radio buttons and checkboxes. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: address comments Created 8 years 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/autofill/autofill_manager.h" 5 #include "chrome/browser/autofill/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 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 if (result.fields[i] == field || 647 if (result.fields[i] == field ||
648 field_group_type == initiating_group_type) { 648 field_group_type == initiating_group_type) {
649 use_variant = variant; 649 use_variant = variant;
650 } 650 }
651 form_group->FillFormField(*cached_field, 651 form_group->FillFormField(*cached_field,
652 use_variant, 652 use_variant,
653 &result.fields[i]); 653 &result.fields[i]);
654 // Mark the cached field as autofilled, so that we can detect when a user 654 // Mark the cached field as autofilled, so that we can detect when a user
655 // edits an autofilled field (for metrics). 655 // edits an autofilled field (for metrics).
656 form_structure->field(i)->is_autofilled = true; 656 form_structure->field(i)->is_autofilled = true;
657 } else if (cached_field->type() == FIELD_WITH_DEFAULT_VALUE &&
658 cached_field->is_checkable) {
659 string16 default_value = UTF8ToUTF16(cached_field->default_value());
660 // Mark the field checked if server says the default value of the field
661 // to be this field's value.
662 result.fields[i].is_checked = (default_value == result.fields[i].value);
663 // Mark the cached field as autofilled, so that we can detect when a user
664 // edits an autofilled field (for metrics).
665 form_structure->field(i)->is_autofilled = true;
657 } 666 }
658 } 667 }
659 668
660 autofilled_form_signatures_.push_front(form_structure->FormSignature()); 669 autofilled_form_signatures_.push_front(form_structure->FormSignature());
661 // Only remember the last few forms that we've seen, both to avoid false 670 // Only remember the last few forms that we've seen, both to avoid false
662 // positives and to avoid wasting memory. 671 // positives and to avoid wasting memory.
663 if (autofilled_form_signatures_.size() > kMaxRecentFormSignaturesToRemember) 672 if (autofilled_form_signatures_.size() > kMaxRecentFormSignaturesToRemember)
664 autofilled_form_signatures_.pop_back(); 673 autofilled_form_signatures_.pop_back();
665 674
666 host->Send(new AutofillMsg_FormDataFilled( 675 host->Send(new AutofillMsg_FormDataFilled(
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
1338 *profile_guid = IDToGUID(profile_id); 1347 *profile_guid = IDToGUID(profile_id);
1339 } 1348 }
1340 1349
1341 void AutofillManager::UpdateInitialInteractionTimestamp( 1350 void AutofillManager::UpdateInitialInteractionTimestamp(
1342 const TimeTicks& interaction_timestamp) { 1351 const TimeTicks& interaction_timestamp) {
1343 if (initial_interaction_timestamp_.is_null() || 1352 if (initial_interaction_timestamp_.is_null() ||
1344 interaction_timestamp < initial_interaction_timestamp_) { 1353 interaction_timestamp < initial_interaction_timestamp_) {
1345 initial_interaction_timestamp_ = interaction_timestamp; 1354 initial_interaction_timestamp_ = interaction_timestamp;
1346 } 1355 }
1347 } 1356 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698