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 "components/autofill/content/browser/wallet/wallet_items.h" | 5 #include "components/autofill/content/browser/wallet/wallet_items.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "components/autofill/content/browser/wallet/gaia_account.h" | 13 #include "components/autofill/content/browser/wallet/gaia_account.h" |
14 #include "components/autofill/content/browser/wallet/wallet_service_url.h" | 14 #include "components/autofill/content/browser/wallet/wallet_service_url.h" |
| 15 #include "components/autofill/core/browser/autofill_sync_constants.h" |
15 #include "components/autofill/core/browser/autofill_type.h" | 16 #include "components/autofill/core/browser/autofill_type.h" |
16 #include "components/autofill/core/browser/credit_card.h" | 17 #include "components/autofill/core/browser/credit_card.h" |
17 #include "grit/components_scaled_resources.h" | 18 #include "grit/components_scaled_resources.h" |
18 #include "grit/components_strings.h" | 19 #include "grit/components_strings.h" |
19 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
20 #include "ui/base/resource/resource_bundle.h" | 21 #include "ui/base/resource/resource_bundle.h" |
21 #include "ui/gfx/image/image.h" | 22 #include "ui/gfx/image/image.h" |
22 #include "url/gurl.h" | 23 #include "url/gurl.h" |
23 | 24 |
24 namespace autofill { | 25 namespace autofill { |
(...skipping 10 matching lines...) Expand all Loading... |
35 for (size_t i = 0; i < a.size(); ++i) { | 36 for (size_t i = 0; i < a.size(); ++i) { |
36 if (*a[i] != *b[i]) | 37 if (*a[i] != *b[i]) |
37 return false; | 38 return false; |
38 } | 39 } |
39 | 40 |
40 return true; | 41 return true; |
41 } | 42 } |
42 | 43 |
43 WalletItems::MaskedInstrument::Type | 44 WalletItems::MaskedInstrument::Type |
44 TypeFromString(const std::string& type_string) { | 45 TypeFromString(const std::string& type_string) { |
45 if (type_string == "VISA") | 46 if (type_string == kSyncCardTypeVisa) |
46 return WalletItems::MaskedInstrument::VISA; | 47 return WalletItems::MaskedInstrument::VISA; |
47 if (type_string == "MASTER_CARD") | 48 if (type_string == kSyncCardTypeMasterCard) |
48 return WalletItems::MaskedInstrument::MASTER_CARD; | 49 return WalletItems::MaskedInstrument::MASTER_CARD; |
49 if (type_string == "AMEX") | 50 if (type_string == kSyncCardTypeAmex) |
50 return WalletItems::MaskedInstrument::AMEX; | 51 return WalletItems::MaskedInstrument::AMEX; |
51 if (type_string == "DISCOVER") | 52 if (type_string == kSyncCardTypeDiscover) |
52 return WalletItems::MaskedInstrument::DISCOVER; | 53 return WalletItems::MaskedInstrument::DISCOVER; |
53 if (type_string == "SOLO") | 54 if (type_string == kSyncCardTypeSolo) |
54 return WalletItems::MaskedInstrument::SOLO; | 55 return WalletItems::MaskedInstrument::SOLO; |
55 if (type_string == "MAESTRO") | 56 if (type_string == kSyncCardTypeSolo) |
56 return WalletItems::MaskedInstrument::MAESTRO; | 57 return WalletItems::MaskedInstrument::MAESTRO; |
57 if (type_string == "SWITCH") | 58 if (type_string == kSyncCardTypeSwitch) |
58 return WalletItems::MaskedInstrument::SWITCH; | 59 return WalletItems::MaskedInstrument::SWITCH; |
59 return WalletItems::MaskedInstrument::UNKNOWN; | 60 return WalletItems::MaskedInstrument::UNKNOWN; |
60 } | 61 } |
61 | 62 |
62 WalletItems::MaskedInstrument::Status | 63 WalletItems::MaskedInstrument::Status |
63 StatusFromString(const std::string& status_string) { | 64 StatusFromString(const std::string& status_string) { |
64 if (status_string == "AMEX_NOT_SUPPORTED") | 65 if (status_string == "AMEX_NOT_SUPPORTED") |
65 return WalletItems::MaskedInstrument::AMEX_NOT_SUPPORTED; | 66 return WalletItems::MaskedInstrument::AMEX_NOT_SUPPORTED; |
66 if (status_string == "PENDING") | 67 if (status_string == "PENDING") |
67 return WalletItems::MaskedInstrument::PENDING; | 68 return WalletItems::MaskedInstrument::PENDING; |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 other.legal_documents()) && | 587 other.legal_documents()) && |
587 allowed_shipping_countries() == other.allowed_shipping_countries(); | 588 allowed_shipping_countries() == other.allowed_shipping_countries(); |
588 } | 589 } |
589 | 590 |
590 bool WalletItems::operator!=(const WalletItems& other) const { | 591 bool WalletItems::operator!=(const WalletItems& other) const { |
591 return !(*this == other); | 592 return !(*this == other); |
592 } | 593 } |
593 | 594 |
594 } // namespace wallet | 595 } // namespace wallet |
595 } // namespace autofill | 596 } // namespace autofill |
OLD | NEW |