| 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 CHROME_BROWSER_AUTOFILL_WALLET_WALLET_ITEMS_H_ | 5 #ifndef CHROME_BROWSER_AUTOFILL_WALLET_WALLET_ITEMS_H_ |
| 6 #define CHROME_BROWSER_AUTOFILL_WALLET_WALLET_ITEMS_H_ | 6 #define CHROME_BROWSER_AUTOFILL_WALLET_WALLET_ITEMS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
| 16 #include "base/string16.h" |
| 16 #include "chrome/browser/autofill/wallet/required_action.h" | 17 #include "chrome/browser/autofill/wallet/required_action.h" |
| 17 #include "chrome/browser/autofill/wallet/wallet_address.h" | 18 #include "chrome/browser/autofill/wallet/wallet_address.h" |
| 18 | 19 |
| 19 class GURL; | 20 class GURL; |
| 20 | 21 |
| 21 namespace base { | 22 namespace base { |
| 22 class DictionaryValue; | 23 class DictionaryValue; |
| 23 } | 24 } |
| 24 | 25 |
| 25 namespace wallet { | 26 namespace wallet { |
| 26 | 27 |
| 27 class WalletItemsTest; | 28 class WalletItemsTest; |
| 28 | 29 |
| 30 extern const char kPrivacyNoticeUrl[]; |
| 31 |
| 29 // WalletItems is a collection of cards and addresses that a user picks from to | 32 // WalletItems is a collection of cards and addresses that a user picks from to |
| 30 // construct a full wallet. However, it also provides a transaction ID which | 33 // construct a full wallet. However, it also provides a transaction ID which |
| 31 // must be used throughout all API calls being made using this data. | 34 // must be used throughout all API calls being made using this data. |
| 32 // Additionally, user actions may be required before a purchase can be completed | 35 // Additionally, user actions may be required before a purchase can be completed |
| 33 // using Online Wallet and those actions are present in the object as well. | 36 // using Online Wallet and those actions are present in the object as well. |
| 34 class WalletItems { | 37 class WalletItems { |
| 35 public: | 38 public: |
| 36 // Container for all information about a credit card except for it's card | 39 // Container for all information about a credit card except for it's card |
| 37 // verfication number (CVN) and it's complete primary account number (PAN). | 40 // verfication number (CVN) and it's complete primary account number (PAN). |
| 38 class MaskedInstrument { | 41 class MaskedInstrument { |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 static scoped_ptr<LegalDocument> | 121 static scoped_ptr<LegalDocument> |
| 119 CreateLegalDocument(const base::DictionaryValue& dictionary); | 122 CreateLegalDocument(const base::DictionaryValue& dictionary); |
| 120 | 123 |
| 121 // Get the url where this legal document is hosted. | 124 // Get the url where this legal document is hosted. |
| 122 GURL GetUrl(); | 125 GURL GetUrl(); |
| 123 | 126 |
| 124 bool operator==(const LegalDocument& other) const; | 127 bool operator==(const LegalDocument& other) const; |
| 125 bool operator!=(const LegalDocument& other) const; | 128 bool operator!=(const LegalDocument& other) const; |
| 126 | 129 |
| 127 const std::string& document_id() const { return document_id_; } | 130 const std::string& document_id() const { return document_id_; } |
| 128 const std::string& display_name() const { return display_name_; } | 131 const string16& display_name() const { return display_name_; } |
| 129 | 132 |
| 130 private: | 133 private: |
| 131 friend class WalletItemsTest; | 134 friend class WalletItemsTest; |
| 132 FRIEND_TEST_ALL_PREFIXES(WalletItemsTest, CreateLegalDocument); | 135 FRIEND_TEST_ALL_PREFIXES(WalletItemsTest, CreateLegalDocument); |
| 133 FRIEND_TEST_ALL_PREFIXES(WalletItemsTest, CreateWalletItems); | 136 FRIEND_TEST_ALL_PREFIXES(WalletItemsTest, CreateWalletItems); |
| 134 FRIEND_TEST_ALL_PREFIXES(WalletItemsTest, LegalDocumentGetUrl); | 137 FRIEND_TEST_ALL_PREFIXES(WalletItemsTest, LegalDocumentGetUrl); |
| 135 LegalDocument(const std::string& document_id, | 138 LegalDocument(const std::string& document_id, |
| 136 const std::string& display_name); | 139 const string16& display_name); |
| 137 std::string document_id_; | 140 std::string document_id_; |
| 138 std::string display_name_; | 141 string16 display_name_; |
| 139 DISALLOW_COPY_AND_ASSIGN(LegalDocument); | 142 DISALLOW_COPY_AND_ASSIGN(LegalDocument); |
| 140 }; | 143 }; |
| 141 | 144 |
| 142 ~WalletItems(); | 145 ~WalletItems(); |
| 143 | 146 |
| 144 // Returns null on invalid input, an empty wallet items with required | 147 // Returns null on invalid input, an empty wallet items with required |
| 145 // actions if any are present, and a populated wallet items otherwise. Caller | 148 // actions if any are present, and a populated wallet items otherwise. Caller |
| 146 // owns returned pointer. | 149 // owns returned pointer. |
| 147 static scoped_ptr<WalletItems> | 150 static scoped_ptr<WalletItems> |
| 148 CreateWalletItems(const base::DictionaryValue& dictionary); | 151 CreateWalletItems(const base::DictionaryValue& dictionary); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 ScopedVector<Address> addresses_; | 207 ScopedVector<Address> addresses_; |
| 205 ScopedVector<LegalDocument> legal_documents_; | 208 ScopedVector<LegalDocument> legal_documents_; |
| 206 | 209 |
| 207 DISALLOW_COPY_AND_ASSIGN(WalletItems); | 210 DISALLOW_COPY_AND_ASSIGN(WalletItems); |
| 208 }; | 211 }; |
| 209 | 212 |
| 210 } // namespace wallet | 213 } // namespace wallet |
| 211 | 214 |
| 212 #endif // CHROME_BROWSER_AUTOFILL_WALLET_WALLET_ITEMS_H_ | 215 #endif // CHROME_BROWSER_AUTOFILL_WALLET_WALLET_ITEMS_H_ |
| 213 | 216 |
| OLD | NEW |