| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef COMPONENTS_AUTOFILL_BROWSER_WALLET_WALLET_ITEMS_H_ | 5 #ifndef COMPONENTS_AUTOFILL_BROWSER_WALLET_WALLET_ITEMS_H_ |
| 6 #define COMPONENTS_AUTOFILL_BROWSER_WALLET_WALLET_ITEMS_H_ | 6 #define COMPONENTS_AUTOFILL_BROWSER_WALLET_WALLET_ITEMS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 CreateMaskedInstrument(const base::DictionaryValue& dictionary); | 75 CreateMaskedInstrument(const base::DictionaryValue& dictionary); |
| 76 | 76 |
| 77 bool operator==(const MaskedInstrument& other) const; | 77 bool operator==(const MaskedInstrument& other) const; |
| 78 bool operator!=(const MaskedInstrument& other) const; | 78 bool operator!=(const MaskedInstrument& other) const; |
| 79 | 79 |
| 80 // Gets an image to display for this instrument. | 80 // Gets an image to display for this instrument. |
| 81 const gfx::Image& CardIcon() const; | 81 const gfx::Image& CardIcon() const; |
| 82 | 82 |
| 83 // Returns a pair of strings that summarizes this CC, | 83 // Returns a pair of strings that summarizes this CC, |
| 84 // suitable for display to the user. | 84 // suitable for display to the user. |
| 85 string16 DisplayName() const; | 85 base::string16 DisplayName() const; |
| 86 string16 DisplayNameDetail() const; | 86 base::string16 DisplayNameDetail() const; |
| 87 | 87 |
| 88 // Gets info that corresponds with |type|. | 88 // Gets info that corresponds with |type|. |
| 89 string16 GetInfo(AutofillFieldType type, | 89 base::string16 GetInfo(AutofillFieldType type, |
| 90 const std::string& app_locale) const; | 90 const std::string& app_locale) const; |
| 91 | 91 |
| 92 // Returns the display type of the and last four digits (e.g. Visa - 4444). | 92 // Returns the display type of the and last four digits (e.g. Visa - 4444). |
| 93 string16 TypeAndLastFourDigits() const; | 93 base::string16 TypeAndLastFourDigits() const; |
| 94 | 94 |
| 95 const string16& descriptive_name() const { return descriptive_name_; } | 95 const base::string16& descriptive_name() const { return descriptive_name_; } |
| 96 const Type& type() const { return type_; } | 96 const Type& type() const { return type_; } |
| 97 const std::vector<string16>& supported_currencies() const { | 97 const std::vector<base::string16>& supported_currencies() const { |
| 98 return supported_currencies_; | 98 return supported_currencies_; |
| 99 } | 99 } |
| 100 const string16& last_four_digits() const { return last_four_digits_; } | 100 const base::string16& last_four_digits() const { return last_four_digits_; } |
| 101 int expiration_month() const { return expiration_month_; } | 101 int expiration_month() const { return expiration_month_; } |
| 102 int expiration_year() const { return expiration_year_; } | 102 int expiration_year() const { return expiration_year_; } |
| 103 const Address& address() const { return *address_; } | 103 const Address& address() const { return *address_; } |
| 104 const Status& status() const { return status_; } | 104 const Status& status() const { return status_; } |
| 105 const std::string& object_id() const { return object_id_; } | 105 const std::string& object_id() const { return object_id_; } |
| 106 | 106 |
| 107 private: | 107 private: |
| 108 friend class WalletItemsTest; | 108 friend class WalletItemsTest; |
| 109 friend scoped_ptr<MaskedInstrument> GetTestMaskedInstrument(); | 109 friend scoped_ptr<MaskedInstrument> GetTestMaskedInstrument(); |
| 110 FRIEND_TEST_ALL_PREFIXES(::autofill::WalletInstrumentWrapperTest, | 110 FRIEND_TEST_ALL_PREFIXES(::autofill::WalletInstrumentWrapperTest, |
| 111 GetInfoCreditCardExpMonth); | 111 GetInfoCreditCardExpMonth); |
| 112 FRIEND_TEST_ALL_PREFIXES(WalletItemsTest, CreateMaskedInstrument); | 112 FRIEND_TEST_ALL_PREFIXES(WalletItemsTest, CreateMaskedInstrument); |
| 113 FRIEND_TEST_ALL_PREFIXES(WalletItemsTest, CreateWalletItems); | 113 FRIEND_TEST_ALL_PREFIXES(WalletItemsTest, CreateWalletItems); |
| 114 | 114 |
| 115 MaskedInstrument(const string16& descriptve_name, | 115 MaskedInstrument(const base::string16& descriptve_name, |
| 116 const Type& type, | 116 const Type& type, |
| 117 const std::vector<string16>& supported_currencies, | 117 const std::vector<base::string16>& supported_currencies, |
| 118 const string16& last_four_digits, | 118 const base::string16& last_four_digits, |
| 119 int expiration_month, | 119 int expiration_month, |
| 120 int expiration_year, | 120 int expiration_year, |
| 121 scoped_ptr<Address> address, | 121 scoped_ptr<Address> address, |
| 122 const Status& status, | 122 const Status& status, |
| 123 const std::string& object_id); | 123 const std::string& object_id); |
| 124 | 124 |
| 125 // A user-provided description of the instrument. For example, "Google Visa | 125 // A user-provided description of the instrument. For example, "Google Visa |
| 126 // Card". | 126 // Card". |
| 127 string16 descriptive_name_; | 127 base::string16 descriptive_name_; |
| 128 | 128 |
| 129 // The payment network of the instrument. For example, Visa. | 129 // The payment network of the instrument. For example, Visa. |
| 130 Type type_; | 130 Type type_; |
| 131 | 131 |
| 132 // |supported_currencies_| are ISO 4217 currency codes, e.g. USD. | 132 // |supported_currencies_| are ISO 4217 currency codes, e.g. USD. |
| 133 std::vector<string16> supported_currencies_; | 133 std::vector<base::string16> supported_currencies_; |
| 134 | 134 |
| 135 // The last four digits of the primary account number of the instrument. | 135 // The last four digits of the primary account number of the instrument. |
| 136 string16 last_four_digits_; | 136 base::string16 last_four_digits_; |
| 137 | 137 |
| 138 // |expiration month_| should be 1-12. | 138 // |expiration month_| should be 1-12. |
| 139 int expiration_month_; | 139 int expiration_month_; |
| 140 | 140 |
| 141 // |expiration_year_| should be a 4-digit year. | 141 // |expiration_year_| should be a 4-digit year. |
| 142 int expiration_year_; | 142 int expiration_year_; |
| 143 | 143 |
| 144 // The billing address for the instrument. | 144 // The billing address for the instrument. |
| 145 scoped_ptr<Address> address_; | 145 scoped_ptr<Address> address_; |
| 146 | 146 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 165 | 165 |
| 166 // Returns a document for the privacy policy (acceptance of which is not | 166 // Returns a document for the privacy policy (acceptance of which is not |
| 167 // tracked by the server). | 167 // tracked by the server). |
| 168 static scoped_ptr<LegalDocument> CreatePrivacyPolicyDocument(); | 168 static scoped_ptr<LegalDocument> CreatePrivacyPolicyDocument(); |
| 169 | 169 |
| 170 bool operator==(const LegalDocument& other) const; | 170 bool operator==(const LegalDocument& other) const; |
| 171 bool operator!=(const LegalDocument& other) const; | 171 bool operator!=(const LegalDocument& other) const; |
| 172 | 172 |
| 173 const std::string& id() { return id_; } | 173 const std::string& id() { return id_; } |
| 174 const GURL& url() const { return url_; } | 174 const GURL& url() const { return url_; } |
| 175 const string16& display_name() const { return display_name_; } | 175 const base::string16& display_name() const { return display_name_; } |
| 176 | 176 |
| 177 private: | 177 private: |
| 178 friend class WalletItemsTest; | 178 friend class WalletItemsTest; |
| 179 FRIEND_TEST_ALL_PREFIXES(WalletItemsTest, CreateLegalDocument); | 179 FRIEND_TEST_ALL_PREFIXES(WalletItemsTest, CreateLegalDocument); |
| 180 FRIEND_TEST_ALL_PREFIXES(WalletItemsTest, CreateWalletItems); | 180 FRIEND_TEST_ALL_PREFIXES(WalletItemsTest, CreateWalletItems); |
| 181 FRIEND_TEST_ALL_PREFIXES(WalletItemsTest, LegalDocumentUrl); | 181 FRIEND_TEST_ALL_PREFIXES(WalletItemsTest, LegalDocumentUrl); |
| 182 FRIEND_TEST_ALL_PREFIXES(WalletItemsTest, LegalDocumentEmptyId); | 182 FRIEND_TEST_ALL_PREFIXES(WalletItemsTest, LegalDocumentEmptyId); |
| 183 LegalDocument(const std::string& id, | 183 LegalDocument(const std::string& id, |
| 184 const string16& display_name); | 184 const base::string16& display_name); |
| 185 LegalDocument(const GURL& url, | 185 LegalDocument(const GURL& url, |
| 186 const string16& display_name); | 186 const base::string16& display_name); |
| 187 | 187 |
| 188 // Externalized Online Wallet id for the document, or an empty string for | 188 // Externalized Online Wallet id for the document, or an empty string for |
| 189 // documents not tracked by the server (such as the privacy policy). | 189 // documents not tracked by the server (such as the privacy policy). |
| 190 std::string id_; | 190 std::string id_; |
| 191 // The human-visitable URL that displays the document. | 191 // The human-visitable URL that displays the document. |
| 192 GURL url_; | 192 GURL url_; |
| 193 // User displayable name for the document. | 193 // User displayable name for the document. |
| 194 string16 display_name_; | 194 base::string16 display_name_; |
| 195 DISALLOW_COPY_AND_ASSIGN(LegalDocument); | 195 DISALLOW_COPY_AND_ASSIGN(LegalDocument); |
| 196 }; | 196 }; |
| 197 | 197 |
| 198 ~WalletItems(); | 198 ~WalletItems(); |
| 199 | 199 |
| 200 // Returns null on invalid input, an empty wallet items with required | 200 // Returns null on invalid input, an empty wallet items with required |
| 201 // actions if any are present, and a populated wallet items otherwise. Caller | 201 // actions if any are present, and a populated wallet items otherwise. Caller |
| 202 // owns returned pointer. | 202 // owns returned pointer. |
| 203 static scoped_ptr<WalletItems> | 203 static scoped_ptr<WalletItems> |
| 204 CreateWalletItems(const base::DictionaryValue& dictionary); | 204 CreateWalletItems(const base::DictionaryValue& dictionary); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 // Legal documents the user must accept before using Online Wallet. | 283 // Legal documents the user must accept before using Online Wallet. |
| 284 ScopedVector<LegalDocument> legal_documents_; | 284 ScopedVector<LegalDocument> legal_documents_; |
| 285 | 285 |
| 286 DISALLOW_COPY_AND_ASSIGN(WalletItems); | 286 DISALLOW_COPY_AND_ASSIGN(WalletItems); |
| 287 }; | 287 }; |
| 288 | 288 |
| 289 } // namespace wallet | 289 } // namespace wallet |
| 290 } // namespace autofill | 290 } // namespace autofill |
| 291 | 291 |
| 292 #endif // COMPONENTS_AUTOFILL_BROWSER_WALLET_WALLET_ITEMS_H_ | 292 #endif // COMPONENTS_AUTOFILL_BROWSER_WALLET_WALLET_ITEMS_H_ |
| OLD | NEW |