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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 1867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1878 wallet_items_->default_instrument_id()) { | 1878 wallet_items_->default_instrument_id()) { |
1879 default_instrument_key = key; | 1879 default_instrument_key = key; |
1880 } | 1880 } |
1881 } | 1881 } |
1882 } | 1882 } |
1883 | 1883 |
1884 // TODO(estade): this should have a URL sublabel. | 1884 // TODO(estade): this should have a URL sublabel. |
1885 suggested_cc_billing_.AddKeyedItem( | 1885 suggested_cc_billing_.AddKeyedItem( |
1886 kAddNewItemKey, | 1886 kAddNewItemKey, |
1887 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_ADD_BILLING_DETAILS)); | 1887 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_ADD_BILLING_DETAILS)); |
1888 suggested_cc_billing_.AddKeyedItem( | 1888 if (!wallet_items_->HasRequiredAction(wallet::SETUP_WALLET)) { |
1889 kManageItemsKey, | 1889 suggested_cc_billing_.AddKeyedItem( |
1890 l10n_util::GetStringUTF16( | 1890 kManageItemsKey, |
1891 IDS_AUTOFILL_DIALOG_MANAGE_BILLING_DETAILS)); | 1891 l10n_util::GetStringUTF16( |
| 1892 IDS_AUTOFILL_DIALOG_MANAGE_BILLING_DETAILS)); |
| 1893 } |
1892 | 1894 |
1893 // Determine which instrument item should be selected. | 1895 // Determine which instrument item should be selected. |
1894 if (!default_instrument_key.empty()) | 1896 if (!default_instrument_key.empty()) |
1895 suggested_cc_billing_.SetCheckedItem(default_instrument_key); | 1897 suggested_cc_billing_.SetCheckedItem(default_instrument_key); |
1896 else if (!first_active_instrument_key.empty()) | 1898 else if (!first_active_instrument_key.empty()) |
1897 suggested_cc_billing_.SetCheckedItem(first_active_instrument_key); | 1899 suggested_cc_billing_.SetCheckedItem(first_active_instrument_key); |
1898 else | 1900 else |
1899 suggested_cc_billing_.SetCheckedItem(kAddNewItemKey); | 1901 suggested_cc_billing_.SetCheckedItem(kAddNewItemKey); |
1900 } | 1902 } |
1901 } else { | 1903 } else { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1954 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_ADD_EMAIL_ADDRESS)); | 1956 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_ADD_EMAIL_ADDRESS)); |
1955 if (!IsPayingWithWallet()) { | 1957 if (!IsPayingWithWallet()) { |
1956 suggested_email_.AddKeyedItem( | 1958 suggested_email_.AddKeyedItem( |
1957 kManageItemsKey, | 1959 kManageItemsKey, |
1958 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_MANAGE_EMAIL_ADDRESS)); | 1960 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_MANAGE_EMAIL_ADDRESS)); |
1959 } | 1961 } |
1960 | 1962 |
1961 suggested_shipping_.AddKeyedItem( | 1963 suggested_shipping_.AddKeyedItem( |
1962 kAddNewItemKey, | 1964 kAddNewItemKey, |
1963 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_ADD_SHIPPING_ADDRESS)); | 1965 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_ADD_SHIPPING_ADDRESS)); |
1964 suggested_shipping_.AddKeyedItem( | 1966 if (!IsPayingWithWallet() || |
1965 kManageItemsKey, | 1967 !wallet_items_->HasRequiredAction(wallet::SETUP_WALLET)) { |
1966 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_MANAGE_SHIPPING_ADDRESS)); | 1968 suggested_shipping_.AddKeyedItem( |
| 1969 kManageItemsKey, |
| 1970 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_MANAGE_SHIPPING_ADDRESS)); |
| 1971 } |
1967 | 1972 |
1968 if (!IsPayingWithWallet()) { | 1973 if (!IsPayingWithWallet()) { |
1969 // When using Autofill, the default option is the first suggestion, if | 1974 // When using Autofill, the default option is the first suggestion, if |
1970 // one exists. Otherwise it's the "Use shipping for billing" item. | 1975 // one exists. Otherwise it's the "Use shipping for billing" item. |
1971 const std::string& first_real_suggestion_item_key = | 1976 const std::string& first_real_suggestion_item_key = |
1972 suggested_shipping_.GetItemKeyAt(1); | 1977 suggested_shipping_.GetItemKeyAt(1); |
1973 if (IsASuggestionItemKey(first_real_suggestion_item_key)) | 1978 if (IsASuggestionItemKey(first_real_suggestion_item_key)) |
1974 suggested_shipping_.SetCheckedItem(first_real_suggestion_item_key); | 1979 suggested_shipping_.SetCheckedItem(first_real_suggestion_item_key); |
1975 } | 1980 } |
1976 | 1981 |
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2621 AutofillMetrics::DIALOG_USER_SIGNED_IN_NO_WALLET_NO_AUTOFILL; | 2626 AutofillMetrics::DIALOG_USER_SIGNED_IN_NO_WALLET_NO_AUTOFILL; |
2622 } | 2627 } |
2623 | 2628 |
2624 // Has Wallet items. | 2629 // Has Wallet items. |
2625 return has_autofill_profiles ? | 2630 return has_autofill_profiles ? |
2626 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_HAS_AUTOFILL : | 2631 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_HAS_AUTOFILL : |
2627 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_NO_AUTOFILL; | 2632 AutofillMetrics::DIALOG_USER_SIGNED_IN_HAS_WALLET_NO_AUTOFILL; |
2628 } | 2633 } |
2629 | 2634 |
2630 } // namespace autofill | 2635 } // namespace autofill |
OLD | NEW |