Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 653 current_url.GetOrigin() == source_url_.GetOrigin(); | 653 current_url.GetOrigin() == source_url_.GetOrigin(); |
| 654 | 654 |
| 655 if (!invoked_from_same_origin_) { | 655 if (!invoked_from_same_origin_) { |
| 656 GetMetricLogger().LogDialogSecurityMetric( | 656 GetMetricLogger().LogDialogSecurityMetric( |
| 657 AutofillMetrics::SECURITY_METRIC_CROSS_ORIGIN_FRAME); | 657 AutofillMetrics::SECURITY_METRIC_CROSS_ORIGIN_FRAME); |
| 658 } | 658 } |
| 659 | 659 |
| 660 for (size_t i = SECTION_MIN; i <= SECTION_MAX; ++i) { | 660 for (size_t i = SECTION_MIN; i <= SECTION_MAX; ++i) { |
| 661 DialogSection section = static_cast<DialogSection>(i); | 661 DialogSection section = static_cast<DialogSection>(i); |
| 662 | 662 |
| 663 std::string country_code; | 663 std::string country_code = "US"; |
| 664 CountryComboboxModel* model = CountryComboboxModelForSection(section); | 664 CountryComboboxModel* model = CountryComboboxModelForSection(section); |
| 665 if (model) | 665 if (model) |
| 666 country_code = model->GetDefaultCountryCode(); | 666 country_code = model->GetDefaultCountryCode(); |
| 667 | 667 |
| 668 DetailInputs* inputs = MutableRequestedFieldsForSection(section); | 668 DetailInputs* inputs = MutableRequestedFieldsForSection(section); |
| 669 common::BuildInputsForSection(section, country_code, inputs); | 669 common::BuildInputsForSection(section, country_code, inputs); |
| 670 } | 670 } |
| 671 | 671 |
| 672 // Test whether we need to show the shipping section. If filling that section | 672 // Test whether we need to show the shipping section. If filling that section |
| 673 // would be a no-op, don't show it. | 673 // would be a no-op, don't show it. |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1154 | 1154 |
| 1155 void AutofillDialogControllerImpl::ResetSectionInput(DialogSection section) { | 1155 void AutofillDialogControllerImpl::ResetSectionInput(DialogSection section) { |
| 1156 SetEditingExistingData(section, false); | 1156 SetEditingExistingData(section, false); |
| 1157 | 1157 |
| 1158 if (i18ninput::Enabled()) { | 1158 if (i18ninput::Enabled()) { |
| 1159 CountryComboboxModel* model = CountryComboboxModelForSection(section); | 1159 CountryComboboxModel* model = CountryComboboxModelForSection(section); |
| 1160 if (model) { | 1160 if (model) { |
| 1161 base::string16 country = model->GetItemAt(model->GetDefaultIndex()); | 1161 base::string16 country = model->GetItemAt(model->GetDefaultIndex()); |
| 1162 RebuildInputsForCountry(section, country, false); | 1162 RebuildInputsForCountry(section, country, false); |
| 1163 } | 1163 } |
| 1164 } | 1164 } |
|
Dan Beam
2014/02/07 01:30:44
} else {
Evan Stade
2014/02/08 02:30:13
Done.
| |
| 1165 | 1165 |
| 1166 DetailInputs* inputs = MutableRequestedFieldsForSection(section); | 1166 DetailInputs* inputs = MutableRequestedFieldsForSection(section); |
| 1167 for (DetailInputs::iterator it = inputs->begin(); it != inputs->end(); ++it) { | 1167 for (DetailInputs::iterator it = inputs->begin(); it != inputs->end(); ++it) { |
| 1168 it->initial_value = common::GetHardcodedValueForType(it->type); | 1168 if (!i18ninput::Enabled()) |
|
Dan Beam
2014/02/07 01:30:44
^ remove
Evan Stade
2014/02/08 02:30:13
Done.
| |
| 1169 it->initial_value = common::GetHardcodedValueForType(it->type); | |
| 1169 } | 1170 } |
| 1170 } | 1171 } |
| 1171 | 1172 |
| 1172 void AutofillDialogControllerImpl::ShowEditUiIfBadSuggestion( | 1173 void AutofillDialogControllerImpl::ShowEditUiIfBadSuggestion( |
| 1173 DialogSection section) { | 1174 DialogSection section) { |
| 1174 // |CreateWrapper()| returns an empty wrapper if |IsEditingExistingData()|, so | 1175 // |CreateWrapper()| returns an empty wrapper if |IsEditingExistingData()|, so |
| 1175 // get the wrapper before this potentially happens below. | 1176 // get the wrapper before this potentially happens below. |
| 1176 scoped_ptr<DataModelWrapper> wrapper = CreateWrapper(section); | 1177 scoped_ptr<DataModelWrapper> wrapper = CreateWrapper(section); |
| 1177 | 1178 |
| 1178 // If the chosen item in |model| yields an empty suggestion text, it is | 1179 // If the chosen item in |model| yields an empty suggestion text, it is |
| (...skipping 1988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3167 | 3168 |
| 3168 if (&model == &suggested_cc_billing_) | 3169 if (&model == &suggested_cc_billing_) |
| 3169 return SECTION_CC_BILLING; | 3170 return SECTION_CC_BILLING; |
| 3170 | 3171 |
| 3171 DCHECK_EQ(&model, &suggested_shipping_); | 3172 DCHECK_EQ(&model, &suggested_shipping_); |
| 3172 return SECTION_SHIPPING; | 3173 return SECTION_SHIPPING; |
| 3173 } | 3174 } |
| 3174 | 3175 |
| 3175 CountryComboboxModel* AutofillDialogControllerImpl:: | 3176 CountryComboboxModel* AutofillDialogControllerImpl:: |
| 3176 CountryComboboxModelForSection(DialogSection section) { | 3177 CountryComboboxModelForSection(DialogSection section) { |
| 3177 if (section == SECTION_BILLING || section == SECTION_CC_BILLING) | 3178 if (section == SECTION_BILLING) |
| 3178 return &billing_country_combobox_model_; | 3179 return &billing_country_combobox_model_; |
| 3179 | 3180 |
| 3180 if (section == SECTION_SHIPPING) | 3181 if (section == SECTION_SHIPPING) |
| 3181 return &shipping_country_combobox_model_; | 3182 return &shipping_country_combobox_model_; |
| 3182 | 3183 |
| 3183 return NULL; | 3184 return NULL; |
| 3184 } | 3185 } |
| 3185 | 3186 |
| 3186 DetailInputs* AutofillDialogControllerImpl::MutableRequestedFieldsForSection( | 3187 DetailInputs* AutofillDialogControllerImpl::MutableRequestedFieldsForSection( |
| 3187 DialogSection section) { | 3188 DialogSection section) { |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3784 view_->UpdateButtonStrip(); | 3785 view_->UpdateButtonStrip(); |
| 3785 } | 3786 } |
| 3786 | 3787 |
| 3787 void AutofillDialogControllerImpl::FetchWalletCookie() { | 3788 void AutofillDialogControllerImpl::FetchWalletCookie() { |
| 3788 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); | 3789 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); |
| 3789 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); | 3790 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); |
| 3790 signin_helper_->StartWalletCookieValueFetch(); | 3791 signin_helper_->StartWalletCookieValueFetch(); |
| 3791 } | 3792 } |
| 3792 | 3793 |
| 3793 } // namespace autofill | 3794 } // namespace autofill |
| OLD | NEW |