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

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: addressed review 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 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 &&
Ilya Sherman 2012/12/01 00:54:12 nit: Combine this with the else on line 651, as in
Raman Kakilate 2012/12/06 01:54:05 Done.
654 cached_field->is_checkable) {
655 string16 default_value = ASCIIToUTF16(cached_field->default_value());
Ilya Sherman 2012/12/01 00:54:12 How do you know that the cached_field's default va
Raman Kakilate 2012/12/06 01:54:05 Changed it to UTF8ToUTF16. I am not entirely sure
Ilya Sherman 2012/12/07 01:47:22 I'm not certain, but it's likely. Vadim Berman wo
Raman Kakilate 2012/12/10 18:36:45 Vadim was also not sure. Code says its UTF8. In
656 result.fields[i].is_checked = (default_value == result.fields[i].value);
Ilya Sherman 2012/12/01 00:54:12 I'm confused by this line. Why isn't it just "res
Raman Kakilate 2012/12/06 01:54:05 as I understand, for checkboxes and radio buttons
Ilya Sherman 2012/12/07 01:47:22 If the user can't set the value, why doesn't the s
Raman Kakilate 2012/12/10 18:36:45 For a form with radio buttons, eg. <form> <input
Ilya Sherman 2012/12/11 05:56:19 Perhaps this is a reason to include the value in t
Raman Kakilate 2012/12/11 17:45:45 In this CL, I am counting radio-buttons/checkboxes
657 form_structure->field(i)->is_autofilled = true;
Ilya Sherman 2012/12/01 00:54:12 nit: Please reproduce the comment from line 648-64
Raman Kakilate 2012/12/06 01:54:05 Done.
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