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

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

Issue 21947003: [Autofill] Move FieldTypeGroup out of the AutofillType class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 4 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
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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 419
420 RenderViewHost* host = NULL; 420 RenderViewHost* host = NULL;
421 FormStructure* form_structure = NULL; 421 FormStructure* form_structure = NULL;
422 AutofillField* autofill_field = NULL; 422 AutofillField* autofill_field = NULL;
423 if (GetHost(&host) && 423 if (GetHost(&host) &&
424 GetCachedFormAndField(form, field, &form_structure, &autofill_field) && 424 GetCachedFormAndField(form, field, &form_structure, &autofill_field) &&
425 // Don't send suggestions for forms that aren't auto-fillable. 425 // Don't send suggestions for forms that aren't auto-fillable.
426 form_structure->IsAutofillable(false)) { 426 form_structure->IsAutofillable(false)) {
427 AutofillFieldType type = autofill_field->type(); 427 AutofillFieldType type = autofill_field->type();
428 bool is_filling_credit_card = 428 bool is_filling_credit_card =
429 (AutofillType(type).group() == AutofillType::CREDIT_CARD); 429 (AutofillType(type).group() == CREDIT_CARD);
430 if (is_filling_credit_card) { 430 if (is_filling_credit_card) {
431 GetCreditCardSuggestions( 431 GetCreditCardSuggestions(
432 field, type, &values, &labels, &icons, &unique_ids); 432 field, type, &values, &labels, &icons, &unique_ids);
433 } else { 433 } else {
434 GetProfileSuggestions( 434 GetProfileSuggestions(
435 form_structure, field, type, &values, &labels, &icons, &unique_ids); 435 form_structure, field, type, &values, &labels, &icons, &unique_ids);
436 } 436 }
437 437
438 DCHECK_EQ(values.size(), labels.size()); 438 DCHECK_EQ(values.size(), labels.size());
439 DCHECK_EQ(values.size(), icons.size()); 439 DCHECK_EQ(values.size(), icons.size());
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 DCHECK_EQ(form_structure->field_count(), form.fields.size()); 539 DCHECK_EQ(form_structure->field_count(), form.fields.size());
540 for (size_t i = 0; i < form_structure->field_count(); ++i) { 540 for (size_t i = 0; i < form_structure->field_count(); ++i) {
541 if (form_structure->field(i)->section() != autofill_field->section()) 541 if (form_structure->field(i)->section() != autofill_field->section())
542 continue; 542 continue;
543 543
544 DCHECK_EQ(*form_structure->field(i), result.fields[i]); 544 DCHECK_EQ(*form_structure->field(i), result.fields[i]);
545 545
546 const AutofillField* cached_field = form_structure->field(i); 546 const AutofillField* cached_field = form_structure->field(i);
547 FieldTypeGroup field_group_type = 547 FieldTypeGroup field_group_type =
548 AutofillType(cached_field->type()).group(); 548 AutofillType(cached_field->type()).group();
549 if (field_group_type != AutofillType::NO_GROUP) { 549 if (field_group_type != NO_GROUP) {
550 // If the field being filled is either 550 // If the field being filled is either
551 // (a) the field that the user initiated the fill from, or 551 // (a) the field that the user initiated the fill from, or
552 // (b) part of the same logical unit, e.g. name or phone number, 552 // (b) part of the same logical unit, e.g. name or phone number,
553 // then take the multi-profile "variant" into account. 553 // then take the multi-profile "variant" into account.
554 // Otherwise fill with the default (zeroth) variant. 554 // Otherwise fill with the default (zeroth) variant.
555 size_t use_variant = 0; 555 size_t use_variant = 0;
556 if (result.fields[i] == field || 556 if (result.fields[i] == field ||
557 field_group_type == initiating_group_type) { 557 field_group_type == initiating_group_type) {
558 use_variant = variant; 558 use_variant = variant;
559 } 559 }
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
1213 1213
1214 void AutofillManager::UpdateInitialInteractionTimestamp( 1214 void AutofillManager::UpdateInitialInteractionTimestamp(
1215 const TimeTicks& interaction_timestamp) { 1215 const TimeTicks& interaction_timestamp) {
1216 if (initial_interaction_timestamp_.is_null() || 1216 if (initial_interaction_timestamp_.is_null() ||
1217 interaction_timestamp < initial_interaction_timestamp_) { 1217 interaction_timestamp < initial_interaction_timestamp_) {
1218 initial_interaction_timestamp_ = interaction_timestamp; 1218 initial_interaction_timestamp_ = interaction_timestamp;
1219 } 1219 }
1220 } 1220 }
1221 1221
1222 } // namespace autofill 1222 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/content/browser/wallet/wallet_items.cc ('k') | components/autofill/core/browser/autofill_metrics.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698