Index: chrome/browser/autofill/wallet/wallet_items.h |
diff --git a/chrome/browser/autofill/wallet/wallet_items.h b/chrome/browser/autofill/wallet/wallet_items.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f01c83dd683483a392210857a3669f9237a9eb7b |
--- /dev/null |
+++ b/chrome/browser/autofill/wallet/wallet_items.h |
@@ -0,0 +1,162 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_AUTOFILL_WALLET_WALLET_ITEMS_H_ |
+#define CHROME_BROWSER_AUTOFILL_WALLET_WALLET_ITEMS_H_ |
+ |
+#include <string> |
+#include <vector> |
+ |
+#include "base/basictypes.h" |
+#include "base/memory/scoped_ptr.h" |
+#include "base/memory/scoped_vector.h" |
+#include "chrome/browser/autofill/wallet/wallet_address.h" |
+ |
+namespace base { |
+class DictionaryValue; |
+} |
+ |
+namespace wallet { |
+ |
+class WalletItems { |
+ public: |
+ class MaskedInstrument { |
+ public: |
+ enum Type { |
+ UNKNOWN, |
+ VISA, |
+ MASTER_CARD, |
+ AMEX, |
+ DISCOVER, |
+ SOLO, |
+ MAESTRO, |
+ SWITCH, |
+ }; |
+ enum Status { |
+ PENDING, |
+ VALID, |
+ DECLINED, |
+ UNSUPPORTED_COUNTRY, |
+ EXPIRED, |
+ BILLING_INCOMPLETE, |
+ // correspond to any other inapplicable reasons that do not listed above |
+ INAPPLICABLE, |
+ }; |
+ MaskedInstrument(const std::string& descriptve_name, |
+ Type type, |
+ std::vector<std::string> supported_currencies, |
+ const std::string& last_four_digits, |
+ int expiration_month, |
+ int expiration_year, |
+ const std::string& brand, |
+ Address* address, |
+ Status status, |
+ const std::string& object_id); |
+ ~MaskedInstrument(); |
+ static MaskedInstrument* CreateFromDictionary( |
+ base::DictionaryValue* dictionary); |
+ bool operator==(const MaskedInstrument& other) const; |
+ bool operator!=(const MaskedInstrument& other) const; |
+ |
+ const std::string get_descriptive_name() const { return descriptive_name_; } |
+ Type get_type() const { return type_; } |
+ const std::vector<std::string> get_supported_currencies() const { |
+ return supported_currencies_; |
+ } |
+ const std::string get_last_four_digits() const { return last_four_digits_; } |
+ int get_expiration_month() const { return expiration_month_; } |
+ int get_expiration_year() const { return expiration_year_; } |
+ const std::string GetBrand() const { return brand_; } |
+ const Address* get_address() const { return address_.get(); } |
+ Status get_status() const { return status_; } |
+ const std::string get_object_id() const { return object_id_; } |
+ |
+ private: |
+ static Type TypeFromString(const std::string& type_string); |
+ static Status StatusFromString(const std::string& status_string); |
+ std::string descriptive_name_; |
+ Type type_; |
+ std::vector<std::string> supported_currencies_; |
+ std::string last_four_digits_; |
+ int expiration_month_; |
+ int expiration_year_; |
+ std::string brand_; |
+ scoped_ptr<Address> address_; |
+ Status status_; |
+ std::string object_id_; |
+ DISALLOW_COPY_AND_ASSIGN(MaskedInstrument); |
+ }; |
+ |
+ class LegalDocument { |
+ public: |
+ LegalDocument(const std::string& document_id, |
+ const std::string& display_name, |
+ const std::string& document_body); |
+ ~LegalDocument(); |
+ static LegalDocument* CreateFromDictionary( |
+ base::DictionaryValue* dictionary); |
+ bool operator==(const LegalDocument& other) const; |
+ bool operator!=(const LegalDocument& other) const; |
+ |
+ const std::string get_document_id() const { return document_id_; } |
+ const std::string get_display_name() const { return display_name_; } |
+ const std::string get_document_body() const { return document_body_; } |
+ |
+ private: |
+ std::string document_id_; |
+ std::string display_name_; |
+ std::string document_body_; |
+ DISALLOW_COPY_AND_ASSIGN(LegalDocument); |
+ }; |
+ |
+ WalletItems(const std::vector<std::string> required_actions, |
+ const std::string& google_transaction_id, |
+ const std::string& default_instrument_id, |
+ const std::string& default_address_id); |
+ ~WalletItems(); |
+ static WalletItems* CreateFromDictionary(base::DictionaryValue* dictionary); |
+ bool operator==(const WalletItems& other) const; |
+ bool operator!=(const WalletItems& other) const; |
+ |
+ void AddInstrument(MaskedInstrument* instrument) { |
+ instruments_.push_back(instrument); |
+ } |
+ void AddAddress(Address* address) { addresses_.push_back(address); } |
+ void AddLegalDocument(LegalDocument* legal_document) { |
+ legal_documents_.push_back(legal_document); |
+ } |
+ const std::vector<std::string> get_required_actions() const { |
+ return required_actions_; |
+ } |
+ const std::string get_google_transaction_id() const { |
+ return google_transaction_id_; |
+ } |
+ const std::vector<MaskedInstrument*> get_instruments() const { |
+ return instruments_.get(); |
+ } |
+ const std::string get_default_instrument_id() const { |
+ return default_instrument_id_; |
+ } |
+ const std::vector<Address*> get_addresses() const { return addresses_.get(); } |
+ const std::string get_default_address_id() const { |
+ return default_address_id_; |
+ } |
+ const std::vector<LegalDocument*> get_legal_documents() const { |
+ return legal_documents_.get(); |
+ } |
+ |
+ private: |
+ std::vector<std::string> required_actions_; |
+ std::string google_transaction_id_; |
+ std::string default_instrument_id_; |
+ std::string default_address_id_; |
+ ScopedVector<MaskedInstrument> instruments_; |
+ ScopedVector<Address> addresses_; |
+ ScopedVector<LegalDocument> legal_documents_; |
+ DISALLOW_COPY_AND_ASSIGN(WalletItems); |
+}; |
+ |
+} // end namespace wallet |
+ |
+#endif // CHROME_BROWSER_AUTOFILL_WALLET_WALLET_ITEMS_H_ |