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

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: 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 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 if (result.fields[i] == field || 641 if (result.fields[i] == field ||
642 field_group_type == initiating_group_type) { 642 field_group_type == initiating_group_type) {
643 use_variant = variant; 643 use_variant = variant;
644 } 644 }
645 form_group->FillFormField(*cached_field, 645 form_group->FillFormField(*cached_field,
646 use_variant, 646 use_variant,
647 &result.fields[i]); 647 &result.fields[i]);
648 // Mark the cached field as autofilled, so that we can detect when a user 648 // Mark the cached field as autofilled, so that we can detect when a user
649 // edits an autofilled field (for metrics). 649 // edits an autofilled field (for metrics).
650 form_structure->field(i)->is_autofilled = true; 650 form_structure->field(i)->is_autofilled = true;
651 } else {
652 // Check if the field type is one with default value.
653 if (cached_field->type() == FIELD_WITH_DEFAULT_VALUE &&
654 cached_field->is_checkable) {
655 string16 default_value = ASCIIToUTF16(cached_field->default_value());
656 result.fields[i].is_checked = (default_value == result.fields[i].value);
657 form_structure->field(i)->is_autofilled = true;
658 }
651 } 659 }
652 } 660 }
653 661
654 autofilled_form_signatures_.push_front(form_structure->FormSignature()); 662 autofilled_form_signatures_.push_front(form_structure->FormSignature());
655 // Only remember the last few forms that we've seen, both to avoid false 663 // Only remember the last few forms that we've seen, both to avoid false
656 // positives and to avoid wasting memory. 664 // positives and to avoid wasting memory.
657 if (autofilled_form_signatures_.size() > kMaxRecentFormSignaturesToRemember) 665 if (autofilled_form_signatures_.size() > kMaxRecentFormSignaturesToRemember)
658 autofilled_form_signatures_.pop_back(); 666 autofilled_form_signatures_.pop_back();
659 667
660 host->Send(new AutofillMsg_FormDataFilled( 668 host->Send(new AutofillMsg_FormDataFilled(
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
1314 *profile_guid = IDToGUID(profile_id); 1322 *profile_guid = IDToGUID(profile_id);
1315 } 1323 }
1316 1324
1317 void AutofillManager::UpdateInitialInteractionTimestamp( 1325 void AutofillManager::UpdateInitialInteractionTimestamp(
1318 const TimeTicks& interaction_timestamp) { 1326 const TimeTicks& interaction_timestamp) {
1319 if (initial_interaction_timestamp_.is_null() || 1327 if (initial_interaction_timestamp_.is_null() ||
1320 interaction_timestamp < initial_interaction_timestamp_) { 1328 interaction_timestamp < initial_interaction_timestamp_) {
1321 initial_interaction_timestamp_ = interaction_timestamp; 1329 initial_interaction_timestamp_ = interaction_timestamp;
1322 } 1330 }
1323 } 1331 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698