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

Side by Side Diff: chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc

Issue 98693017: Some nits I found while looking around rAc() code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 11 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
« no previous file with comments | « no previous file | chrome/browser/ui/autofill/autofill_dialog_types.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" 5 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 common::BuildInputsForSection(SECTION_BILLING, 608 common::BuildInputsForSection(SECTION_BILLING,
609 &requested_billing_fields_); 609 &requested_billing_fields_);
610 common::BuildInputsForSection(SECTION_CC_BILLING, 610 common::BuildInputsForSection(SECTION_CC_BILLING,
611 &requested_cc_billing_fields_); 611 &requested_cc_billing_fields_);
612 common::BuildInputsForSection(SECTION_SHIPPING, 612 common::BuildInputsForSection(SECTION_SHIPPING,
613 &requested_shipping_fields_); 613 &requested_shipping_fields_);
614 614
615 // Test whether we need to show the shipping section. If filling that section 615 // Test whether we need to show the shipping section. If filling that section
616 // would be a no-op, don't show it. 616 // would be a no-op, don't show it.
617 const DetailInputs& inputs = RequestedFieldsForSection(SECTION_SHIPPING); 617 const DetailInputs& inputs = RequestedFieldsForSection(SECTION_SHIPPING);
618 EmptyDataModelWrapper empty_wrapper; 618 cares_about_shipping_ = EmptyDataModelWrapper().FillFormStructure(
619 cares_about_shipping_ = empty_wrapper.FillFormStructure(
620 inputs, 619 inputs,
621 base::Bind(common::DetailInputMatchesField, SECTION_SHIPPING), 620 base::Bind(common::DetailInputMatchesField, SECTION_SHIPPING),
622 &form_structure_); 621 &form_structure_);
623 622
624 account_chooser_model_.reset( 623 account_chooser_model_.reset(
625 new AccountChooserModel(this, 624 new AccountChooserModel(this,
626 profile_, 625 profile_,
627 !ShouldShowAccountChooser(), 626 !ShouldShowAccountChooser(),
628 metric_logger_)); 627 metric_logger_));
629 628
(...skipping 2122 matching lines...) Expand 10 before | Expand all | Expand 10 after
2752 suggested_cc_.AddKeyedItemWithIcon( 2751 suggested_cc_.AddKeyedItemWithIcon(
2753 cards[i]->guid(), 2752 cards[i]->guid(),
2754 cards[i]->Label(), 2753 cards[i]->Label(),
2755 rb.GetImageNamed(CreditCard::IconResourceId(cards[i]->type()))); 2754 rb.GetImageNamed(CreditCard::IconResourceId(cards[i]->type())));
2756 } 2755 }
2757 2756
2758 const std::vector<AutofillProfile*>& profiles = manager->GetProfiles(); 2757 const std::vector<AutofillProfile*>& profiles = manager->GetProfiles();
2759 std::vector<base::string16> labels; 2758 std::vector<base::string16> labels;
2760 AutofillProfile::CreateDifferentiatingLabels(profiles, &labels); 2759 AutofillProfile::CreateDifferentiatingLabels(profiles, &labels);
2761 DCHECK_EQ(labels.size(), profiles.size()); 2760 DCHECK_EQ(labels.size(), profiles.size());
2762 const std::string app_locale = g_browser_process->GetApplicationLocale();
2763 for (size_t i = 0; i < profiles.size(); ++i) { 2761 for (size_t i = 0; i < profiles.size(); ++i) {
2764 const AutofillProfile& profile = *profiles[i]; 2762 const AutofillProfile& profile = *profiles[i];
2765 if (!HasCompleteAndVerifiedData(profile, requested_shipping_fields_) || 2763 if (!HasCompleteAndVerifiedData(profile, requested_shipping_fields_) ||
2766 HasInvalidAddress(*profiles[i])) { 2764 HasInvalidAddress(*profiles[i])) {
2767 continue; 2765 continue;
2768 } 2766 }
2769 2767
2770 // Don't add variants for addresses: name is part of credit card and we'll 2768 // Don't add variants for addresses: name is part of credit card and we'll
2771 // just ignore email and phone number variants. 2769 // just ignore email and phone number variants.
2772 suggested_shipping_.AddKeyedItem(profile.guid(), labels[i]); 2770 suggested_shipping_.AddKeyedItem(profile.guid(), labels[i]);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
2838 ShowEditUiIfBadSuggestion(section); 2836 ShowEditUiIfBadSuggestion(section);
2839 UpdateSection(section); 2837 UpdateSection(section);
2840 } 2838 }
2841 2839
2842 UpdateForErrors(); 2840 UpdateForErrors();
2843 } 2841 }
2844 2842
2845 void AutofillDialogControllerImpl::FillOutputForSectionWithComparator( 2843 void AutofillDialogControllerImpl::FillOutputForSectionWithComparator(
2846 DialogSection section, 2844 DialogSection section,
2847 const InputFieldComparator& compare) { 2845 const InputFieldComparator& compare) {
2848 const DetailInputs& inputs = RequestedFieldsForSection(section);
2849
2850 if (!SectionIsActive(section)) 2846 if (!SectionIsActive(section))
2851 return; 2847 return;
2852 2848
2849 const DetailInputs& inputs = RequestedFieldsForSection(section);
2853 scoped_ptr<DataModelWrapper> wrapper = CreateWrapper(section); 2850 scoped_ptr<DataModelWrapper> wrapper = CreateWrapper(section);
2854 if (wrapper) { 2851 if (wrapper) {
2855 // Only fill in data that is associated with this section. 2852 // Only fill in data that is associated with this section.
2856 const DetailInputs& inputs = RequestedFieldsForSection(section); 2853 const DetailInputs& inputs = RequestedFieldsForSection(section);
2857 wrapper->FillFormStructure(inputs, compare, &form_structure_); 2854 wrapper->FillFormStructure(inputs, compare, &form_structure_);
2858 2855
2859 // CVC needs special-casing because the CreditCard class doesn't store or 2856 // CVC needs special-casing because the CreditCard class doesn't store or
2860 // handle them. This isn't necessary when filling the combined CC and 2857 // handle them. This isn't necessary when filling the combined CC and
2861 // billing section as CVC comes from |full_wallet_| in this case. 2858 // billing section as CVC comes from |full_wallet_| in this case.
2862 if (section == SECTION_CC) 2859 if (section == SECTION_CC)
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
3538 view_->UpdateButtonStrip(); 3535 view_->UpdateButtonStrip();
3539 } 3536 }
3540 3537
3541 void AutofillDialogControllerImpl::FetchWalletCookie() { 3538 void AutofillDialogControllerImpl::FetchWalletCookie() {
3542 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); 3539 net::URLRequestContextGetter* request_context = profile_->GetRequestContext();
3543 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); 3540 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context));
3544 signin_helper_->StartWalletCookieValueFetch(); 3541 signin_helper_->StartWalletCookieValueFetch();
3545 } 3542 }
3546 3543
3547 } // namespace autofill 3544 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/autofill/autofill_dialog_types.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698